diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index 94ed36bbda..0000000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -# [Choice] Go version (use -bullseye variants on local arm64/Apple Silicon): 1, 1.16, 1.17, 1-bullseye, 1.16-bullseye, 1.17-bullseye, 1-buster, 1.16-buster, 1.17-buster -ARG VARIANT=1.20-bullseye -FROM mcr.microsoft.com/vscode/devcontainers/go:0-${VARIANT} - -# [Optional] If your requirements rarely change, uncomment this section to add them to the image. -# COPY requirements.txt /tmp/pip-tmp/ -# RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \ -# && rm -rf /tmp/pip-tmp - -# [Optional] Uncomment this section to install additional OS packages. -# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ -# && apt-get -y install --no-install-recommends - - - diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index 75a2faa492..0000000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,30 +0,0 @@ -// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: -// https://github.com/microsoft/vscode-dev-containers/tree/v0.209.6/containers/python-3-postgres -// Update the VARIANT arg in docker-compose.yml to pick a Python version -{ - "name": "sqlc", - "build": { - "dockerfile": "Dockerfile" - }, - - "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ], - - // Set *default* container specific settings.json values on container create. - "settings": { - "go.toolsManagement.checkForUpdates": "local", - "go.useLanguageServer": true, - "go.gopath": "/go", - "go.goroot": "/usr/local/go" - }, - - // Add the IDs of extensions you want installed when the container is created. - "extensions": [ - "golang.Go", - ], - - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [5000, 5432], - - // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. - "remoteUser": "vscode" -} diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml index 8fb024f174..79381df51c 100644 --- a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml @@ -1,6 +1,6 @@ name: Bug Report description: File a bug report -labels: [bug, triage] +labels: [bug] body: - type: dropdown id: version @@ -9,14 +9,12 @@ body: description: What version of sqlc are you running? If you don't know, run `sqlc version`. multiple: false options: - - 1.22.0 - - 1.21.0 - - 1.20.0 - - 1.19.1 - - 1.19.0 - - 1.18.0 - - 1.17.2 - - 1.16.0 + - 1.30.0 + - 1.29.0 + - 1.28.0 + - 1.27.0 + - 1.26.0 + - 1.25.0 - Other validations: required: true @@ -51,7 +49,7 @@ body: id: config attributes: label: Configuration - description: Please include the sqlc.yaml or sqlc.json file you using in your project. This will be automatically formatted, so no need for backticks. + description: Please include the sqlc.(yaml|yml) or sqlc.json file you using in your project. This will be automatically formatted, so no need for backticks. render: yaml - type: input id: playground diff --git a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml index 97c36f512d..b3dd5b0a09 100644 --- a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml +++ b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml @@ -1,6 +1,6 @@ name: Feature Request description: Request a new feature or a change to an existing feature -labels: [enhancement, triage] +labels: [enhancement] body: - type: textarea id: feature diff --git a/.github/dependabot.yml b/.github/dependabot.yml index f278157e42..ecbac919d7 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,6 +4,11 @@ updates: directory: "/" schedule: interval: "daily" + groups: + production-dependencies: + dependency-type: "production" + development-dependencies: + dependency-type: "development" - package-ecosystem: "docker" directory: "/" schedule: @@ -21,3 +26,9 @@ updates: # sphinx - dependency-name: "docutils" - dependency-name: "sphinx" + groups: + production-dependencies: + dependency-type: "production" + development-dependencies: + dependency-type: "development" + diff --git a/.github/workflows/buf.yml b/.github/workflows/buf.yml index 05507b05ba..7b7ef08214 100644 --- a/.github/workflows/buf.yml +++ b/.github/workflows/buf.yml @@ -4,6 +4,6 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: bufbuild/buf-setup-action@v1 - uses: bufbuild/buf-lint-action@v1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..ba18f8c832 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,19 @@ +name: build +on: + workflow_dispatch: +jobs: + build: + strategy: + matrix: + os: [ubuntu-24.04, macos-14, windows-2022] + name: build ${{ matrix.os }} + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v5 + - uses: actions/setup-go@v6 + with: + go-version: '1.25.0' + - name: install ./... + run: go build ./... + env: + CGO_ENABLED: "0" diff --git a/.github/workflows/ci-kotlin.yml b/.github/workflows/ci-kotlin.yml index c88a9815e6..729bd3cc86 100644 --- a/.github/workflows/ci-kotlin.yml +++ b/.github/workflows/ci-kotlin.yml @@ -5,48 +5,23 @@ on: - main pull_request: jobs: - build: + if: false name: test runs-on: ubuntu-latest - - services: - postgres: - image: postgres:11 - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DB: postgres - ports: - - 5432:5432 - # needed because the postgres container does not provide a healthcheck - options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 - mysql: - image: mysql:8 - env: - MYSQL_ROOT_PASSWORD: mysecretpassword - MYSQL_DATABASE: mysql - ports: - - 3306:3306 - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v3 + - uses: actions/checkout@v5 + - uses: actions/setup-go@v6 with: - distribution: 'adopt' - java-version: '11' - - uses: eskatos/gradle-command-action@v2 - env: - PG_USER: postgres - PG_HOST: localhost - PG_DATABASE: postgres - PG_PASSWORD: postgres - PG_PORT: ${{ job.services.postgres.ports['5432'] }} - MYSQL_DATABASE: mysql - MYSQL_HOST: localhost - MYSQL_PORT: ${{ job.services.mysql.ports['3306'] }} - MYSQL_ROOT_PASSWORD: mysecretpassword + go-version: '1.24.1' + - name: install ./... + run: go install ./... + - uses: actions/checkout@v5 with: - build-root-directory: examples/kotlin - wrapper-directory: examples/kotlin - arguments: test --scan + repository: sqlc-dev/sqlc-gen-kotlin + path: kotlin + - run: make test + working-directory: kotlin + - run: sqlc diff + working-directory: kotlin/examples + diff --git a/.github/workflows/ci-python.yml b/.github/workflows/ci-python.yml index 0edb94092a..0eb11aeaae 100644 --- a/.github/workflows/ci-python.yml +++ b/.github/workflows/ci-python.yml @@ -5,40 +5,22 @@ on: - main pull_request: jobs: - build: + if: false name: test runs-on: ubuntu-latest - - services: - postgres: - image: postgres:11 - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DB: postgres - ports: - - 5432:5432 - # needed because the postgres container does not provide a healthcheck - options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v5 + - uses: actions/setup-go@v6 with: - python-version: 3.9 - - name: Install python dependencies - working-directory: ./examples/python - run: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt - - name: Test python code - working-directory: ./examples/python - env: - PG_USER: postgres - PG_HOST: localhost - PG_DATABASE: postgres - PG_PASSWORD: postgres - PG_PORT: ${{ job.services.postgres.ports['5432'] }} - run: | - pytest src/tests + go-version: '1.24.1' + - name: install ./... + run: go install ./... + - uses: actions/checkout@v5 + with: + repository: sqlc-dev/sqlc-gen-python + path: python + - run: make test + working-directory: python + - run: sqlc diff + working-directory: python/examples diff --git a/.github/workflows/ci-typescript.yml b/.github/workflows/ci-typescript.yml new file mode 100644 index 0000000000..191e5949bd --- /dev/null +++ b/.github/workflows/ci-typescript.yml @@ -0,0 +1,26 @@ +name: typescript +on: + push: + branches: + - main + pull_request: +jobs: + build: + if: false + name: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - uses: actions/setup-go@v6 + with: + go-version: '1.24.1' + - name: install ./... + run: go install ./... + - uses: actions/checkout@v5 + with: + repository: sqlc-dev/sqlc-gen-typescript + path: typescript + # v0.1.3 + ref: daaf539092421adc15f6c3164279a3470716b560 + - run: sqlc diff + working-directory: typescript/examples diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 845cb5c2a9..ca36cef036 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,47 +5,30 @@ on: - main pull_request: jobs: - windows-build: - if: ${{ github.ref == 'refs/heads/main' }} - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - # wasmtime can't be built with 12.2 - - run: choco install mingw --version 11.2.0.07112021 --allow-downgrade - - uses: actions/setup-go@v4 - with: - go-version: '1.21.1' - - run: go build ./... - - darwin-build: - if: ${{ github.ref == 'refs/heads/main' }} - runs-on: macos-latest + build: + strategy: + matrix: + goos: [darwin, linux, windows] + goarch: [amd64, arm64] + name: build ${{ matrix.goos }}/${{ matrix.goarch }} + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/checkout@v5 + - uses: actions/setup-go@v6 with: - go-version: '1.21.1' + go-version: '1.25.0' - run: go build ./... - - build: - name: test - runs-on: ubuntu-latest - - services: - mysql: - image: "mysql/mysql-server:8.0" - env: - MYSQL_DATABASE: mysql - MYSQL_ROOT_HOST: '%' - MYSQL_ROOT_PASSWORD: mysecretpassword - ports: - - 3306:3306 - + env: + CGO_ENABLED: "0" + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} + test: + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/checkout@v5 + - uses: actions/setup-go@v6 with: - go-version: '1.21.1' + go-version: '1.25.0' - name: install gotestsum run: go install gotest.tools/gotestsum@latest @@ -53,38 +36,32 @@ jobs: - name: install sqlc-gen-test run: go install github.com/sqlc-dev/sqlc-gen-test@v0.1.0 + - name: install test-json-process-plugin + run: go install ./scripts/test-json-process-plugin/ + - name: install ./... run: go install ./... - - - name: test ./... - run: gotestsum --junitfile junit.xml -- --tags=examples ./... env: - MYSQL_DATABASE: mysql - MYSQL_HOST: localhost - MYSQL_PORT: ${{ job.services.mysql.ports['3306'] }} - MYSQL_ROOT_PASSWORD: mysecretpassword - CI_SQLC_PROJECT_ID: ${{ secrets.CI_SQLC_PROJECT_ID }} - CI_SQLC_AUTH_TOKEN: ${{ secrets.CI_SQLC_AUTH_TOKEN }} - SQLC_AUTH_TOKEN: ${{ secrets.CI_SQLC_AUTH_TOKEN }} + CGO_ENABLED: "0" - name: build internal/endtoend run: go build ./... working-directory: internal/endtoend/testdata + env: + CGO_ENABLED: "0" - - name: report - if: ${{ github.ref == 'refs/heads/main' }} - run: ./scripts/report.sh + - name: test ./... + run: gotestsum --junitfile junit.xml -- --tags=examples -timeout 20m ./... + if: ${{ matrix.os }} != "windows-2022" env: - BUILDKITE_ANALYTICS_TOKEN: ${{ secrets.BUILDKITE_ANALYTICS_TOKEN }} + CI_SQLC_PROJECT_ID: ${{ secrets.CI_SQLC_PROJECT_ID }} + CI_SQLC_AUTH_TOKEN: ${{ secrets.CI_SQLC_AUTH_TOKEN }} + SQLC_AUTH_TOKEN: ${{ secrets.CI_SQLC_AUTH_TOKEN }} + CGO_ENABLED: "0" vuln_check: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 timeout-minutes: 5 steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 - with: - go-version: '1.21.1' - - run: go install golang.org/x/vuln/cmd/govulncheck@latest - - run: govulncheck ./... \ No newline at end of file + - uses: golang/govulncheck-action@v1 diff --git a/.github/workflows/gen.yml b/.github/workflows/gen.yml index ffc3cdb13c..8d2c69a7e8 100644 --- a/.github/workflows/gen.yml +++ b/.github/workflows/gen.yml @@ -17,10 +17,11 @@ jobs: # needed because the postgres container does not provide a healthcheck options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/checkout@v5 + - uses: actions/setup-go@v6 with: - go-version: '1.21.1' + go-version-file: go.mod + check-latest: true - run: go build -o sqlc-pg-gen ./internal/tools/sqlc-pg-gen - run: mkdir -p gen/contrib - run: ./sqlc-pg-gen gen @@ -31,7 +32,7 @@ jobs: PG_PASSWORD: postgres PG_PORT: ${{ job.services.postgres.ports['5432'] }} - name: Save results - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: sqlc-pg-gen-results path: gen diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000..d5d00188a7 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "files.insertFinalNewline": true +} diff --git a/Dockerfile b/Dockerfile index 88a5995af5..fe94c68d92 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # STEP 1: Build sqlc -FROM golang:1.21.1 AS builder +FROM golang:1.25.1 AS builder COPY . /workspace WORKDIR /workspace @@ -13,7 +13,7 @@ ENV VERSION=$version RUN go run scripts/release.go -docker # STEP 2: Build a tiny image -FROM scratch +FROM gcr.io/distroless/base-debian12 COPY --from=builder /workspace/sqlc /workspace/sqlc ENTRYPOINT ["/workspace/sqlc"] diff --git a/LICENSE b/LICENSE index 335c6d24e1..4d86f4d24d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 Kyle Conroy +Copyright (c) 2024 Riza, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Makefile b/Makefile index 3cd60dc97f..b8745e57dc 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: build build-endtoend test test-ci test-examples test-endtoend regen start psql mysqlsh proto +.PHONY: build build-endtoend test test-ci test-examples test-endtoend start psql mysqlsh proto build: go build ./... @@ -9,6 +9,9 @@ install: test: go test ./... +test-managed: + MYSQL_SERVER_URI="invalid" POSTGRESQL_SERVER_URI="postgres://postgres:mysecretpassword@localhost:5432/postgres" go test -v ./... + vet: go vet ./... @@ -20,9 +23,6 @@ build-endtoend: test-ci: test-examples build-endtoend vet -regen: sqlc-dev sqlc-gen-json - go run ./scripts/regenerate/ - sqlc-dev: go build -o ~/bin/sqlc-dev ./cmd/sqlc/ @@ -32,8 +32,11 @@ sqlc-pg-gen: sqlc-gen-json: go build -o ~/bin/sqlc-gen-json ./cmd/sqlc-gen-json +test-json-process-plugin: + go build -o ~/bin/test-json-process-plugin ./scripts/test-json-process-plugin/ + start: - docker-compose up -d + docker compose up -d fmt: go fmt ./... diff --git a/README.md b/README.md index 8eb75da8db..43fed122b9 100644 --- a/README.md +++ b/README.md @@ -20,23 +20,44 @@ Check out [an interactive example](https://play.sqlc.dev/) to see it in action, - [Downloads](https://downloads.sqlc.dev/) - [Community](https://discord.gg/EcXzGe5SEs) -## Sponsors - -sqlc development is funded by our [generous -sponsors](https://github.com/sponsors/kyleconroy), including the following -companies: +## Supported languages -- [Context](https://context.app) -- [ngrok](https://ngrok.com) -- [RStudio](https://www.rstudio.com/) -- [時雨堂](https://shiguredo.jp/) +- [sqlc-gen-go](https://github.com/sqlc-dev/sqlc-gen-go) +- [sqlc-gen-kotlin](https://github.com/sqlc-dev/sqlc-gen-kotlin) +- [sqlc-gen-python](https://github.com/sqlc-dev/sqlc-gen-python) +- [sqlc-gen-typescript](https://github.com/sqlc-dev/sqlc-gen-typescript) -If you use sqlc at your company, please consider [becoming a -sponsor](https://github.com/sponsors/kyleconroy) today. +Additional languages can be added via [plugins](https://docs.sqlc.dev/en/latest/reference/language-support.html#community-language-support). -Sponsors receive priority support via the sqlc Slack organization. - -## Acknowledgements +## Sponsors -sqlc was inspired by [PugSQL](https://pugsql.org/) and -[HugSQL](https://www.hugsql.org/). +Development is possible thanks to our sponsors. If you would like to support sqlc, +please consider [sponsoring on GitHub](https://github.com/sponsors/kyleconroy). + +

+ Riza.io +

+ +

+ Coder.com + Mint.fun + Mux.com +

+ +

+ Cyberax - + NaNuNaNu - + Stumble - + WestfalNamur - + alecthomas - + cameronnewman - + danielbprice - + davherrmann - + dvob - + gilcrest - + gzuidhof - + jeffreylo - + mmcloughlin - + ryohei1216 - + sgielen +

diff --git a/buf.gen.yaml b/buf.gen.yaml index 63146b4ee3..3acdb97914 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -1,10 +1,12 @@ version: v1 managed: enabled: true + go_package_prefix: + default: "github.com/sqlc-dev/sqlc/internal" plugins: - plugin: buf.build/protocolbuffers/go:v1.30.0 out: internal opt: paths=source_relative - - plugin: buf.build/community/planetscale-vtprotobuf:v0.4.0 + - plugin: buf.build/grpc/go:v1.3.0 out: internal opt: paths=source_relative diff --git a/buf.yaml b/buf.yaml deleted file mode 100644 index d622cfa1b9..0000000000 --- a/buf.yaml +++ /dev/null @@ -1,8 +0,0 @@ -version: v1 -name: buf.build/sqlc/sqlc -breaking: - use: - - FILE -lint: - use: - - DEFAULT diff --git a/cmd/sqlc-gen-json/main.go b/cmd/sqlc-gen-json/main.go index 421a14e06d..05c804d082 100644 --- a/cmd/sqlc-gen-json/main.go +++ b/cmd/sqlc-gen-json/main.go @@ -9,6 +9,7 @@ import ( "github.com/sqlc-dev/sqlc/internal/codegen/json" "github.com/sqlc-dev/sqlc/internal/plugin" + "google.golang.org/protobuf/proto" ) func main() { @@ -19,19 +20,19 @@ func main() { } func run() error { - var req plugin.CodeGenRequest + var req plugin.GenerateRequest reqBlob, err := io.ReadAll(os.Stdin) if err != nil { return err } - if err := req.UnmarshalVT(reqBlob); err != nil { + if err := proto.Unmarshal(reqBlob, &req); err != nil { return err } resp, err := json.Generate(context.Background(), &req) if err != nil { return err } - respBlob, err := resp.MarshalVT() + respBlob, err := proto.Marshal(resp) if err != nil { return err } diff --git a/devenv.lock b/devenv.lock index 6f61ce9a07..ff48a49f12 100644 --- a/devenv.lock +++ b/devenv.lock @@ -3,11 +3,10 @@ "devenv": { "locked": { "dir": "src/modules", - "lastModified": 1693830477, - "narHash": "sha256-6j1oNRpjGseDbgg6mJ9H3gmX5U+VAubOLV+iFL9WW30=", + "lastModified": 1742659231, "owner": "cachix", "repo": "devenv", - "rev": "f839f486b98609f3477c0410b31a6f831b390d48", + "rev": "c651cb04013be972767aaecb3e9a98fc930d080e", "type": "github" }, "original": { @@ -20,11 +19,10 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "lastModified": 1733328505, "owner": "edolstra", "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", "type": "github" }, "original": { @@ -33,24 +31,6 @@ "type": "github" } }, - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1685518550, - "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "gitignore": { "inputs": { "nixpkgs": [ @@ -59,11 +39,10 @@ ] }, "locked": { - "lastModified": 1660459072, - "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "lastModified": 1709087332, "owner": "hercules-ci", "repo": "gitignore.nix", - "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", "type": "github" }, "original": { @@ -74,11 +53,10 @@ }, "nixpkgs": { "locked": { - "lastModified": 1693844670, - "narHash": "sha256-t69F2nBB8DNQUWHD809oJZJVE+23XBrth4QZuVd6IE0=", + "lastModified": 1742707865, "owner": "NixOS", "repo": "nixpkgs", - "rev": "3c15feef7770eb5500a4b8792623e2d6f598c9c1", + "rev": "dd613136ee91f67e5dba3f3f41ac99ae89c5406b", "type": "github" }, "original": { @@ -88,38 +66,19 @@ "type": "github" } }, - "nixpkgs-stable": { - "locked": { - "lastModified": 1685801374, - "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "c37ca420157f4abc31e26f436c1145f8951ff373", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-23.05", - "repo": "nixpkgs", - "type": "github" - } - }, "pre-commit-hooks": { "inputs": { "flake-compat": "flake-compat", - "flake-utils": "flake-utils", "gitignore": "gitignore", "nixpkgs": [ "nixpkgs" - ], - "nixpkgs-stable": "nixpkgs-stable" + ] }, "locked": { - "lastModified": 1692274144, - "narHash": "sha256-BxTQuRUANQ81u8DJznQyPmRsg63t4Yc+0kcyq6OLz8s=", + "lastModified": 1742649964, "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "7e3517c03d46159fdbf8c0e5c97f82d5d4b0c8fa", + "rev": "dcf5072734cb576d2b0c59b2ac44f5050b5eac82", "type": "github" }, "original": { @@ -134,21 +93,6 @@ "nixpkgs": "nixpkgs", "pre-commit-hooks": "pre-commit-hooks" } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", diff --git a/devenv.nix b/devenv.nix index 24d0448663..8a25b78d5a 100644 --- a/devenv.nix +++ b/devenv.nix @@ -4,11 +4,12 @@ # https://devenv.sh/packages/ packages = [ pkgs.buf - pkgs.go_1_21 + pkgs.go_1_24 pkgs.git pkgs.git-cliff pkgs.govulncheck pkgs.gopls + pkgs.golint pkgs.mysql-shell pkgs.postgresql_15 pkgs.python311 diff --git a/docker-compose.yml b/docker-compose.yml index 07540c873b..f318d1ed93 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,29 +1,17 @@ version: "3.8" services: mysql: - image: "mysql/mysql-server:8.0" + image: "mysql:9" ports: - "3306:3306" restart: always environment: - MYSQL_DATABASE: mysql + MYSQL_DATABASE: dinotest MYSQL_ROOT_PASSWORD: mysecretpassword MYSQL_ROOT_HOST: '%' - mysql5: - image: "mysql/mysql-server:5.7" - ports: - - "3305:3306" - restart: always - environment: - MYSQL_DATABASE: mysql - MYSQL_ROOT_PASSWORD: mysecretpassword - MYSQL_ROOT_HOST: '%' - profiles: - - mysql - postgresql: - image: "postgres:15" + image: "postgres:16" ports: - "5432:5432" restart: always @@ -31,51 +19,3 @@ services: POSTGRES_DB: postgres POSTGRES_PASSWORD: mysecretpassword POSTGRES_USER: postgres - - postgresql14: - image: "postgres:14" - ports: - - "5414:5432" - restart: always - environment: - POSTGRES_DB: postgres - POSTGRES_PASSWORD: mysecretpassword - POSTGRES_USER: postgres - profiles: - - postgres - - postgresql13: - image: "postgres:13" - ports: - - "5413:5432" - restart: always - environment: - POSTGRES_DB: postgres - POSTGRES_PASSWORD: mysecretpassword - POSTGRES_USER: postgres - profiles: - - postgres - - postgresql12: - image: "postgres:12" - ports: - - "5412:5432" - restart: always - environment: - POSTGRES_DB: postgres - POSTGRES_PASSWORD: mysecretpassword - POSTGRES_USER: postgres - profiles: - - postgres - - postgresql11: - image: "postgres:11" - ports: - - "5411:5432" - restart: always - environment: - POSTGRES_DB: postgres - POSTGRES_PASSWORD: mysecretpassword - POSTGRES_USER: postgres - profiles: - - postgres \ No newline at end of file diff --git a/docs/_static/customize.css b/docs/_static/customize.css index b0882f2a05..62b715840c 100644 --- a/docs/_static/customize.css +++ b/docs/_static/customize.css @@ -14,4 +14,9 @@ #banner > div > a { color: #F0F0F4; text-decoration: underline; -} \ No newline at end of file +} + +#sponsorship > img { + width: 100%; + max-width: 200px; +} diff --git a/docs/_templates/breadcrumbs.html b/docs/_templates/breadcrumbs.html index 29a555c4b8..40a8b82be1 100644 --- a/docs/_templates/breadcrumbs.html +++ b/docs/_templates/breadcrumbs.html @@ -2,9 +2,6 @@ {% block breadcrumbs %} {% if show_banner %} - {% endif %} {{ super() }} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html index c83e9b28a4..4b748dd160 100644 --- a/docs/_templates/layout.html +++ b/docs/_templates/layout.html @@ -1,6 +1,16 @@ {% extends "!layout.html" %} {% block extrahead %} - + {{ super() }} -{% endblock %} \ No newline at end of file +{% endblock %} + +{% block menu %} +{{ super() }} +

Sponsored By

+
+ +Riza logo + +
+{% endblock %} diff --git a/docs/conf.py b/docs/conf.py index 227cd7d4e2..76638e65d3 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -18,11 +18,11 @@ # -- Project information ----------------------------------------------------- project = 'sqlc' -copyright = '2023, Riza, Inc.' +copyright = '2024, Riza, Inc.' author = 'Riza, Inc.' # The full version, including alpha/beta/rc tags -release = '1.22.0' +release = '1.30.0' # -- General configuration --------------------------------------------------- @@ -31,9 +31,10 @@ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ - 'recommonmark', + 'myst_parser', 'sphinx_rtd_theme', - "sphinx_favicon", + 'sphinx_favicon', + 'sphinxext.rediraffe', ] # Add any paths that contain templates here, relative to this directory. @@ -70,4 +71,13 @@ def setup(app): favicons = [ "favicon.png", -] \ No newline at end of file +] + +myst_enable_extensions = [ + "attrs_inline", + "colon_fence", +] + +rediraffe_redirects = { + "howto/upload.md": "howto/push.md", +} diff --git a/docs/guides/development.md b/docs/guides/development.md index 5140f086eb..f8196572be 100644 --- a/docs/guides/development.md +++ b/docs/guides/development.md @@ -8,6 +8,12 @@ For local development, install `sqlc` under an alias. We suggest `sqlc-dev`. go build -o ~/go/bin/sqlc-dev ./cmd/sqlc ``` +Install `sqlc-gen-json` to avoid test failure. + +``` +go build -o ~/go/bin/sqlc-gen-json ./cmd/sqlc-gen-json +``` + ## Running Tests ``` @@ -24,7 +30,7 @@ These tests require locally-running database instances. Run these databases using [Docker Compose](https://docs.docker.com/compose/). ``` -docker-compose up -d +docker compose up -d ``` The tests use the following environment variables to connect to the @@ -53,16 +59,3 @@ MYSQL_USER root MYSQL_ROOT_PASSWORD mysecretpassword MYSQL_DATABASE dinotest ``` - -## Regenerate expected test output - -If you need to update a large number of expected test output in the -`internal/endtoend/testdata` directory, run the `regenerate` script. - -``` -go build -o ~/go/bin/sqlc-dev ./cmd/sqlc -go run scripts/regenerate/main.go -``` - -Note that this uses the `sqlc-dev` binary, not `sqlc` so make sure you have an -up to date `sqlc-dev` binary. diff --git a/docs/guides/migrating-off-hosted-managed-databases.md b/docs/guides/migrating-off-hosted-managed-databases.md new file mode 100644 index 0000000000..b49ed69fda --- /dev/null +++ b/docs/guides/migrating-off-hosted-managed-databases.md @@ -0,0 +1,71 @@ +# Migrating off hosted managed databases + +Starting in sqlc 1.27.0, [managed databases](../docs/managed-databases.md) will require a database server URI in the configuration file. + +This guide walks you through migrating to a locally running database server. + +## Run a database server locally + +There are many options for running a database server locally, but this guide +will use [Docker Compose](https://docs.docker.com/compose/), as it can support +both MySQL and PostgreSQL. + +If you're using macOS and PostgreSQL, [Postgres.app](https://postgresapp.com/) is also a good option. + +For MySQL, create a `docker-compose.yml` file with the following contents: + +```yaml +version: "3.8" +services: + mysql: + image: "mysql/mysql-server:8.0" + ports: + - "3306:3306" + restart: always + environment: + MYSQL_DATABASE: dinotest + MYSQL_ROOT_PASSWORD: mysecretpassword + MYSQL_ROOT_HOST: '%' +``` + +For PostgreSQL, create a `docker-compose.yml` file with the following contents: + +```yaml +version: "3.8" +services: + postgresql: + image: "postgres:16" + ports: + - "5432:5432" + restart: always + environment: + POSTGRES_DB: postgres + POSTGRES_PASSWORD: mysecretpassword + POSTGRES_USER: postgres +``` + +```sh +docker compose up -d +``` + +## Upgrade sqlc + +You must be running sqlc v1.30.0 or greater to have access to the `servers` +configuration. + +## Add servers to configuration + +```diff +version: '2' +cloud: + project: '' ++ servers: ++ - name: mysql ++ uri: mysql://localhost:3306 ++ - name: postgres ++ uri: postgres://localhost:5432/postgres?sslmode=disable +``` + +## Re-generate the code + +Run `sqlc generate`. A database with the `sqlc_managed_` prefix will be automatically created and used for query analysis. diff --git a/docs/guides/migrating-to-sqlc-gen-kotlin.md b/docs/guides/migrating-to-sqlc-gen-kotlin.md index 2c39e1c4c4..17660aaad4 100644 --- a/docs/guides/migrating-to-sqlc-gen-kotlin.md +++ b/docs/guides/migrating-to-sqlc-gen-kotlin.md @@ -33,7 +33,7 @@ already. Add the following configuration for the plugin: ```yaml version: "2" plugins: - name: "kt" +- name: "kt" wasm: url: "https://downloads.sqlc.dev/plugin/sqlc-gen-kotlin_1.0.0.wasm" sha256: "7620dc5d462de41fdc90e2011232c842117b416c98fd5c163d27c5738431a45c" diff --git a/docs/guides/plugins.md b/docs/guides/plugins.md index 07629a5154..b229f91732 100644 --- a/docs/guides/plugins.md +++ b/docs/guides/plugins.md @@ -1,18 +1,18 @@ -# Authoring plugins +# Using plugins -To use plugins, you must be using [Version 2](../reference/config.md) of +To use plugins, you must be using [Version 2](../reference/config.md#version-2) of the configuration file. The top-level `plugins` array defines the available plugins. ## WASM plugins -> WASM plugins are fully sandboxed. Plugins do not have access to the network, +> WASM plugins are fully sandboxed; they do not have access to the network, > filesystem, or environment variables. In the `codegen` section, the `out` field dictates what directory will contain the new files. The `plugin` key must reference a plugin defined in the -top-level `plugins` map. The `options` are serialized to a string and passed on -to the plugin itself. +top-level `plugins` map. Any `options` are serialized to a string as JSON and +passed on to the plugin itself. ```yaml @@ -29,6 +29,8 @@ sql: codegen: - out: gen plugin: greeter + options: + lang: en-US ``` For a complete working example see the following files: @@ -44,8 +46,8 @@ For a complete working example see the following files: In the `codegen` section, the `out` field dictates what directory will contain the new files. The `plugin` key must reference a plugin defined in the -top-level `plugins` map. The `options` are serialized to a string and passed on -to the plugin itself. +top-level `plugins` map. Any `options` are serialized to a string as JSON and +passed on to the plugin itself. ```yaml version: '2' @@ -70,6 +72,8 @@ For a complete working example see the following files: - A process-based plugin that serializes the CodeGenRequest to JSON - [process_plugin_sqlc_gen_json](https://github.com/sqlc-dev/sqlc/tree/main/internal/endtoend/testdata/process_plugin_sqlc_gen_json) - An example project showing how to use a process-based plugin +- [process_plugin_sqlc_gen_json](https://github.com/sqlc-dev/sqlc/tree/main/internal/endtoend/testdata/process_plugin_format_json/) + - An example project showing how to use a process-based plugin using json ## Environment variables @@ -97,4 +101,4 @@ plugins: ``` A variable named `SQLC_VERSION` is always included in the plugin's -environment, set to the version of the `sqlc` executable invoking it. \ No newline at end of file +environment, set to the version of the `sqlc` executable invoking it. diff --git a/docs/guides/using-go-and-pgx.rst b/docs/guides/using-go-and-pgx.rst index 636434d3af..68e2242926 100644 --- a/docs/guides/using-go-and-pgx.rst +++ b/docs/guides/using-go-and-pgx.rst @@ -109,3 +109,25 @@ pgx types directly. fmt.Println(author.Name) } + +.. note:: + For production applications, consider using pgxpool for connection pooling: + + .. code-block:: go + + import ( + "github.com/jackc/pgx/v5/pgxpool" + "example.com/sqlc-tutorial/db" + ) + + func main() { + pool, err := pgxpool.New(context.Background(), os.Getenv("DATABASE_URL")) + if err != nil { + fmt.Fprintf(os.Stderr, "Unable to create connection pool: %v\n", err) + os.Exit(1) + } + defer pool.Close() + + q := db.New(pool) + // Use q the same way as with single connections + } diff --git a/docs/howto/ci-cd.md b/docs/howto/ci-cd.md index 37c75ec5be..302c6353a7 100644 --- a/docs/howto/ci-cd.md +++ b/docs/howto/ci-cd.md @@ -1,12 +1,13 @@ # Using sqlc in CI/CD If your project has more than a single developer, we suggest running `sqlc` as -part of your CI/CD pipeline. The two subcommands you'll want to run are `diff` and `vet`. +part of your CI/CD pipeline. The four subcommands you'll want to run are `diff`, +`vet`, `verify` and `push` -`sqlc diff` ensures that your generated code is up to date. New developers to a project may -forget to run `sqlc generate` after adding a query or updating a schema. They also might -edit generated code. `sqlc diff` will catch both errors by comparing the expected output -from `sqlc generate` to what's on disk. +`sqlc diff` ensures that your generated code is up to date. New developers to a +project may forget to run `sqlc generate` after adding a query or updating a +schema. They also might edit generated code. `sqlc diff` will catch both errors +by comparing the expected output from `sqlc generate` to what's on disk. ```diff % sqlc diff @@ -26,11 +27,21 @@ helpful in catching anti-patterns before they make it into production. Please see the [vet](vet.md) documentation for a complete guide to adding lint rules for your project. +`sqlc verify` ensures that schema changes do not break production. Existing +queries are checked against new schema changes for correctness. Please see the +[verify](verify.md) documentation for a complete guide. + + +`sqlc push` pushes your database schema, queries and configuration to sqlc +Cloud. These archives are used by `verify` to catch breaking changes to your +database schema. Learn more about uploading projects [here](push.md) + ## General setup Install `sqlc` using the [suggested instructions](../overview/install). -Create two steps in your pipeline, one for `sqlc diff`and one for `sqlc vet`. +Create three steps in your pipeline for `sqlc diff`, `sqlc vet`, and `sqlc +verify`. Run `sqlc push` after merge on your `main` branch. ## GitHub Actions @@ -39,7 +50,7 @@ GitHub Action to install `sqlc`. The action uses the built-in [tool-cache](https://github.com/actions/toolkit/blob/main/packages/tool-cache/README.md) to speed up the installation process. -## GitHub Workflows +### diff The following GitHub Workflow configuration runs `sqlc diff` on every push. @@ -53,11 +64,13 @@ jobs: - uses: actions/checkout@v3 - uses: sqlc-dev/setup-sqlc@v3 with: - sqlc-version: '1.19.0' + sqlc-version: '1.30.0' - run: sqlc diff ``` -The following GitHub Workflow configuration runs [`sqlc vet`](vet.md) on every push. +### vet + +The following GitHub Workflow configuration runs [sqlc vet](vet.md) on every push. You can use `sqlc vet` without a database connection, but you'll need one if your `sqlc` configuration references the built-in `sqlc/db-prepare` lint rule. @@ -67,29 +80,82 @@ on: [push] jobs: vet: runs-on: ubuntu-latest - services: - postgres: - image: "postgres:15" - env: - POSTGRES_DB: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_USER: postgres - ports: - - 5432:5432 - # needed because the postgres container does not provide a healthcheck - options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 - env: - PG_PORT: ${{ job.services.postgres.ports['5432'] }} + steps: + - uses: actions/checkout@v3 + - uses: sqlc-dev/setup-sqlc@v3 + with: + sqlc-version: '1.30.0' + # Start a PostgreSQL server + - uses: sqlc-dev/action-setup-postgres@master + with: + postgres-version: "16" + id: postgres + - run: sqlc vet + env: + POSTGRESQL_SERVER_URI: ${{ steps.postgres.outputs.connection-uri }}?sslmode=disable + +``` + +### push + +```{note} +Pushing a project is powered by [sqlc Cloud](https://dashboard.sqlc.dev). Sign up for [free](https://dashboard.sqlc.dev) today. +``` + +The following GitHub Workflow configuration runs [sqlc push](push.md) on +every push to `main`. Create an auth token via the +[dashboard](https://dashboard.sqlc.dev). + +```yaml +name: sqlc +on: [push] +jobs: + push: + runs-on: ubuntu-latest + if: ${{ github.ref == 'refs/heads/main' }} + steps: + - uses: actions/checkout@v3 + - uses: sqlc-dev/setup-sqlc@v3 + with: + sqlc-version: '1.30.0' + - run: sqlc push + env: + SQLC_AUTH_TOKEN: ${{ secrets.SQLC_AUTH_TOKEN }} +``` + +### verify +```{note} +Verify database migrations is powered by [sqlc Cloud](https://dashboard.sqlc.dev). Sign up for [free](https://dashboard.sqlc.dev) today. +``` + +```yaml +name: sqlc +on: [push] +jobs: + verify: + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: sqlc-dev/setup-sqlc@v3 with: - sqlc-version: '1.19.0' - # Connect and migrate your database here. This is an example which runs - # commands from a `schema.sql` file. - - run: psql -h localhost -U postgres -p $PG_PORT -d postgres -f schema.sql + sqlc-version: '1.30.0' + - uses: sqlc-dev/action-setup-postgres@master + with: + postgres-version: "16" + id: postgres + - run: sqlc verify env: - PGPASSWORD: postgres - - run: sqlc vet -``` \ No newline at end of file + POSTGRESQL_SERVER_URI: ${{ steps.postgres.outputs.connection-uri }}?sslmode=disable + SQLC_AUTH_TOKEN: ${{ secrets.SQLC_AUTH_TOKEN }} + push: + runs-on: ubuntu-latest + if: ${{ github.ref == 'refs/heads/main' }} + steps: + - uses: sqlc-dev/setup-sqlc@v3 + with: + sqlc-version: '1.30.0' + - run: sqlc push + env: + SQLC_AUTH_TOKEN: ${{ secrets.SQLC_AUTH_TOKEN }} +`````` diff --git a/docs/howto/ddl.md b/docs/howto/ddl.md index 4e9d36d855..2d51af7fad 100644 --- a/docs/howto/ddl.md +++ b/docs/howto/ddl.md @@ -69,75 +69,84 @@ type Post struct { } ``` -### goose +### dbmate ```sql --- +goose Up -CREATE TABLE post ( - id int NOT NULL, - title text, - body text, - PRIMARY KEY(id) -); +-- migrate:up +CREATE TABLE foo (bar INT NOT NULL); --- +goose Down -DROP TABLE post; +-- migrate:down +DROP TABLE foo; ``` ```go package db -type Post struct { - ID int - Title sql.NullString - Body sql.NullString +type Foo struct { + Bar int32 } ``` -### sql-migrate +### golang-migrate -```sql --- +migrate Up --- SQL in section 'Up' is executed when this migration is applied -CREATE TABLE people (id int); +**Warning:** +[golang-migrate interprets](https://github.com/golang-migrate/migrate/blob/master/MIGRATIONS.md#migration-filename-format) +migration filenames numerically. However, sqlc parses migration files in +lexicographic order. If you choose to have sqlc enumerate your migration files, +make sure their numeric ordering matches their lexicographic ordering to avoid +unexpected behavior. This can be done by prepending enough zeroes to the +migration filenames. +This doesn't work as intended. --- +migrate Down --- SQL section 'Down' is executed when this migration is rolled back -DROP TABLE people; +``` +1_initial.up.sql +... +9_foo.up.sql +# this migration file will be parsed BEFORE 9_foo +10_bar.up.sql ``` -```go -package db +This worked as intended. -type People struct { - ID int32 -} +``` +001_initial.up.sql +... +009_foo.up.sql +010_bar.up.sql ``` -### tern +In `20060102.up.sql`: ```sql -CREATE TABLE comment (id int NOT NULL, text text NOT NULL); ----- create above / drop below ---- -DROP TABLE comment; +CREATE TABLE post ( + id int NOT NULL, + title text, + body text, + PRIMARY KEY(id) +); +``` + +In `20060102.down.sql`: + +```sql +DROP TABLE post; ``` ```go package db -type Comment struct { - ID int32 - Text string +type Post struct { + ID int + Title sql.NullString + Body sql.NullString } ``` -### golang-migrate +### goose **Warning:** -[golang-migrate interprets](https://github.com/golang-migrate/migrate/blob/master/MIGRATIONS.md#migration-filename-format) -migration filenames numerically. However, sqlc parses migration files in -lexicographic order. If you choose to have sqlc enumerate your migration files, +sqlc parses migration files in lexicographic order. **If you are using numeric filenames for migrations in Goose and you choose to have sqlc enumerate your migration files**, make sure their numeric ordering matches their lexicographic ordering to avoid unexpected behavior. This can be done by prepending enough zeroes to the migration filenames. @@ -145,36 +154,32 @@ migration filenames. This doesn't work as intended. ``` -1_initial.up.sql +1_initial.sql ... -9_foo.up.sql +9_foo.sql # this migration file will be parsed BEFORE 9_foo -10_bar.up.sql +10_bar.sql ``` This worked as intended. ``` -001_initial.up.sql +001_initial.sql ... -009_foo.up.sql -010_bar.up.sql +009_foo.sql +010_bar.sql ``` -In `20060102.up.sql`: - ```sql +-- +goose Up CREATE TABLE post ( id int NOT NULL, title text, body text, PRIMARY KEY(id) ); -``` - -In `20060102.down.sql`: -```sql +-- +goose Down DROP TABLE post; ``` @@ -188,20 +193,40 @@ type Post struct { } ``` -### dbmate +### sql-migrate ```sql --- migrate:up -CREATE TABLE foo (bar INT NOT NULL); +-- +migrate Up +-- SQL in section 'Up' is executed when this migration is applied +CREATE TABLE people (id int); --- migrate:down -DROP TABLE foo; + +-- +migrate Down +-- SQL section 'Down' is executed when this migration is rolled back +DROP TABLE people; ``` ```go package db -type Foo struct { - Bar int32 +type People struct { + ID int32 +} +``` + +### tern + +```sql +CREATE TABLE comment (id int NOT NULL, text text NOT NULL); +---- create above / drop below ---- +DROP TABLE comment; +``` + +```go +package db + +type Comment struct { + ID int32 + Text string } ``` diff --git a/docs/howto/delete.md b/docs/howto/delete.md index 68d22a2e46..95045a37a6 100644 --- a/docs/howto/delete.md +++ b/docs/howto/delete.md @@ -5,11 +5,22 @@ CREATE TABLE authors ( id SERIAL PRIMARY KEY, bio text NOT NULL ); +``` + +The parameter syntax varies by database engine: +**PostgreSQL:** +```sql -- name: DeleteAuthor :exec DELETE FROM authors WHERE id = $1; ``` +**MySQL and SQLite:** +```sql +-- name: DeleteAuthor :exec +DELETE FROM authors WHERE id = ?; +``` + ```go package db diff --git a/docs/howto/embedding.md b/docs/howto/embedding.md index 125386135b..5ea8cbbc0a 100644 --- a/docs/howto/embedding.md +++ b/docs/howto/embedding.md @@ -26,7 +26,7 @@ Here's how we'd usually do that: SELECT students.*, test_scores.* FROM students JOIN test_scores ON test_scores.student_id = students.id -WHERE students.id = ?; +WHERE students.id = $1; ``` When using Go, sqlc will produce a struct like this: @@ -50,7 +50,7 @@ flattened list of columns. SELECT sqlc.embed(students), sqlc.embed(test_scores) FROM students JOIN test_scores ON test_scores.student_id = students.id -WHERE students.id = ?; +WHERE students.id = $1; ``` ``` diff --git a/docs/howto/generate.md b/docs/howto/generate.md new file mode 100644 index 0000000000..288fb1a7d4 --- /dev/null +++ b/docs/howto/generate.md @@ -0,0 +1,76 @@ +# `generate` - Generating code + +`sqlc generate` parses SQL, analyzes the results, and outputs code. Your schema and queries are stored in separate SQL files. The paths to these files live in a `sqlc.yaml` configuration file. + +```yaml +version: "2" +sql: + - engine: "postgresql" + queries: "query.sql" + schema: "schema.sql" + gen: + go: + package: "tutorial" + out: "tutorial" + sql_package: "pgx/v5" +``` + +We've written extensive docs on [retrieving](select.md), [inserting](insert.md), +[updating](update.md), and [deleting](delete.md) rows. + +By default, sqlc runs its analysis using a built-in query analysis engine. While fast, this engine can't handle some complex queries and type-inference. + +You can configure sqlc to use a database connection for enhanced analysis using metadata from that database. + +The database-backed analyzer currently supports PostgreSQL, with [MySQL](https://github.com/sqlc-dev/sqlc/issues/2902) and [SQLite](https://github.com/sqlc-dev/sqlc/issues/2903) +support planned in the future. + +## Enhanced analysis with managed databases + +With [managed databases](managed-databases.md) configured, `generate` will automatically create a hosted ephemeral database with your +schema and use that database to improve its query analysis. And sqlc will cache its analysis locally +on a per-query basis to speed up future `generate` runs. This saves you the trouble of running and maintaining a database with +an up-to-date schema. Here's a minimal working configuration: + +```yaml +version: "2" +servers: +- engine: postgresql + uri: "postgres://locahost:5432/postgres?sslmode=disable" +sql: + - engine: "postgresql" + queries: "query.sql" + schema: "schema.sql" + database: + managed: true + gen: + go: + out: "db" + sql_package: "pgx/v5" +``` + +## Enhanced analysis using your own database + +You can opt-in to database-backed analysis using your own database, by providing a `uri` in your sqlc +[database](../reference/config.md#database) configuration. + +The `uri` string can contain references to environment variables using the `${...}` +syntax. In the following example, the connection string will have the value of +the `PG_PASSWORD` environment variable set as its password. + +```yaml +version: "2" +sql: + - engine: "postgresql" + queries: "query.sql" + schema: "schema.sql" + database: + uri: "postgres://postgres:${PG_PASSWORD}@localhost:5432/postgres" + gen: + go: + out: "db" + sql_package: "pgx/v5" +``` + +Databases configured with a `uri` must have an up-to-date schema for query analysis to work correctly, and `sqlc` does not apply schema migrations your database. Use your migration tool of choice to create the necessary +tables and objects before running `sqlc generate`. diff --git a/docs/howto/insert.md b/docs/howto/insert.md index ae892998ec..7bb02d6745 100644 --- a/docs/howto/insert.md +++ b/docs/howto/insert.md @@ -5,11 +5,22 @@ CREATE TABLE authors ( id SERIAL PRIMARY KEY, bio text NOT NULL ); +``` + +The parameter syntax varies by database engine: +**PostgreSQL:** +```sql -- name: CreateAuthor :exec INSERT INTO authors (bio) VALUES ($1); ``` +**MySQL and SQLite:** +```sql +-- name: CreateAuthor :exec +INSERT INTO authors (bio) VALUES (?); +``` + ```go package db @@ -51,7 +62,10 @@ CREATE TABLE authors ( name text NOT NULL, bio text ); +``` +**PostgreSQL:** +```sql -- name: CreateAuthor :one INSERT INTO authors ( name, bio @@ -69,6 +83,27 @@ INSERT INTO authors ( RETURNING id; ``` +**SQLite (with RETURNING support):** +```sql +-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio +) VALUES ( + ?, ? +) +RETURNING *; + +-- name: CreateAuthorAndReturnId :one +INSERT INTO authors ( + name, bio +) VALUES ( + ?, ? +) +RETURNING id; +``` + +Note: MySQL does not support the `RETURNING` clause. Use `:execresult` instead to get the last insert ID. + ```go package db diff --git a/docs/howto/managed-databases.md b/docs/howto/managed-databases.md index 449a00d1fe..745524ea5f 100644 --- a/docs/howto/managed-databases.md +++ b/docs/howto/managed-databases.md @@ -2,30 +2,30 @@ *Added in v1.22.0* -`sqlc` can create and maintain hosted databases for your project. These -databases are immediately useful for linting queries with [`sqlc vet`](vet.md) -if your lint rules require a connection to a running database. PostgreSQL -support is available today, with MySQL on the way. +`sqlc` can automatically create read-only databases to power query analysis, +linting and verification. These databases are immediately useful for powering +sqlc's database-connected query analyzer, an opt-in feature that improves upon +sqlc's built-in query analysis engine. PostgreSQL support is available today, +with MySQL on the way. -This feature is under active development, and we're interested in supporting -other use-cases. Beyond linting queries, you can use sqlc managed databases -in your tests to quickly stand up a database per test suite or even per test, -providing a real, isolated database for a test run. No cleanup required. +Once configured, `sqlc` will also use managed databases when linting queries +with [`sqlc vet`](vet.md) in cases where your lint rules require a connection +to a running database. -Interested in trying out managed databases? Sign up [here](https://docs.google.com/forms/d/e/1FAIpQLSdxoMzJ7rKkBpuez-KyBcPNyckYV-5iMR--FRB7WnhvAmEvKg/viewform) or send us an email -at [hello@sqlc.dev](mailto:hello@sqlc.dev). +Managed databases are under active development, and we're interested in +supporting other use-cases. ## Configuring managed databases -To configure `sqlc` to use a managed database, remove the `uri` key from your +To configure `sqlc` to use managed databases, remove the `uri` key from your `database` configuration and replace it with the `managed` key set to `true`. -Set the `project` key in your `cloud` configuration to the value of your -project ID, obtained via the sqlc.dev Dashboard. +Access to a running database server is required. Add a connection string to the `servers` mapping. ```yaml version: '2' -cloud: - project: '' +servers: +- engine: postgresql + uri: "postgres://localhost:5432/postgres?sslmode=disable" sql: - schema: schema.sql queries: query.sql @@ -34,19 +34,51 @@ sql: managed: true ``` -## Authentication +An environment variable can also be used via the `${}` syntax. -`sqlc` expects to find a valid auth token in the value of the `SQLC_AUTH_TOKEN` -environment variable. You can create an auth token via the sqlc.dev Dashboard. +```yaml +version: '2' +servers: +- engine: postgresql + uri: ${DATABASE_URI} +sql: +- schema: schema.sql + queries: query.sql + engine: postgresql + database: + managed: true +``` + +## Improving codegen -```shell -export SQLC_AUTH_TOKEN=sqlc_xxxxxxxx +Without a database connection, sqlc does its best to parse, analyze and compile your queries just using +the schema you pass it and what it knows about the various database engines it supports. In many cases +this works just fine, but for more advanced queries sqlc might not have enough information to produce good code. + +With managed databases configured, `sqlc generate` will automatically create a hosted ephemeral database with your +schema and use that database to improve its query analysis. And sqlc will cache its analysis locally +on a per-query basis to speed up future codegen runs. Here's a minimal working configuration: + +```yaml +version: '2' +servers: +- engine: postgresql + uri: "postgres://localhost:5432/postgres?sslmode=disable" +sql: +- schema: schema.sql + queries: query.sql + engine: postgresql + database: + managed: true + gen: + go: + out: "db" ``` ## Linting queries -With managed databases configured, `sqlc vet` will create a database with your -package's schema and use that database when running lint rules that require a +With managed databases configured, `sqlc vet` will automatically create a hosted ephemeral database with your +schema and use that database when running lint rules that require a database connection, e.g. any [rule relying on `EXPLAIN ...` output](vet.md#rules-using-explain-output). If you don't yet have any vet rules, the [built-in sqlc/db-prepare rule](vet.md#sqlc-db-prepare) @@ -55,8 +87,9 @@ to ensure the query is valid. Here's a minimal working configuration: ```yaml version: '2' -cloud: - project: '' +servers: +- engine: postgresql + uri: "postgres://localhost:5432/postgres?sslmode=disable" sql: - schema: schema.sql queries: query.sql diff --git a/docs/howto/named_parameters.md b/docs/howto/named_parameters.md index c4643bd8e3..0837c70c15 100644 --- a/docs/howto/named_parameters.md +++ b/docs/howto/named_parameters.md @@ -1,6 +1,6 @@ # Naming parameters -sqlc tried to generate good names for positional parameters, but sometimes it +sqlc tries to generate good names for positional parameters, but sometimes it lacks enough context. The following SQL generates parameters with less than ideal names: @@ -46,6 +46,10 @@ type UpdateAuthorNameParams struct { If the `sqlc.arg()` syntax is too verbose for your taste, you can use the `@` operator as a shortcut. +```{note} +The `@` operator as a shortcut for `sqlc.arg()` is not supported in MySQL. +``` + ```sql -- name: UpsertAuthorName :one UPDATE author diff --git a/docs/howto/overrides.md b/docs/howto/overrides.md index baa9163c4d..8cdcbde6a2 100644 --- a/docs/howto/overrides.md +++ b/docs/howto/overrides.md @@ -1,12 +1,22 @@ # Overriding types -The default mapping of PostgreSQL/MySQL types to Go types only uses packages outside -the standard library when it must. +:::{note} +Type overrides and field renaming are only fully-supported for Go. +::: -For example, the `uuid` PostgreSQL type is mapped to `github.com/google/uuid`. -If a different Go package for UUIDs is required, specify the package in the -`overrides` array. In this case, I'm going to use the `github.com/gofrs/uuid` -instead. +In many cases it's useful to tell `sqlc` explicitly what Go type you want it to +use for a query input or output. For instance, by default when you use +`pgx/v5`, `sqlc` will map a PostgreSQL UUID type to `UUID` from `github.com/jackc/pgx/pgtype`. +But you may want `sqlc` to use `UUID` from `github.com/google/uuid` instead. + +To tell `sqlc` to use a different Go type, add an entry to the `overrides` list in your +configuration. + +`sqlc` offers two kinds of Go type overrides: +* `db_type` overrides, which override the Go type for a specific database type. +* `column` overrides, which override the Go type for a column or columns by name. + +Here's an example including one of each kind: ```yaml version: "2" @@ -17,34 +27,61 @@ sql: gen: go: package: "authors" - out: "postgresql" + out: "db" + sql_package: "pgx/v5" overrides: - db_type: "uuid" - go_type: "github.com/gofrs/uuid.UUID" + nullable: true + go_type: + import: "github.com/google/uuid" + type: "UUID" + - column: "users.birthday" + go_type: "time.Time" ``` -Each mapping of the `overrides` collection has the following keys: +:::{tip} + A single `db_type` override configuration applies to either nullable or non-nullable + columns, but not both. If you want the same Go type to override regardless of + nullability, you'll need to configure two overrides: one with `nullable: true` and one without. +::: + +## The `overrides` list + +Each element in the `overrides` list has the following keys: - `db_type`: - - The PostgreSQL or MySQL type to override. Find the full list of supported types in [postgresql_type.go](https://github.com/sqlc-dev/sqlc/blob/main/internal/codegen/golang/postgresql_type.go#L12) or [mysql_type.go](https://github.com/sqlc-dev/sqlc/blob/main/internal/codegen/golang/mysql_type.go#L12). Note that for Postgres you must use the pg_catalog prefixed names where available. Can't be used if the `column` key is defined. + - A database type to override. Find the full list of supported types in [postgresql_type.go](https://github.com/sqlc-dev/sqlc/blob/main/internal/codegen/golang/postgresql_type.go#L12) or [mysql_type.go](https://github.com/sqlc-dev/sqlc/blob/main/internal/codegen/golang/mysql_type.go#L12). Note that for Postgres you must use pg_catalog-prefixed names where available. `db_type` and `column` are mutually exclusive. - `column`: - - In case the type overriding should be done on specific a column of a table instead of a type. `column` should be of the form `table.column` but you can be even more specific by specifying `schema.table.column` or `catalog.schema.table.column`. Can't be used if the `db_type` key is defined. + - A column name to override. The value should be of the form `table.column` but you can also specify `schema.table.column` or `catalog.schema.table.column`. `column` and `db_type` are mutually exclusive. - `go_type`: - - A fully qualified name to a Go type to use in the generated code. + - The fully-qualified name of a Go type to use in generated code. This is usually a string but can also be [a map](#the-go-type-map) for more complex configurations. - `go_struct_tag`: - - A reflect-style struct tag to use in the generated code, e.g. `a:"b" x:"y,z"`. - If you want general json/db tags for all fields, use `emit_db_tags` and/or `emit_json_tags` instead. + - A reflect-style struct tag to use in generated code, e.g. `a:"b" x:"y,z"`. + If you want `json` or `db` tags for all fields, configure `emit_json_tags` or `emit_db_tags` instead. +- `unsigned`: + - If `true`, sqlc will apply this override when a numeric column is unsigned. + Note that this only applies to `db_type` overrides and has no effect on `column` overrides. + Defaults to `false`. - `nullable`: - - If `true`, use this type when a column is nullable. Defaults to `false`. + - If `true`, sqlc will apply this override when a column is nullable. + Otherwise `sqlc` will apply this override when a column is non-nullable. + Note that this only applies to `db_type` overrides and has no effect on `column` overrides. + Defaults to `false`. + +:::{tip} + A single `db_type` override configuration applies to either nullable or non-nullable + columns, but not both. If you want the same Go type to override regardless of nullability, you'll + need to configure two overrides: one with `nullable: true` and one without. +::: -Note that a single `db_type` override configuration applies to either nullable or non-nullable -columns, but not both. If you want a single `go_type` to override in both cases, you'll -need to specify two overrides. +:::{note} +When generating code, `column` override configurations take precedence over `db_type` configurations. +::: -When generating code, entries using the `column` key will always have preference over -entries using the `db_type` key in order to generate the struct. +### The `go_type` map -For more complicated import paths, the `go_type` can also be an object with the following keys: +Some overrides may require more detailed configuration. If necessary, `go_type` +can be a map with the following keys: - `import`: - The import path for the package where the type is defined. @@ -53,9 +90,9 @@ For more complicated import paths, the `go_type` can also be an object with the - `type`: - The type name itself, without any package prefix. - `pointer`: - - If set to `true`, generated code will use pointers to the type rather than the type itself. + - If `true`, generated code will use a pointer to the type rather than the type itself. - `slice`: - - If set to `true`, generated code will use a slice of the type rather than the type itself. + - If `true`, generated code will use a slice of the type rather than the type itself. An example: @@ -66,9 +103,10 @@ sql: queries: "postgresql/query.sql" engine: "postgresql" gen: - go: + go: package: "authors" - out: "postgresql" + out: "db" + sql_package: "pgx/v5" overrides: - db_type: "uuid" go_type: @@ -76,4 +114,75 @@ sql: package: "b" type: "MyType" pointer: true -``` \ No newline at end of file +``` + +## Global overrides + +To override types in all packages that `sqlc` generates, add an override +configuration to the top-level `overrides` section of your `sqlc` config: + +```yaml +version: "2" +overrides: + go: + overrides: + - db_type: "pg_catalog.timestamptz" + nullable: true + engine: "postgresql" + go_type: + import: "gopkg.in/guregu/null.v4" + package: "null" + type: "Time" +sql: +- schema: "service1/schema.sql" + queries: "service1/query.sql" + engine: "postgresql" + gen: + go: + package: "service1" + out: "service1" +- schema: "service2/schema.sql" + queries: "service2/query.sql" + engine: "postgresql" + gen: + go: + package: "service2" + out: "service2" +``` + +Using this configuration, whenever there is a nullable `timestamp with time zone` +column in a Postgres table, `sqlc` will generate Go code using `null.Time`. + +Note that the mapping for global type overrides has a field called `engine` that +is absent in per-package type overrides. This field is only used when there are +multiple `sql` sections using different engines. If you're only generating code +for a single database engine you can omit it. + +#### Version 1 configuration + +If you are using the older version 1 of the `sqlc` configuration format, override +configurations themselves are unchanged but are nested differently. + +Per-package configurations are nested under the `overrides` key within an item +in the `packages` list: + +```yaml +version: "1" +packages: + - name: "db" + path: "internal/db" + queries: "./sql/query/" + schema: "./sql/schema/" + engine: "postgresql" + overrides: [...] +``` + +And global configurations are nested under the top-level `overrides` key: + +```yaml +version: "1" +packages: [...] +overrides: + - db_type: "uuid" + go_type: "github.com/gofrs/uuid.UUID" +``` diff --git a/docs/howto/push.md b/docs/howto/push.md new file mode 100644 index 0000000000..337e127513 --- /dev/null +++ b/docs/howto/push.md @@ -0,0 +1,71 @@ +# `push` - Uploading projects + +```{note} +`push` is powered by [sqlc Cloud](https://dashboard.sqlc.dev). Sign up for [free](https://dashboard.sqlc.dev) today. +``` + +*Added in v1.24.0* + +We've renamed the `upload` sub-command to `push`. We've also changed the data sent along in a push request. Upload used to include the configuration file, migrations, queries, and all generated code. Push drops the generated code in favor of including the [plugin.GenerateRequest](https://buf.build/sqlc/sqlc/docs/main:plugin#plugin.GenerateRequest), which is the protocol buffer message we pass to codegen plugins. + +## Add configuration + +After creating a project, add the project ID to your sqlc configuration file. + +```yaml +version: "2" +cloud: + project: "" +``` + +You'll also need to create an auth token and make it available via the +`SQLC_AUTH_TOKEN` environment variable. + +```shell +export SQLC_AUTH_TOKEN=sqlc_xxxxxxxx +``` + +## Dry run + +You can see what's included when uploading your project by using using the +`--dry-run` flag: + +```shell +$ sqlc push --dry-run +2023/11/21 10:39:51 INFO config file=sqlc.yaml bytes=912 +2023/11/21 10:39:51 INFO codegen_request queryset=app file=codegen_request.pb +2023/11/21 10:39:51 INFO schema queryset=app file=migrations/00001_initial.sql bytes=3033 +2023/11/21 10:39:51 INFO query queryset=app file=queries/app.sql bytes=1150 +``` + +The output is the files `sqlc` would have sent without the `--dry-run` flag. + +## Push + +Once you're ready to push, remove the `--dry-run` flag. + +```shell +$ sqlc push +``` + +### Tags + +You can provide tags to associate with a push, primarily as a convenient reference when using `sqlc verify` with the `against` argument. + +Tags only refer to a single push, so if you pass an existing tag to `push` it will overwrite the previous reference. + +```shell +$ sqlc push --tag main +``` + +### Annotations + +Annotations are added to each push request. By default, we include these environment variables (if they are present). + +``` +GITHUB_REPOSITORY +GITHUB_REF +GITHUB_REF_NAME +GITHUB_REF_TYPE +GITHUB_SHA +``` diff --git a/docs/howto/rename.md b/docs/howto/rename.md index f2d03e6cba..47ee05cf7e 100644 --- a/docs/howto/rename.md +++ b/docs/howto/rename.md @@ -30,7 +30,10 @@ sql: ## Tables -The output structs associated with tables can also be renamed. By default, the struct name will be the singular version of the table name. For example, the `authors` table will generate an `Author` struct. +The output structs associated with tables can also be renamed. By default, +the struct name will be the singular version of the table name. For example, +the `authors` table will generate an `Author` struct and the `book_publishers` +table will generate a `BookPublisher` struct. ```sql CREATE TABLE authors ( @@ -38,6 +41,11 @@ CREATE TABLE authors ( name text NOT NULL, bio text ); + +CREATE TABLE book_publishers ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL +); ``` ```go @@ -52,9 +60,17 @@ type Author struct { Name string Bio sql.NullString } + +type Publisher struct { + ID int64 + Name string +} ``` -To rename this struct, you must use the generated struct name. In this example, that would be `author`. Use the `rename` map to change the name of this struct to `Writer` (note the uppercase `W`). +To rename these structs, you must use the generated struct name. In this +example, that would be `author` and `book_publisher`. Use the `rename` map to +change the name of these struct to `Writer` and `BookPublisher` (note the +camel-casing and the underscore for multi-worded tables). ```yaml version: '1' @@ -65,6 +81,20 @@ packages: queries: query.sql rename: author: Writer + book_publisher: Publisher +``` + +```yaml +version: "2" +sql: + - engine: postgresql + queries: query.sql + schema: query.sql +overrides: + go: + rename: + author: Writer + book_publisher: Publisher ``` ```go @@ -79,9 +109,14 @@ type Writer struct { Name string Bio sql.NullString } + +type Publisher struct { + ID int64 + Name string +} ``` ## Limitations Rename mappings apply to an entire package. Therefore, a column named `foo` and -a table name `foo` can't be renamed different values. \ No newline at end of file +a table name `foo` can't map to different rename values. diff --git a/docs/howto/select.md b/docs/howto/select.md index cea3900b68..9a53a1d9ef 100644 --- a/docs/howto/select.md +++ b/docs/howto/select.md @@ -8,8 +8,12 @@ CREATE TABLE authors ( bio text NOT NULL, birth_year int NOT NULL ); +``` +The parameter syntax varies by database engine: +**PostgreSQL:** +```sql -- name: GetAuthor :one SELECT * FROM authors WHERE id = $1; @@ -19,6 +23,17 @@ SELECT * FROM authors ORDER BY id; ``` +**MySQL and SQLite:** +```sql +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = ?; + +-- name: ListAuthors :many +SELECT * FROM authors +ORDER BY id; +``` + A few new pieces of code are generated beyond the `Author` struct. An interface for the underlying database is generated. The `*sql.DB` and `*sql.Tx` types satisfy this interface. @@ -125,7 +140,7 @@ SELECT bio, birth_year FROM authors WHERE id = $1; ``` -When selecting a single column, only that value that returned. The `GetBioForAuthor` +When selecting a single column, only that value is returned. The `GetBioForAuthor` method takes a single `int` as an argument and returns a `string` and an `error`. diff --git a/docs/howto/structs.md b/docs/howto/structs.md index 2070d3d234..c0b203df97 100644 --- a/docs/howto/structs.md +++ b/docs/howto/structs.md @@ -31,7 +31,8 @@ CREATE TABLE authors ( ); ``` -sqlc can generate structs with JSON tags. The JSON name for a field matches +sqlc can generate structs with JSON tags by adding the `emit_json_tags` key to the configuration file as it shows on [configuration reference](../reference/config.md). +The JSON name for a field matches the column name in the database. ```go @@ -49,4 +50,4 @@ type Author struct { ## More control -See the Type Overrides section of the Configuration File docs for fine-grained control over struct field types and tags. +See the guide to [Overriding types](./overrides.md) for fine-grained control over struct field types and tags. diff --git a/docs/howto/transactions.md b/docs/howto/transactions.md index bc93ebd661..9ed61b6a4d 100644 --- a/docs/howto/transactions.md +++ b/docs/howto/transactions.md @@ -57,6 +57,7 @@ func (q *Queries) WithTx(tx *sql.Tx) *Queries { You'd use it like this: ```go +// Using `github/lib/pq` as the driver. func bumpCounter(ctx context.Context, db *sql.DB, queries *tutorial.Queries, id int32) error { tx, err := db.Begin() if err != nil { @@ -76,4 +77,25 @@ func bumpCounter(ctx context.Context, db *sql.DB, queries *tutorial.Queries, id } return tx.Commit() } + +// Using `github.com/jackc/pgx/v5` as the driver. +func bumpCounter(ctx context.Context, db *pgx.Conn, queries *tutorial.Queries, id int32) error { + tx, err := db.Begin(ctx) + if err != nil { + return err + } + defer tx.Rollback(ctx) + qtx := queries.WithTx(tx) + r, err := qtx.GetRecord(ctx, id) + if err != nil { + return err + } + if err := qtx.UpdateRecord(ctx, tutorial.UpdateRecordParams{ + ID: r.ID, + Counter: r.Counter + 1, + }); err != nil { + return err + } + return tx.Commit(ctx) +} ``` \ No newline at end of file diff --git a/docs/howto/update.md b/docs/howto/update.md index 3abb99ba23..f96306d0f2 100644 --- a/docs/howto/update.md +++ b/docs/howto/update.md @@ -12,11 +12,20 @@ CREATE TABLE authors ( If your query has a single parameter, your Go method will also have a single parameter. +The parameter syntax varies by database engine: + +**PostgreSQL:** ```sql -- name: UpdateAuthorBios :exec UPDATE authors SET bio = $1; ``` +**MySQL and SQLite:** +```sql +-- name: UpdateAuthorBios :exec +UPDATE authors SET bio = ?; +``` + ```go package db @@ -52,12 +61,22 @@ func (q *Queries) UpdateAuthorBios(ctx context.Context, bio string) error { If your query has more than one parameter, your Go method will accept a `Params` struct. +**PostgreSQL:** ```sql -- name: UpdateAuthor :exec UPDATE authors SET bio = $2 WHERE id = $1; ``` +**MySQL and SQLite:** +```sql +-- name: UpdateAuthor :exec +UPDATE authors SET bio = ? +WHERE id = ?; +``` + +Note: For MySQL and SQLite, parameters are bound in the order they appear in the query, regardless of the order in the function signature. + ```go package db diff --git a/docs/howto/upload.md b/docs/howto/upload.md deleted file mode 100644 index b974252afc..0000000000 --- a/docs/howto/upload.md +++ /dev/null @@ -1,49 +0,0 @@ -# Uploading projects - -*Added in v1.22.0* - -Uploading an archive of your project ensures that future releases of sqlc do not -break your code. Similar to Rust's [crater](https://github.com/rust-lang/crater) -project, uploaded archives are tested against development releases of sqlc to -verify correctness. - -Interested in uploading projects? Sign up [here](https://docs.google.com/forms/d/e/1FAIpQLSdxoMzJ7rKkBpuez-KyBcPNyckYV-5iMR--FRB7WnhvAmEvKg/viewform) or send us an email -at [hello@sqlc.dev](mailto:hello@sqlc.dev). - -## Add configuration - -After creating a project, add the project ID to your sqlc configuration file. - -```yaml -version: "2" -cloud: - project: "" -``` - -You'll also need to create an auth token and make it available via the -`SQLC_AUTH_TOKEN` environment variable. - -```shell -export SQLC_AUTH_TOKEN=sqlc_xxxxxxxx -``` - -## Dry run - -You can see what's included when uploading your project by using using the -`--dry-run` flag: - -```shell -sqlc upload --dry-run -``` - -The output is the request `sqlc` would have sent without the `--dry-run` flag. - -## Upload - -Once you're ready to upload, remove the `--dry-run` flag. - -```shell -sqlc upload -``` - -By uploading your project, you're making sqlc more stable and reliable. Thanks! \ No newline at end of file diff --git a/docs/howto/verify.md b/docs/howto/verify.md new file mode 100644 index 0000000000..62da44013d --- /dev/null +++ b/docs/howto/verify.md @@ -0,0 +1,105 @@ +# `verify` - Verifying schema changes + +*Added in v1.24.0* + +Schema updates and poorly-written queries often bring down production databases. That’s bad. + +Out of the box, `sqlc generate` catches some of these issues. Running `sqlc vet` with the `sqlc/db-prepare` rule catches more subtle problems. But there is a large class of issues that sqlc can’t prevent by looking at current schema and queries alone. + +For instance, when a schema change is proposed, existing queries and code running in production might fail when the schema change is applied. Enter `sqlc verify`, which analyzes existing queries against new schema changes and errors if there are any issues. + +Let's look at an example. Assume you have these two tables in production. + +```sql +CREATE TABLE users ( + id UUID PRIMARY KEY +); + +CREATE TABLE user_actions ( + id UUID PRIMARY KEY, + user_id UUID NOT NULL, + action TEXT, + created_at TIMESTAMP +); +``` + +Your application contains the following query to join user actions against the users table. + +```sql +-- name: GetUserActions :many +SELECT * FROM users u +JOIN user_actions ua ON u.id = ua.user_id +ORDER BY created_at; +``` + +So far, so good. Then assume you propose this schema change: + +```sql +ALTER TABLE users ADD COLUMN created_at TIMESTAMP; +``` + +Running `sqlc generate` fails with this change, returning a `column reference "created_at" is ambiguous` error. You update your query to fix the issue. + +```sql +-- name: GetUserActions :many +SELECT * FROM users u +JOIN user_actions ua ON u.id = ua.user_id +ORDER BY u.created_at; +``` + +While that change fixes the issue, there's a production outage waiting to happen. When the schema change is applied, the existing `GetUserActions` query will begin to fail. The correct way to fix this is to deploy the updated query before applying the schema migration. + +It ensures migrations are safe to deploy by sending your current schema and queries to sqlc cloud. There, we run the queries for your latest push against your new schema changes. This check catches backwards incompatible schema changes for existing queries. + +Here `sqlc verify` alerts you to the fact that ORDER BY "created_at" is ambiguous. + +```sh +$ sqlc verify +FAIL: app query.sql + +=== Failed +=== FAIL: app query.sql GetUserActions + ERROR: column reference "created_at" is ambiguous (SQLSTATE 42702) +``` + +By the way, this scenario isn't made up! It happened to us a few weeks ago. We've been happily testing early versions of `verify` for the last two weeks and haven't had any issues since. + +This type of verification is only the start. If your application is deployed on-prem by your customers, `verify` could tell you if it's safe for your customers to rollback to an older version of your app, even after schema migrations have been run. + +Using `verify` requires that you push your queries and schema when you tag a release of your application. We run it on every push to main, as we continuously deploy those commits. + +## Authentication + +`sqlc` expects to find a valid auth token in the value of the `SQLC_AUTH_TOKEN` +environment variable. You can create an auth token via the [dashboard](https://dashboard.sqlc.dev). + +```shell +export SQLC_AUTH_TOKEN=sqlc_xxxxxxxx +``` + +## Expected workflow + +Using `sqlc verify` requires pushing your queries and schema to sqlc Cloud. When +you release a new version of your application, you should push your schema and +queries as well. For example, we run `sqlc push` after any change has been +merged into our `main` branch on Github, as we deploy every commit to +production. + +```shell +$ sqlc push --tag main +``` + +Locally or in pull requests, run `sqlc verify` to check that existing queries +continue to work with your current database schema. + +```shell +$ sqlc verify --against main +``` + +## Picking a tag + +Without an `against` argument, `verify` will run its analysis of the provided schema using your most-recently pushed queries. We suggest using the `against` argument to explicitly select a set of queries for comparison. + +```shell +$ sqlc verify --against [tag] +``` diff --git a/docs/howto/vet.md b/docs/howto/vet.md index 1b3d075076..3f6c6a025b 100644 --- a/docs/howto/vet.md +++ b/docs/howto/vet.md @@ -1,18 +1,19 @@ -# Linting queries +# `vet` - Linting queries *Added in v1.19.0* `sqlc vet` runs queries through a set of lint rules. -Rules are defined in the `sqlc` [configuration](../reference/config) file. They consist -of a name, message, and a [Common Expression Language (CEL)](https://github.com/google/cel-spec) -expression. Expressions are evaluated using [cel-go](https://github.com/google/cel-go). -If an expression evaluates to `true`, `sqlc vet` will report an error using the given message. +Rules are defined in the `sqlc` [configuration](../reference/config) file. They +consist of a name, message, and a [Common Expression Language +(CEL)](https://github.com/google/cel-spec) expression. Expressions are evaluated +using [cel-go](https://github.com/google/cel-go). If an expression evaluates to +`true`, `sqlc vet` will report an error using the given message. ## Defining lint rules -Each lint rule's CEL expression has access to information from your sqlc configuration and queries -via variables defined in the following proto messages. +Each lint rule's CEL expression has access to information from your sqlc +configuration and queries via variables defined in the following proto messages. ```proto message Config @@ -42,7 +43,7 @@ message Parameter ``` In addition to this basic information, when you have a PostgreSQL or MySQL -[database connection configured](../reference/config.html#database) +[database connection configured](../reference/config.md#database) each CEL expression has access to the output from running `EXPLAIN ...` on your query via the `postgresql.explain` and `mysql.explain` variables. This output is quite complex and depends on the structure of your query but sqlc attempts @@ -94,7 +95,7 @@ rules: The CEL expression environment has two variables containing `EXPLAIN ...` output, `postgresql.explain` and `mysql.explain`. `sqlc` only populates the variable associated with your configured database engine, and only when you have a -[database connection configured](../reference/config.html#database). +[database connection configured](../reference/config.md#database). For the `postgresql` engine, `sqlc` runs @@ -162,22 +163,27 @@ rules: rule: "!has(postgresql.explain)" # A dummy rule to trigger explain ``` -Please note that `sqlc` does not manage or migrate your database. Use your -migration tool of choice to create the necessary database tables and objects -before running `sqlc vet` with rules that depend on `EXPLAIN ...` output. +Please note that databases configured with a `uri` must have an up-to-date +schema for `vet` to work correctly, and `sqlc` does not apply schema migrations +to your database. Use your migration tool of choice to create the necessary +tables and objects before running `sqlc vet` with rules that depend on +`EXPLAIN ...` output. + +Alternatively, configure [managed databases](managed-databases.md) to have +`sqlc` create hosted ephemeral databases with the correct schema automatically. ## Built-in rules ### sqlc/db-prepare -When a [database](../reference/config.html#database) connection is configured, you can +When a [database](../reference/config.md#database) connection is configured, you can run the built-in `sqlc/db-prepare` rule. This rule will attempt to prepare each of your queries against the connected database and report any failures. ```yaml version: 2 sql: - - schema: "query.sql" + - schema: "schema.sql" queries: "query.sql" engine: "postgresql" gen: @@ -190,17 +196,39 @@ sql: - sqlc/db-prepare ``` +Please note that databases configured with a `uri` must have an up-to-date +schema for `vet` to work correctly, and `sqlc` does not apply schema migrations +to your database. Use your migration tool of choice to create the necessary +tables and objects before running `sqlc vet` with the `sqlc/db-prepare` rule. + +Alternatively, configure [managed databases](managed-databases.md) to have +`sqlc` create hosted ephemeral databases with the correct schema automatically. + +```yaml +version: 2 +cloud: + project: "" +sql: + - schema: "schema.sql" + queries: "query.sql" + engine: "postgresql" + gen: + go: + package: "authors" + out: "db" + database: + managed: true + rules: + - sqlc/db-prepare +``` + To see this in action, check out the [authors example](https://github.com/sqlc-dev/sqlc/blob/main/examples/authors/sqlc.yaml). -Please note that `sqlc` does not manage or migrate your database. Use your -migration tool of choice to create the necessary database tables and objects -before running `sqlc vet` with the `sqlc/db-prepare` rule. - ## Running lint rules When you add the name of a defined rule to the rules list -for a [sql package](https://docs.sqlc.dev/en/stable/reference/config.html#sql), +for a [sql package](../reference/config.md#sql), `sqlc vet` will evaluate that rule against every query in the package. In the example below, two rules are defined but only one is enabled. @@ -231,11 +259,28 @@ 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 */ /* @sqlc-vet-disable */ SELECT * FROM authors WHERE id = ? LIMIT 1; -``` \ No newline at end of file +``` diff --git a/docs/index.rst b/docs/index.rst index 566d87d84f..f914f3ec41 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -36,6 +36,16 @@ code ever again. tutorials/getting-started-postgresql.md tutorials/getting-started-sqlite.md +.. toctree:: + :maxdepth: 2 + :caption: Commands + :hidden: + + howto/generate.md + howto/push.md + howto/verify.md + howto/vet.md + .. toctree:: :maxdepth: 2 :caption: How-to Guides @@ -57,10 +67,12 @@ code ever again. howto/overrides.md howto/rename.md - howto/vet.md +.. toctree:: + :maxdepth: 3 + :caption: sqlc Cloud + :hidden: + howto/managed-databases.md - howto/ci-cd.md - howto/upload.md .. toctree:: :maxdepth: 3 @@ -81,7 +93,8 @@ code ever again. :caption: Conceptual Guides :hidden: + howto/ci-cd.md guides/using-go-and-pgx.rst - guides/development.md guides/plugins.md + guides/development.md guides/privacy.md diff --git a/docs/overview/install.md b/docs/overview/install.md index 86113b0423..354c65d249 100644 --- a/docs/overview/install.md +++ b/docs/overview/install.md @@ -14,20 +14,14 @@ brew install sqlc sudo snap install sqlc ``` -## go install +## go install -### Go >= 1.17: +Installing recent versions of sqlc requires Go 1.21+. ``` go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest ``` -### Go < 1.17: - -``` -go get github.com/sqlc-dev/sqlc/cmd/sqlc -``` - ## Docker ``` @@ -48,10 +42,10 @@ docker run --rm -v "%cd%:/src" -w /src sqlc/sqlc generate ## Downloads -Get pre-built binaries for *v1.22.0*: +Get pre-built binaries for *v1.30.0*: -- [Linux](https://downloads.sqlc.dev/sqlc_1.22.0_linux_amd64.tar.gz) -- [macOS](https://downloads.sqlc.dev/sqlc_1.22.0_darwin_amd64.zip) -- [Windows](https://downloads.sqlc.dev/sqlc_1.22.0_windows_amd64.zip) +- [Linux](https://downloads.sqlc.dev/sqlc_1.30.0_linux_amd64.tar.gz) +- [macOS](https://downloads.sqlc.dev/sqlc_1.30.0_darwin_amd64.zip) +- [Windows](https://downloads.sqlc.dev/sqlc_1.30.0_windows_amd64.zip) See [downloads.sqlc.dev](https://downloads.sqlc.dev/) for older versions. diff --git a/docs/reference/changelog.md b/docs/reference/changelog.md index 3704d85e7a..cb8f1b8d63 100644 --- a/docs/reference/changelog.md +++ b/docs/reference/changelog.md @@ -1,12 +1,681 @@ # Changelog All notable changes to this project will be documented in this file. -## [1.22.0](https://github.com/sqlc-dev/sqlc/releases/tag/1.22.0) +(v1-30-0)= +## [1.30.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.30.0) +Released 2025-09-01 + +### Bug Fixes + +- (compiler/mysql) Prevent panic in convertSetOprSelectList() (#4042) +- Range subselect alias pointer dereference (#3711) +- (codegen/golang) Don't omit enums used as arrays (#4058) +- (codegen/golang) Handle `go_struct_tag` for `db_type` overrides (#4055) +- (engine/dolphin) Remove references to deprecated `pcast.ChangeStmt` (#4057) +- Normalize identifier usage for table names (#4045) +- (engine/sqlite) Fix parsing of INSERT DEFAULT VALUES syntax (#4010) + +### Documentation + +- Fix parameter syntax inconsistency for MySQL and SQLite (#4036) +- Use correct configuration to generate the given output for JSON type override (#4049) +- Clean up and add to docs regarding type overrides (#4060) +- Try a different admonition format (#4061) +- Use the correct admonition format (#4062) +- Add multi-worded table example for renaming (#4067) + +### Features + +- (docs) Add link to Gleam/parrot (#4038) +- (engine/dolphin) Implement MATCH_AGAINST conversion in SQL AST (#1192, #3091) (#4070) +- (engine/sqlite) Coerce jsonb columns to json before returning to Go code (#3968) + +### Testing + +- (endtoend) Skip process_plugin_sqlc_gen_json (#4075) +- (endtoend) Use Docker to start database servers (#4076) + +### Build + +- (deps) Bump the production-dependencies group across 1 directory with 2 updates (#3941) +- (deps) Bump packaging (#3940) +- (deps) Bump golang from 1.24.2 to 1.24.4 (#3983) +- (deps) Bump golang from 1.24.4 to 1.24.5 (#4014) +- (deps) Bump urllib3 from 2.4.0 to 2.5.0 in /docs (#3994) +- (deps) Bump the production-dependencies group across 1 directory with 5 updates (#3989) +- (deps) Bump the production-dependencies group across 1 directory with 4 updates (#4027) +- (deps) Bump modernc.org/sqlite (#4032) +- (deps) Bump the production-dependencies group across 1 directory with 4 updates (#4018) +- (deps) Bump certifi in /docs in the production-dependencies group (#4041) +- (deps) Bump google.golang.org/protobuf (#4043) +- (deps) Bump actions/checkout from 4 to 5 (#4059) +- (deps) Bump the production-dependencies group across 1 directory with 2 updates (#4071) +- (deps) Bump requests in /docs in the production-dependencies group (#4068) +- Upgrade to Go 1.25 (#4074) +- (deps) Bump golang from 1.24.5 to 1.25.0 (#4063) +- (deps) Bump github.com/google/cel-go (#4080) + +(v1-29-0)= +## [1.29.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.29.0) +Released 2025-04-14 + +### Bug Fixes + +- (docs) Correct spelling and grammar (#3645) +- (dbmanager) Use correct SQL to drop databases (#3640) +- (compiler) Don't crash on WHERE x IN (... UNION ...) (#3652) +- (golang) Escape q field name (#3647) +- Postgresql alter materialized view is not registered to statements (#3728) +- Do not close wazero module on error (#3758) (#3759) +- (pgx) Do not wrap nil error (#3913) +- (migrations) Normalize case for migration statement for all cases (#3919) + +### Documentation + +- Add missing documentation about copyfrom (#3583) +- Add sqlc-gen-from-template (#3601) +- Add changelog for 1.28.0 (#3797) +- Add PHP DBAL plugin (#3813) +- Fix PostGIS function name (#3829) +- Add Zig plugin (#3824) +- Add link to tandemdude/sqlc-gen-java (#3819) + +### Features + +- (docs) How-to use transactions with pgx (#3557) +- (quickdb) Remove unused func (#3576) +- (vet) Allow selective disabling of rules per query (#3620) +- (dolphin) Upgrade to latest TiDB parser (#3733) +- (mysql) Add a test for VECTOR column type (#3734) +- (cli) Bump version from 1.27.0 to 1.28.0 (#3798) +- (codegen/golang) Add an option to wrap query errors that includes query name (#3876) + +### Miscellaneous Tasks + +- Remove the triage label (#3527) +- Upgrade to Go 1.22.8 to silence vulncheck (#3646) +- Update sqlc-gen-java supported engines (#3843) + +### Build + +- (deps) Bump myst-parser (#3530) +- (deps) Bump golang from 1.22.5 to 1.22.6 (#3532) +- (deps) Bump modernc.org/sqlite (#3537) +- (deps) Bump the production-dependencies group across 1 directory with 4 updates (#3566) +- (deps) Bump the production-dependencies group across 1 directory with 2 updates (#3565) +- (deps) Bump golang from 1.22.6 to 1.23.0 (#3546) +- (deps) Bump golang from 1.23.0 to 1.23.1 (#3586) +- (deps) Bump the production-dependencies group across 1 directory with 5 updates (#3644) +- (deps) Bump the production-dependencies group across 1 directory with 5 updates (#3642) +- (deps) Bump sphinx-rtd-theme (#3648) +- (deps) Bump pyparsing (#3653) +- (deps) Bump markupsafe (#3666) +- (deps) Bump the production-dependencies group across 1 directory with 2 updates (#3707) +- (deps) Bump golang from 1.23.2 to 1.23.3 (#3691) +- (deps) Bump the production-dependencies group across 1 directory with 5 updates (#3721) +- (deps) Bump the production-dependencies group across 1 directory with 2 updates (#3731) +- (deps) Bump certifi in /docs in the production-dependencies group (#3748) +- (deps) Bump golang.org/x/crypto from 0.27.0 to 0.31.0 (#3740) +- (deps) Bump golang from 1.23.3 to 1.23.4 (#3735) +- (deps) Bump the production-dependencies group across 1 directory with 2 updates (#3749) +- (deps) Bump the production-dependencies group with 2 updates (#3753) +- (deps) Bump the production-dependencies group across 1 directory with 3 updates (#3764) +- (deps) Bump the production-dependencies group (#3761) +- (deps) Bump jinja2 from 3.1.4 to 3.1.5 in /docs (#3762) +- (deps) Bump google.golang.org/protobuf (#3776) +- (deps) Bump the production-dependencies group across 1 directory with 2 updates (#3777) +- (deps) Bump google.golang.org/grpc (#3784) +- (deps) Bump golang from 1.23.4 to 1.23.5 (#3791) +- (deps) Bump the production-dependencies group with 2 updates (#3789) +- Upgrade to Go 1.23.5 (#3795) +- (deps) Bump golang.org/x/net from 0.30.0 to 0.33.0 (#3796) +- (deps) Bump golang from 1.23.5 to 1.23.6 (#3822) +- Use govulncheck action (#3831) +- (deps) Bump the production-dependencies group across 1 directory with 3 updates (#3817) +- (deps) Bump the production-dependencies group across 1 directory with 5 updates (#3826) +- (deps) Bump golang from 1.23.6 to 1.24.0 (#3842) +- (deps) Bump myst-parser (#3841) +- (deps) Bump modernc.org/sqlite (#3846) +- (deps) Bump golang from 1.24.0 to 1.24.1 (#3870) +- (deps) Bump jinja2 in /docs in the production-dependencies group (#3872) +- Upgrade to wazero@v1.9.0 (#3887) +- Upgrade to Go 1.24.1 (#3892) +- Upgrade to latest version of MySQL parser (#3893) +- (deps) Bump pyparsing (#3890) +- (deps) Bump golang.org/x/net from 0.33.0 to 0.37.0 (#3894) +- (deps) Bump the production-dependencies group across 1 directory with 8 updates (#3896) +- (deps) Bump github.com/jackc/pgx/v5 (#3898) +- (deps) Bump the production-dependencies group (#3899) +- (deps) Bump modernc.org/sqlite (#3905) +- (deps) Bump the production-dependencies group across 1 directory with 2 updates (#3914) +- (deps) Bump urllib3 in /docs in the production-dependencies group (#3926) +- (deps) Bump golang from 1.24.1 to 1.24.2 (#3915) +- (deps) Bump the production-dependencies group across 1 directory with 3 updates (#3923) +- (deps) Upgrade github.com/wasilibs/go-pgquery (#3927) + +(v1-28-0)= +## [1.28.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.28.0) +Released 2025-01-20 + +### Features + +- (mysql) Add a test for VECTOR column type (#3734) +- (quickdb) Remove unused func (#3576) +- (vet) Allow selective disabling of rules per query (#3620) +- (dolphin) Upgrade to latest TiDB parser (#3733) + +### Bug Fixes + +- (dbmanager) Use correct SQL to drop databases (#3640) +- (compiler) Don't crash on WHERE x IN (... UNION ...) (#3652) +- (golang) Escape q field name (#3647) +- Postgresql alter materialized view is not registered to statements (#3728) +- Do not close wazero module on error (#3758) (#3759) + +### Documentation + +- How-to use transactions with pgx (#3557) +- Add missing documentation about copyfrom (#3583) +- Add sqlc-gen-from-template (#3601) +- Correct spelling and grammar (#3645) + +### Miscellaneous Tasks + +- Remove the triage label (#3527) +- Upgrade to Go 1.22.8 to silence vulncheck (#3646) + +### Build + +- (deps) Bump myst-parser (#3530) +- (deps) Bump golang from 1.22.5 to 1.22.6 (#3532) +- (deps) Bump modernc.org/sqlite (#3537) +- (deps) Bump the production-dependencies group across 1 directory with 4 updates (#3566) +- (deps) Bump the production-dependencies group across 1 directory with 2 updates (#3565) +- (deps) Bump golang from 1.22.6 to 1.23.0 (#3546) +- (deps) Bump golang from 1.23.0 to 1.23.1 (#3586) +- (deps) Bump the production-dependencies group across 1 directory with 5 updates (#3644) +- (deps) Bump the production-dependencies group across 1 directory with 5 updates (#3642) +- (deps) Bump sphinx-rtd-theme (#3648) +- (deps) Bump pyparsing (#3653) +- (deps) Bump markupsafe (#3666) +- (deps) Bump the production-dependencies group across 1 directory with 2 updates (#3707) +- (deps) Bump golang from 1.23.2 to 1.23.3 (#3691) +- (deps) Bump the production-dependencies group across 1 directory with 5 updates (#3721) +- (deps) Bump the production-dependencies group across 1 directory with 2 updates (#3731) +- (deps) Bump certifi in /docs in the production-dependencies group (#3748) +- (deps) Bump golang.org/x/crypto from 0.27.0 to 0.31.0 (#3740) +- (deps) Bump golang from 1.23.3 to 1.23.4 (#3735) +- (deps) Bump the production-dependencies group across 1 directory with 2 updates (#3749) +- (deps) Bump the production-dependencies group with 2 updates (#3753) +- (deps) Bump the production-dependencies group across 1 directory with 3 updates (#3764) +- (deps) Bump the production-dependencies group (#3761) +- (deps) Bump jinja2 from 3.1.4 to 3.1.5 in /docs (#3762) +- (deps) Bump google.golang.org/protobuf (#3776) +- (deps) Bump the production-dependencies group across 1 directory with 2 updates (#3777) +- (deps) Bump google.golang.org/grpc (#3784) +- (deps) Bump golang from 1.23.4 to 1.23.5 (#3791) +- (deps) Bump the production-dependencies group with 2 updates (#3789) +- Upgrade to Go 1.23.5 (#3795) + +(v1-27-0)= +## [1.27.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.27.0) +Released 2024-08-05 + +### Bug Fixes + +- (dbmanager) Add leading slash to db uri path rewrite (#3493) +- (verify) Include database engine in request (#3522) + +### Features + +- (golang) Add initialisms configuration (#3308) +- (compiler) Support subqueries in the FROM clause (second coming) (#3310) +- Managed databases with any accessible server (#3421) +- (vet) Use new dbmanager client (#3423) +- (verify) Update verify to work with managed databases (#3425) + +### Documentation + +- Fix typo in config (#3358) +- Resolve a typo in configuration keys (#3349) +- Add sponsorship information to README (#3413) +- Update the language-support to include C# (#3408) +- Add migration guide for hosted managed databases (#3417) +- Fix readme links (#3424) +- Update the managed db and verify documentation (#3426) +- Add sponsor image (#3428) +- Add Ruby as supported language (#3487) +- Update migrating-to-sqlc-gen-kotlin.md (#3454) +- Fix typo in comment (#3316) +- Fix deprecated build tag format (#3361) + +### Testing + +- (endtoend) Re-use databases when possible (#3315) +- Enabled MySQL database (#3318) +- Remove internal/sqltest/hosted package (#3521) + +(v1-26-0)= +## [1.26.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.26.0) +Released 2024-03-28 + +### Release notes + +This release is mainly a bug fix release. It also includes an [important security fix](https://github.com/sqlc-dev/sqlc/issues/3194) for users using output plugins. + +### Changes + +#### Bug Fixes + +- (docker) Use distroless base image instead of scratch (#3111) +- (generate) Ensure files are created inside output directory (#3195) +- (mysql) BREAKING: Use `int16` for MySQL `SMALLINT` and `YEAR` (#3106) +- (mysql) BREAKING: Use `int8` for MySQL TINYINT (#3298) +- (mysql) Variables not resolving in ORDER BY statements (#3115) +- (opts) Validate SQL package and driver options (#3241) +- (postgres/batch) Ignore query_parameter_limit for batches +- (scripts) Remove deprecated test output regeneration script (#3105) +- (sqlite) Correctly skip unknown statements (#3239) + +#### Documentation + +- (postgres) Add instructions for PostGIS/GEOS (#3182) +- Improve details on TEXT (#3247) + +#### Features + +- (generate) Avoid generating empty Go imports (#3135) +- (mysql) Add NEXTVAL() to the MySQL catalog (#3147) +- (mysql) Support json.RawMessage for LOAD DATA INFILE (#3099) + +#### Build + +- (deps) Bump github.com/jackc/pgx/v5 to 5.5.5 (#3259) +- (deps) Bump modernc.org/sqlite to 1.29.5 (#3200) +- (deps) Bump github.com/go-sql-driver/mysql to 1.8.0 (#3257) +- (deps) Bump github.com/tetratelabs/wazero to 1.7.0 (#3096) +- (deps) Bump github.com/pganalyze/pg_query_go to v5 (#3096) + + +(v1-25-0)= +## [1.25.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.25.0) +Released 2024-01-03 + +### Release notes + +#### Add tags to push and verify + +You can add tags when [pushing](../howto/push.md) schema and queries to [sqlc Cloud](https://dashboard.sqlc.dev). Tags operate like git tags, meaning you can overwrite previously-pushed tag values. We suggest tagging pushes to associate them with something relevant from your environment, e.g. a git tag or branch name. + +``` +$ sqlc push --tag v1.0.0 +``` + +Once you've created a tag, you can refer to it when [verifying](../howto/verify.md) changes, allowing you +to compare the existing schema against a known set of previous queries. + +``` +$ sqlc verify --against v1.0.0 +``` + +#### C-ya, `cgo` + +Over the last month, we've switched out a few different modules to remove our reliance on [cgo](https://go.dev/blog/cgo). Previously, we needed cgo for three separate functions: + +- Parsing PostgreSQL queries with [pganalyze/pg_query_go](https://github.com/pganalyze/pg_query_go) +- Running SQLite databases with [mattn/go-sqlite3](https://github.com/mattn/go-sqlite3) +- Executing WASM / WASI code with [bytecodealliance/wasmtime-go](https://github.com/bytecodealliance/wasmtime-go) + +With the help of the community, we found cgo-free alternatives for each module: + +- Parsing PostgreSQL queries, now using [wasilibs/go-pgquery](https://github.com/wasilibs/go-pgquery) +- Running SQLite databases, now using [modernc.org/sqlite](https://gitlab.com/cznic/sqlite) +- Executing WASM / WASI code, now using [tetratelabs/wazero](https://github.com/tetratelabs/wazero) + +For the first time, Windows users can enjoy full PostgreSQL support without using [WSL](https://learn.microsoft.com/en-us/windows/wsl/about). It's a Christmas miracle! + +If you run into any issues with the updated dependencies, please [open an issue](https://github.com/sqlc-dev/sqlc/issues). + +### Changes + +#### Bug Fixes + +- (codegen) Wrong yaml annotation in go codegen options for output_querier_file_name (#3006) +- (codegen) Use derived ArrayDims instead of deprecated attndims (#3032) +- (codegen) Take the maximum array dimensions (#3034) +- (compiler) Skip analysis of queries without a `name` annotation (#3072) +- (codegen/golang) Don't import `"strings"` for `sqlc.slice()` with pgx (#3073) + +### Documentation + +- Add name to query set configuration (#3011) +- Add a sidebar link for `push`, add Go plugin link (#3023) +- Update banner for sqlc-gen-typescript (#3036) +- Add strict_order_by in doc (#3044) +- Re-order the migration tools list (#3064) + +### Features + +- (analyzer) Return zero values when encountering unexpected ast nodes (#3069) +- (codegen/go) add omit_sqlc_version to Go code generation (#3019) +- (codgen/go) Add `emit_sql_as_comment` option to Go code plugin (#2735) +- (plugins) Use wazero instead of wasmtime (#3042) +- (push) Add tag support (#3074) +- (sqlite) Support emit_pointers_for_null_types (#3026) + +### Testing + +- (endtoend) Enable for more build targets (#3041) +- (endtoend) Run MySQL and PostgreSQL locally on the runner (#3095) +- (typescript) Test against sqlc-gen-typescript (#3046) +- Add tests for omit_sqlc_version (#3020) +- Split schema and query for test (#3094) + +### Build + +- (deps) Bump idna from 3.4 to 3.6 in /docs (#3010) +- (deps) Bump sphinx-rtd-theme from 1.3.0 to 2.0.0 in /docs (#3016) +- (deps) Bump golang from 1.21.4 to 1.21.5 (#3043) +- (deps) Bump actions/setup-go from 4 to 5 (#3047) +- (deps) Bump github.com/jackc/pgx/v5 from 5.5.0 to 5.5.1 (#3050) +- (deps) Upgrade to latest version of github.com/wasilibs/go-pgquery (#3052) +- (deps) Bump google.golang.org/grpc from 1.59.0 to 1.60.0 (#3053) +- (deps) Bump babel from 2.13.1 to 2.14.0 in /docs (#3055) +- (deps) Bump actions/upload-artifact from 3 to 4 (#3061) +- (deps) Bump modernc.org/sqlite from 1.27.0 to 1.28.0 (#3062) +- (deps) Bump golang.org/x/crypto from 0.14.0 to 0.17.0 (#3068) +- (deps) Bump google.golang.org/grpc from 1.60.0 to 1.60.1 (#3070) +- (deps) Bump google.golang.org/protobuf from 1.31.0 to 1.32.0 (#3079) +- (deps) Bump github.com/tetratelabs/wazero from 1.5.0 to 1.6.0 (#3096) +- (sqlite) Update to antlr 4.13.1 (#3086) +- (sqlite) Disable modernc for WASM (#3048) +- (sqlite) Switch from mattn/go-sqlite3 to modernc.org/sqlite (#3040) + +(v1-24-0)= +## [1.24.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.24.0) +Released 2023-11-22 + +### Release notes + +#### Verifying database schema changes + +Schema updates and poorly-written queries often bring down production databases. That’s bad. + +Out of the box, `sqlc generate` catches some of these issues. Running `sqlc vet` with the `sqlc/db-prepare` rule catches more subtle problems. But there is a large class of issues that sqlc can’t prevent by looking at current schema and queries alone. + +For instance, when a schema change is proposed, existing queries and code running in production might fail when the schema change is applied. Enter `sqlc verify`, which analyzes existing queries against new schema changes and errors if there are any issues. + +Let's look at an example. Assume you have these two tables in production. + +```sql +CREATE TABLE users ( + id UUID PRIMARY KEY +); + +CREATE TABLE user_actions ( + id UUID PRIMARY KEY, + user_id UUID NOT NULL, + action TEXT, + created_at TIMESTAMP +); +``` + +Your application contains the following query to join user actions against the users table. + +```sql +-- name: GetUserActions :many +SELECT * FROM users u +JOIN user_actions ua ON u.id = ua.user_id +ORDER BY created_at; +``` + +So far, so good. Then assume you propose this schema change: + +```sql +ALTER TABLE users ADD COLUMN created_at TIMESTAMP; +``` + +Running `sqlc generate` fails with this change, returning a `column reference "created_at" is ambiguous` error. You update your query to fix the issue. + +```sql +-- name: GetUserActions :many +SELECT * FROM users u +JOIN user_actions ua ON u.id = ua.user_id +ORDER BY u.created_at; +``` + +While that change fixes the issue, there's a production outage waiting to happen. When the schema change is applied, the existing `GetUserActions` query will begin to fail. The correct way to fix this is to deploy the updated query before applying the schema migration. + +It ensures migrations are safe to deploy by sending your current schema and queries to sqlc cloud. There, we run the queries for your latest push against your new schema changes. This check catches backwards incompatible schema changes for existing queries. + +Here `sqlc verify` alerts you to the fact that ORDER BY "created_at" is ambiguous. + +```sh +$ sqlc verify +FAIL: app query.sql + +=== Failed +=== FAIL: app query.sql GetUserActions + ERROR: column reference "created_at" is ambiguous (SQLSTATE 42702) +``` + +By the way, this scenario isn't made up! It happened to us a few weeks ago. We've been happily testing early versions of `verify` for the last two weeks and haven't had any issues since. + +This type of verification is only the start. If your application is deployed on-prem by your customers, `verify` could tell you if it's safe for your customers to rollback to an older version of your app, even after schema migrations have been run. + +#### Rename `upload` command to `push` + +We've renamed the `upload` sub-command to `push`. We changed the data sent along in a push request. Upload used to include the configuration file, migrations, queries, and all generated code. Push drops the generated code in favor of including the [plugin.GenerateRequest](https://buf.build/sqlc/sqlc/docs/main:plugin#plugin.GenerateRequest), which is the protocol buffer message we pass to codegen plugins. + +We also add annotations to each push. By default, we include these environment variables if they are present: + +``` +GITHUB_REPOSITORY +GITHUB_REF +GITHUB_REF_NAME +GITHUB_REF_TYPE +GITHUB_SHA +``` + +Like upload, `push` should be run when you tag a release of your application. We run it on every push to main, as we continuously deploy those commits. + +#### MySQL support in `createdb` + +The `createdb` command, added in the last release, now supports MySQL. If you have a cloud project configured, you can use `sqlc createdb` to spin up a new ephemeral database with your schema and print its connection string to standard output. This is useful for integrating with other tools. Read more in the [managed databases](../howto/managed-databases.md#with-other-tools) documentation. + +#### Plugin interface refactor + +This release includes a refactored plugin interface to better support future functionality. Plugins now support different methods via a gRPC service interface, allowing plugins to support different functionality in a backwards-compatible way. + +By using gRPC interfaces, we can even (theoretically) support [remote plugins](https://github.com/sqlc-dev/sqlc/pull/2938), but that's something for another day. + +### Changes + +#### Bug Fixes + +- (engine/sqlite) Support CASE expr (#2926) +- (engine/sqlite) Support -> and ->> operators (#2927) +- (vet) Add a nil pointer check to prevent db/prepare panic (#2934) +- (compiler) Prevent panic when compiler is nil (#2942) +- (codegen/golang) Move more Go-specific config validation into the plugin (#2951) +- (compiler) No panic on full-qualified column names (#2956) +- (docs) Better discussion of type override nuances (#2972) +- (codegen) Never generate return structs for :exec (#2976) +- (generate) Update help text for generate to be more generic (#2981) +- (generate) Return an error instead of generating duplicate Go names (#2962) +- (codegen/golang) Pull opts into its own package (#2920) +- (config) Make some struct and field names less confusing (#2922) + +#### Features + +- (codegen) Remove Go specific overrides from codegen proto (#2929) +- (plugin) Use gRPC interface for codegen plugin communication (#2930) +- (plugin) Calculate SHA256 if it does not exist (#2935) +- (sqlc-gen-go) Add script to mirror code to sqlc-gen-go (#2952) +- (createdb) Add support for MySQL (#2980) +- (verify) Add new command to verify queries and migrations (#2986) + +#### Testing + +- (ci) New workflow for sqlc-gen-python (#2936) +- (ci) Rely on go.mod to determine which Go version to use (#2971) +- (tests) Add glob pattern tests to sqlpath.Glob (#2995) +- (examples) Use hosted MySQL databases for tests (#2982) +- (docs) Clean up a little, update LICENSE and README (#2941) + +#### Build + +- (deps) Bump babel from 2.13.0 to 2.13.1 in /docs (#2911) +- (deps) Bump github.com/spf13/cobra from 1.7.0 to 1.8.0 (#2944) +- (deps) Bump github.com/mattn/go-sqlite3 from 1.14.17 to 1.14.18 (#2945) +- (deps) Bump golang.org/x/sync from 0.4.0 to 0.5.0 (#2946) +- (deps) Bump github.com/jackc/pgx/v5 from 5.4.3 to 5.5.0 (#2947) +- (deps) Change github.com/pingcap/tidb/parser to github.com/pingcap/tidb/pkg/parser +- (deps) Bump github.com/google/cel-go from 0.18.1 to 0.18.2 (#2969) +- (deps) Bump urllib3 from 2.0.7 to 2.1.0 in /docs (#2975) +- (buf) Change root of Buf module (#2987) +- (deps) Bump certifi from 2023.7.22 to 2023.11.17 in /docs (#2993) +- (ci) Bump Go version from 1.21.3 to 1.21.4 in workflows and Dockerfile (#2961) + +(v1-23-0)= +## [1.23.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.23.0) +Released 2023-10-24 + +### Release notes + +#### Database-backed query analysis + +With a [database connection](config.md#database) configured, `sqlc generate` +will gather metadata from that database to support its query analysis. +Turning this on resolves a [large number of +issues](https://github.com/sqlc-dev/sqlc/issues?q=is%3Aissue+label%3Aanalyzer) +in the backlog related to type inference and more complex queries. The easiest +way to try it out is with [managed databases](../howto/managed-databases.md). + +The database-backed analyzer currently supports PostgreSQL, with [MySQL](https://github.com/sqlc-dev/sqlc/issues/2902) and [SQLite](https://github.com/sqlc-dev/sqlc/issues/2903) +support planned in the future. + +#### New `createdb` command + +When you have a cloud project configured, you can use the new `sqlc createdb` +command to spin up a new ephemeral database with your schema and print its +connection string to standard output. This is useful for integrating with other +tools. Read more in the [managed +databases](../howto/managed-databases.md#with-other-tools) documentation. + +#### Support for pgvector + +If you're using [pgvector](https://github.com/pgvector/pgvector), say goodbye to custom overrides! sqlc now generates code using [pgvector-go](https://github.com/pgvector/pgvector-go#pgx) as long as you're using `pgx`. The pgvector extension is also available in [managed databases](../howto/managed-databases.md). + +#### Go build tags + +With the new `emit_build_tags` configuration parameter you can set build tags +for sqlc to add at the top of generated source files. + +### Changes + +#### Bug Fixes + +- (codegen) Correct column names in :copyfrom (#2838) +- (compiler) Search SELECT and UPDATE the same way (#2841) +- (dolphin) Support more UNIONs for MySQL (#2843) +- (compiler) Account for parameters without parents (#2844) +- (postgresql) Remove temporary pool config (#2851) +- (golang) Escape reserved keywords (#2849) +- (mysql) Handle simplified CASE statements (#2852) +- (engine/dolphin) Support enum in ALTER definition (#2680) +- (mysql) Add, drop, rename and change enum values (#2853) +- (config) Validate `database` config in all cases (#2856) +- (compiler) Use correct func signature for `CommentSyntax` on windows (#2867) +- (codegen/go) Prevent filtering of embedded struct fields (#2868) +- (compiler) Support functions with OUT params (#2865) +- (compiler) Pull in array information from analyzer (#2864) +- (analyzer) Error on unexpanded star expression (#2882) +- (vet) Remove rollback statements from DDL (#2895) + +#### Documentation + +- Add stable anchors to changelog (#2784) +- Fix typo in v1.22.0 changelog (#2796) +- Add sqlc upload to CI / CD guide (#2797) +- Fix broken link, add clarity to plugins doc (#2813) +- Add clarity and reference to JSON tags (#2819) +- Replace form with dashboard link (#2840) +- (examples) Update examples to use pgx/v5 (#2863) +- Use docker compose v2 and update MYSQL_DATABASE env var (#2870) +- Update getting started guides, use pgx for Postgres guide (#2891) +- Use managed databases in PostgreSQL getting started guide (#2892) +- Update managed databases doc to discuss codegen (#2897) +- Add managed dbs to CI/CD and vet guides (#2896) +- Document database-backed query analyzer (#2904) + +#### Features + +- (codegen) Support setting Go build tags (#2012) (#2807) +- (generate) Reorder codegen handlers to prefer plugins (#2814) +- (devenv) Add vscode settings.json with auto newline (#2834) +- (cmd) Support sqlc.yml configuration file (#2828) +- (analyzer) Analyze queries using a running PostgreSQL database (#2805) +- (sql/ast) Render AST to SQL (#2815) +- (codegen) Include plugin information (#2846) +- (postgresql) Add ALTER VIEW ... SET SCHEMA (#2855) +- (compiler) Parse query parameter metadata from comments (#2850) +- (postgresql) Support system columns on tables (#2871) +- (compiler) Support LEFT JOIN on aliased table (#2873) +- Improve messaging for common cloud config and rpc errors (#2885) +- Abort compiler when rpc fails as unauthenticated (#2887) +- (codegen) Add support for pgvector and pgvector-go (#2888) +- (analyzer) Cache query analysis (#2889) +- (createdb) Create ephemeral databases (#2894) +- (debug) Add databases=managed debug option (#2898) +- (config) Remove managed database validation (#2901) + +#### Miscellaneous Tasks + +- (endtoend) Fix test output for do tests (#2782) + +#### Refactor + +- (codegen) Remove golang and json settings from plugin proto (#2822) +- (codegen) Removed deprecated code and improved speed (#2899) + +#### Testing + +- (endtoend) Split shema and queries (#2803) +- Fix a few incorrect testcases (#2804) +- (analyzer) Add more database analyzer test cases (#2854) +- Add more analyzer test cases (#2866) +- Add more test cases for new analyzer (#2879) +- (endtoend) Enabled managed-db tests in CI (#2883) +- Enabled pgvector tests for managed dbs (#2893) + +#### Build + +- (deps) Bump packaging from 23.1 to 23.2 in /docs (#2791) +- (deps) Bump urllib3 from 2.0.5 to 2.0.6 in /docs (#2798) +- (deps) Bump babel from 2.12.1 to 2.13.0 in /docs (#2799) +- (deps) Bump golang.org/x/sync from 0.3.0 to 0.4.0 (#2810) +- (deps) Bump golang from 1.21.1 to 1.21.2 (#2811) +- (deps) Bump github.com/google/go-cmp from 0.5.9 to 0.6.0 (#2826) +- (deps) Bump golang from 1.21.2 to 1.21.3 (#2824) +- (deps) Bump google.golang.org/grpc from 1.58.2 to 1.58.3 (#2825) +- (deps) Bump golang.org/x/net from 0.12.0 to 0.17.0 (#2836) +- (deps) Bump urllib3 from 2.0.6 to 2.0.7 in /docs (#2872) +- (deps) Bump google.golang.org/grpc from 1.58.3 to 1.59.0 (#2876) +- (deps) Upgrade wasmtime-go from 13.0.0 to 14.0.0 (#2900) + +#### Ci + +- Bump go version in workflows (#2835) + + +(v1-22-0)= +## [1.22.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.22.0) Released 2023-09-26 ### Release notes -#### Managed databses for `sqlc vet` +#### Managed databases for `sqlc vet` If you're using [sqlc vet](../howto/vet.md) to write rules that require access to a running database, `sqlc` can now start and manage that database for you. PostgreSQL @@ -16,9 +685,8 @@ When you turn on managed databases, `sqlc` will use your schema to create a template database that it can copy to make future runs of `sqlc vet` very performant. -This feature relies on configuration obtained via sqlc Cloud. If you're interested -in early access you can [sign up here](https://docs.google.com/forms/d/e/1FAIpQLSdxoMzJ7rKkBpuez-KyBcPNyckYV-5iMR--FRB7WnhvAmEvKg/viewform) -or send us an email at [hello@sqlc.dev](mailto:hello@sqlc.dev). +This feature relies on configuration obtained via [sqlc +Cloud](https://dashboard.sqlc.dev). Read more in the [managed databases](../howto/managed-databases.md) documentation. @@ -74,7 +742,7 @@ Read more in the [managed databases](../howto/managed-databases.md) documentatio - Bump go version to latest in ci workflows (#2722) - +(v1-21-0)= ## [1.21.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.21.0) Released 2023-09-06 @@ -205,7 +873,7 @@ environment, set to the version of the `sqlc` executable invoking it. - (deps) Bump pytz from 2023.3 to 2023.3.post1 in /docs (#2695) - (devenv) Bump go from 1.20.7 to 1.21.0 (#2702) - +(v1-20-0)= ## [1.20.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.20.0) Released 2023-07-31 @@ -250,7 +918,7 @@ rules: !(postgresql.explain.plan.plans.all(p, has(p.index_name) || p.plans.all(p, has(p.index_name)))) ``` -The expression environment has two variables containing `EXPLAIN ...` output, `postgresql.explain` and `mysql.explain`. `sqlc` only populates the variable associated with your configured database engine, and only when you have a [database connection configured](../reference/config.html#database). +The expression environment has two variables containing `EXPLAIN ...` output, `postgresql.explain` and `mysql.explain`. `sqlc` only populates the variable associated with your configured database engine, and only when you have a [database connection configured](../reference/config.md#database). For the `postgresql` engine, `sqlc` runs diff --git a/docs/reference/cli.md b/docs/reference/cli.md index 427379c0f5..fc244da3ae 100644 --- a/docs/reference/cli.md +++ b/docs/reference/cli.md @@ -1,17 +1,19 @@ # CLI -``` +```sh Usage: sqlc [command] Available Commands: compile Statically check SQL for syntax and type errors completion Generate the autocompletion script for the specified shell + createdb Create an ephemeral database diff Compare the generated files to the existing files - generate Generate Go code from SQL + generate Generate source code from SQL help Help about any command init Create an empty sqlc.yaml settings file - upload Upload the schema, queries, and configuration for this project + push Push the schema, queries, and configuration for this project + verify Verify schema, queries, and configuration for this project version Print the sqlc version number vet Vet examines queries @@ -22,4 +24,4 @@ Flags: --no-remote disable remote execution (default: false) Use "sqlc [command] --help" for more information about a command. -``` \ No newline at end of file +``` diff --git a/docs/reference/config.md b/docs/reference/config.md index 3aabc90ca1..ff8bcd0890 100644 --- a/docs/reference/config.md +++ b/docs/reference/config.md @@ -1,12 +1,14 @@ # Configuration -The `sqlc` tool is configured via a `sqlc.yaml` or `sqlc.json` file. This +The `sqlc` tool is configured via a `sqlc.(yaml|yml)` or `sqlc.json` file. This file must be in the directory where the `sqlc` command is run. ## Version 2 ```yaml version: "2" +cloud: + project: "" sql: - schema: "postgresql/schema.sql" queries: "postgresql/query.sql" @@ -16,7 +18,7 @@ sql: package: "authors" out: "postgresql" database: - uri: "postgresql://postgres:postgres@localhost:5432/postgres" + managed: true rules: - sqlc/db-prepare - schema: "mysql/schema.sql" @@ -32,6 +34,8 @@ sql: Each mapping in the `sql` collection has the following keys: +- `name`: + - An human-friendly identifier for this query set. Optional. - `engine`: - One of `postgresql`, `mysql` or `sqlite`. - `schema`: @@ -46,8 +50,12 @@ Each mapping in the `sql` collection has the following keys: - A mapping to configure database connections. See [database](#database) for the supported keys. - `rules`: - A collection of rule names to run via `sqlc vet`. See [rules](#rules) for configuration options. +- `analyzer`: + - A mapping to configure query analysis. See [analyzer](#analyzer) for the supported keys. - `strict_function_checks` - If true, return an error if a called SQL function does not exist. Defaults to `false`. +- `strict_order_by` + - If true, return an error if a order by column is ambiguous. Defaults to `true`. ### codegen @@ -85,6 +93,8 @@ sql: The `database` mapping supports the following keys: +- `managed`: + - If true, connect to a [managed database](../howto/managed-databases.md). Defaults to `false`. - `uri`: - Database connection URI @@ -105,7 +115,14 @@ sql: package: authors out: postgresql ``` - + +### analyzer + +The `analyzer` mapping supports the following keys: + +- `database`: + - If false, do not use the configured database for query analysis. Defaults to `true`. + ### gen The `gen` mapping supports the following keys: @@ -118,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`: @@ -139,13 +158,19 @@ The `gen` mapping supports the following keys: - `emit_methods_with_db_argument`: - If true, generated methods will accept a DBTX argument instead of storing a DBTX on the `*Queries` struct. Defaults to `false`. - `emit_pointers_for_null_types`: - - If true and `sql_package` is set to `pgx/v4` or `pgx/v5`, generated types for nullable columns are emitted as pointers (ie. `*string`) instead of `database/sql` null types (ie. `NullString`). Defaults to `false`. + - If true, generated types for nullable columns are emitted as pointers (ie. `*string`) instead of `database/sql` null types (ie. `NullString`). Currently only supported for PostgreSQL if `sql_package` is `pgx/v4` or `pgx/v5`, and for SQLite. Defaults to `false`. - `emit_enum_valid_method`: - If true, generate a Valid method on enum types, indicating whether a string is a valid enum value. - `emit_all_enum_values`: - If true, emit a function per enum type that returns all valid enum values. +- `emit_sql_as_comment`: + - If true, emits the SQL statement as a code-block comment above the generated function, appending to any existing comments. Defaults to `false`. +- `build_tags`: + - If set, add a `//go:build ` directive at the beginning of each generated Go file. +- `initialisms`: + - An array of [initialisms](https://google.github.io/styleguide/go/decisions.html#initialisms) to upper-case. For example, `app_id` becomes `AppID`. Defaults to `["id"]`. - `json_tags_id_uppercase`: - If true, "Id" in json tags will be uppercase. If false, will be camelcase. Defaults to `false` - `json_tags_case_style`: @@ -169,36 +194,11 @@ The `gen` mapping supports the following keys: - `rename`: - Customize the name of generated struct fields. See [Renaming fields](../howto/rename.md) for usage information. - `overrides`: - - It is a collection of definitions that dictates which types are used to map a database types. - -##### `overrides` - -See [Overriding types](../howto/overrides.md) for in-depth guide to using type overrides. Each mapping of the `overrides` collection has the following keys: + - A collection of configurations to override sqlc's default Go type choices. See [Overriding types](../howto/overrides.md) for usage information. -- `db_type`: - - The PostgreSQL or MySQL type to override. Find the full list of supported types in [postgresql_type.go](https://github.com/sqlc-dev/sqlc/blob/main/internal/codegen/golang/postgresql_type.go#L12) or [mysql_type.go](https://github.com/sqlc-dev/sqlc/blob/main/internal/codegen/golang/mysql_type.go#L12). Note that for Postgres you must use the pg_catalog prefixed names where available. Can't be used if the `column` key is defined. -- `column`: - - In case the type overriding should be done on specific a column of a table instead of a type. `column` should be of the form `table.column` but you can be even more specific by specifying `schema.table.column` or `catalog.schema.table.column`. Can't be used if the `db_type` key is defined. -- `go_type`: - - A fully qualified name to a Go type to use in the generated code. -- `go_struct_tag`: - - A reflect-style struct tag to use in the generated code, e.g. `a:"b" x:"y,z"`. - If you want general json/db tags for all fields, use `emit_db_tags` and/or `emit_json_tags` instead. -- `nullable`: - - If `true`, use this type when a column is nullable. Defaults to `false`. +##### overrides -For more complicated import paths, the `go_type` can also be an object with the following keys: - -- `import`: - - The import path for the package where the type is defined. -- `package`: - - The package name where the type is defined. This should only be necessary when your import path doesn't end with the desired package name. -- `type`: - - The type name itself, without any package prefix. -- `pointer`: - - If set to `true`, generated code will use pointers to the type rather than the type itself. -- `slice`: - - If set to `true`, generated code will use a slice of the type rather than the type itself. +See [Overriding types](../howto/overrides.md) for an in-depth guide to using type overrides. #### kotlin @@ -248,6 +248,8 @@ Each mapping in the `plugins` collection has the following keys: - `process`: A mapping with a single `cmd` key - `cmd`: - The executable to call when using this plugin + - `format`: + - The format expected. Supports `json` and `protobuf` formats. Defaults to `protobuf`. - `wasm`: A mapping with a two keys `url` and `sha256` - `url`: - The URL to fetch the WASM file. Supports the `https://` or `file://` schemes. @@ -316,7 +318,7 @@ rules: query.cmd == "exec" ``` -### global overrides +### Global overrides Sometimes, the same configuration must be done across various specifications of code generation. Then a global definition for type overriding and field @@ -329,7 +331,7 @@ overrides: rename: id: "Identifier" overrides: - - db_type: "timestamptz" + - db_type: "pg_catalog.timestamptz" nullable: true engine: "postgresql" go_type: @@ -341,7 +343,7 @@ sql: queries: "postgresql/query.sql" engine: "postgresql" gen: - go: + go: package: "authors" out: "postgresql" - schema: "mysql/schema.sql" @@ -389,6 +391,7 @@ packages: emit_pointers_for_null_types: false emit_enum_valid_method: false emit_all_enum_values: false + build_tags: "some_tag" json_tags_case_style: "camel" omit_unused_structs: false output_batch_file_name: "batch.go" @@ -415,6 +418,8 @@ Each mapping in the `packages` collection has the following keys: - Either `postgresql` or `mysql`. Defaults to `postgresql`. - `sql_package`: - Either `pgx/v4`, `pgx/v5` or `database/sql`. Defaults to `database/sql`. +- `overrides`: + - A list of type override configurations. See the [Overriding types](../howto/overrides.md) guide for details. - `emit_db_tags`: - If true, add DB tags to generated structs. Defaults to `false`. - `emit_prepared_queries`: @@ -443,6 +448,8 @@ Each mapping in the `packages` collection has the following keys: - `emit_all_enum_values`: - If true, emit a function per enum type that returns all valid enum values. +- `build_tags`: + - If set, add a `//go:build ` directive at the beginning of each generated Go file. - `json_tags_case_style`: - `camel` for camelCase, `pascal` for PascalCase, `snake` for snake_case or `none` to use the column name in the DB. Defaults to `none`. - `omit_unused_structs`: @@ -464,78 +471,7 @@ Each mapping in the `packages` collection has the following keys: ### overrides -The default mapping of PostgreSQL/MySQL types to Go types only uses packages outside -the standard library when it must. - -For example, the `uuid` PostgreSQL type is mapped to `github.com/google/uuid`. -If a different Go package for UUIDs is required, specify the package in the -`overrides` array. In this case, I'm going to use the `github.com/gofrs/uuid` -instead. - -```yaml -version: "1" -packages: [...] -overrides: - - go_type: "github.com/gofrs/uuid.UUID" - db_type: "uuid" -``` - -Each override document has the following keys: - -- `db_type`: - - The PostgreSQL or MySQL type to override. Find the full list of supported types in [postgresql_type.go](https://github.com/sqlc-dev/sqlc/blob/main/internal/codegen/golang/postgresql_type.go#L12) or [mysql_type.go](https://github.com/sqlc-dev/sqlc/blob/main/internal/codegen/golang/mysql_type.go#L12). Note that for Postgres you must use the pg_catalog prefixed names where available. -- `go_type`: - - A fully qualified name to a Go type to use in the generated code. -- `go_struct_tag`: - - A reflect-style struct tag to use in the generated code, e.g. `a:"b" x:"y,z"`. - If you want general json/db tags for all fields, use `emit_db_tags` and/or `emit_json_tags` instead. -- `nullable`: - - If true, use this type when a column is nullable. Defaults to `false`. - -Note that a single `db_type` override configuration applies to either nullable or non-nullable -columns, but not both. If you want a single `go_type` to override in both cases, you'll -need to specify two overrides. - -For more complicated import paths, the `go_type` can also be an object. - -```yaml -version: "1" -packages: [...] -overrides: - - db_type: "uuid" - go_type: - import: "a/b/v2" - package: "b" - type: "MyType" -``` - -#### Per-Column Type Overrides - -Sometimes you would like to override the Go type used in model or query generation for -a specific field of a table and not on a type basis as described in the previous section. - -This may be configured by specifying the `column` property in the override definition. `column` -should be of the form `table.column` but you can be even more specific by specifying `schema.table.column` -or `catalog.schema.table.column`. - -```yaml -version: "1" -packages: [...] -overrides: - - column: "authors.id" - go_type: "github.com/segmentio/ksuid.KSUID" -``` - -#### Package Level Overrides - -Overrides can be configured globally, as demonstrated in the previous sections, or they can be configured per-package which -scopes the override behavior to just a single package: - -```yaml -version: "1" -packages: - - overrides: [...] -``` +See the version 1 configuration section of the [Overriding types](../howto/overrides.md#version-1-configuration) guide for details. ### rename diff --git a/docs/reference/datatypes.md b/docs/reference/datatypes.md index 4dee0fae92..14ceb42a3f 100644 --- a/docs/reference/datatypes.md +++ b/docs/reference/datatypes.md @@ -4,7 +4,7 @@ database types to Go types. Choices for more complex types are described below. If you're unsatisfied with the default, you can override any type using the -[overrides list](config.html#type-overriding) in your `sqlc` config file. +[overrides list](config.md#overrides) in your `sqlc` config file. ## Arrays @@ -27,12 +27,16 @@ type Place struct { } ``` -## Dates and Time +## Dates and times -All PostgreSQL time and date types are returned as `time.Time` structs. For +All date and time types are returned as `time.Time` structs. For null time or date values, the `NullTime` type from `database/sql` is used. + The `pgx/v5` sql package uses the appropriate pgx types. +For MySQL users relying on `github.com/go-sql-driver/mysql`, ensure that +`parseTime=true` is added to your database connection string. + ```sql CREATE TABLE authors ( id SERIAL PRIMARY KEY, @@ -58,7 +62,7 @@ type Author struct { ## Enums -PostgreSQL [enums](https://www.postgresql.org/docs/current/arrays.html) are +PostgreSQL [enums](https://www.postgresql.org/docs/current/datatype-enum.html) are mapped to an aliased string type. ```sql @@ -139,7 +143,9 @@ type Author struct { } ``` -For MySQL, there is no native `uuid` data type. When using `UUID_TO_BIN` to store a `UUID()`, the underlying field type is `BINARY(16)` which by default sqlc would interpret this to `sql.NullString`. To have sqlc automatically convert these fields to a `uuid.UUID` type, use an overide on the column storing the `uuid`. +For MySQL, there is no native `uuid` data type. When using `UUID_TO_BIN` to store a `UUID()`, the underlying field type is `BINARY(16)` which by default sqlc would map to `sql.NullString`. To have sqlc automatically convert these fields to a `uuid.UUID` type, use an overide on the column storing the `uuid` +(see [Overriding types](../howto/overrides.md) for details). + ```json { "overrides": [ @@ -154,8 +160,9 @@ 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 the default type +(see [Overriding types](../howto/overrides.md) for details). +The `pgx` implementation will marshal/unmarshal the struct automatically. ```go package dto @@ -179,9 +186,10 @@ CREATE TABLE books ( { "column": "books.data", "go_type": { - "import":"example/db", + "import":"example.com/db", "package": "dto", - "type":"BookData" + "type":"BookData", + "pointer": true } } ] @@ -200,12 +208,83 @@ type Book struct { } ``` +## TEXT + +In PostgreSQL, when you have a column with the TEXT type, sqlc will map it to a Go string by default. This default mapping applies to `TEXT` columns that are not nullable. However, for nullable `TEXT` columns, sqlc maps them to `pgtype.Text` when using the pgx/v5 driver. This distinction is crucial for developers looking to handle null values appropriately in their Go applications. + +To accommodate nullable strings and map them to `*string` in Go, you can use the `emit_pointers_for_null_types` option in your sqlc configuration. This option ensures that nullable SQL columns are represented as pointer types in Go, allowing for a clear distinction between null and non-null values. Another way to do this is by passing the option `pointer: true` when you are overriding the `TEXT` datatype in your sqlc config file (see [Overriding types](../howto/overrides.md) for details). + ## Geometry ### PostGIS +#### Using `github.com/twpayne/go-geos` (pgx/v5 only) + +sqlc can be configured to use the [geos](https://github.com/twpayne/go-geos) +package for working with PostGIS geometry types in [GEOS](https://libgeos.org/). + +There are three steps: + +1. Configure sqlc to use `*github.com/twpayne/go-geos.Geom` for geometry types (see [Overriding types](../howto/overrides.md) for details). +2. Call `github.com/twpayne/pgx-geos.Register` on each + `*github.com/jackc/pgx/v5.Conn`. +3. Annotate your SQL with `::geometry` typecasts, if needed. + +```sql +-- Multipolygons in British National Grid (epsg:27700) +create table shapes( + id serial, + name varchar, + geom geometry(Multipolygon, 27700) +); + +-- name: GetCentroids :many +SELECT id, name, ST_Centroid(geom)::geometry FROM shapes; +``` + +```json +{ + "version": 2, + "gen": { + "go": { + "overrides": [ + { + "db_type": "geometry", + "go_type": { + "import": "github.com/twpayne/go-geos", + "package": "geos", + "pointer": true, + "type": "Geom" + }, + "nullable": true + } + ] + } + } +} +``` + +```go +import ( + "github.com/twpayne/go-geos" + pgxgeos "github.com/twpayne/pgx-geos" +) + +// ... + +config.AfterConnect = func(ctx context.Context, conn *pgx.Conn) error { + if err := pgxgeos.Register(ctx, conn, geos.NewContext()); err != nil { + return err + } + return nil +} +``` + + +#### Using `github.com/twpayne/go-geom` + sqlc can be configured to use the [geom](https://github.com/twpayne/go-geom) -package for working with PostGIS geometry types. +package for working with PostGIS geometry types. See [Overriding types](../howto/overrides.md) for more information. ```sql -- Multipolygons in British National Grid (epsg:27700) @@ -234,12 +313,12 @@ SELECT * FROM shapes; { "db_type": "geometry", "go_type": "github.com/twpayne/go-geom.MultiPolygon" - }, - { + }, + { "db_type": "geometry", - "go_type": "github.com/twpayne/go-geom.MultiPolygon", - "null": true - } + "go_type": "github.com/twpayne/go-geom.MultiPolygon", + "nullable": true + } ] } -``` \ No newline at end of file +``` diff --git a/docs/reference/language-support.rst b/docs/reference/language-support.rst index 37a4e192b6..d6532ba543 100644 --- a/docs/reference/language-support.rst +++ b/docs/reference/language-support.rst @@ -1,29 +1,51 @@ Database and language support ############################# -======== =================== ============ ============ =============== -Language Plugin MySQL PostgreSQL SQLite -======== =================== ============ ============ =============== -Go (built-in) Stable Stable Beta -Kotlin `sqlc-gen-kotlin`_ Beta Beta Not implemented -Python `sqlc-gen-python`_ Beta Beta Not implemented -======== =================== ============ ============ =============== +========== ======================= ============ ============ =============== +Language Plugin MySQL PostgreSQL SQLite +========== ======================= ============ ============ =============== +Go (built-in) Stable Stable Beta +Go `sqlc-gen-go`_ Stable Stable Beta +Kotlin `sqlc-gen-kotlin`_ Beta Beta Not implemented +Python `sqlc-gen-python`_ Beta Beta Not implemented +TypeScript `sqlc-gen-typescript`_ Beta Beta Not implemented +========== ======================= ============ ============ =============== Community language support ************************** -======== ============================== =============== ============ =============== -Language Plugin MySQL PostgreSQL SQLite -======== ============================== =============== ============ =============== -F# `kaashyapan/sqlc-gen-fsharp`_ Not implemented Beta Beta -======== ============================== =============== ============ =============== +New languages can be added via :doc:`plugins <../guides/plugins>`. +======== ================================= =============== =============== =============== +Language Plugin MySQL PostgreSQL SQLite +======== ================================= =============== =============== =============== +C# `DaredevilOSS/sqlc-gen-csharp`_ Stable Stable Stable +F# `kaashyapan/sqlc-gen-fsharp`_ N/A Beta Beta +Java `tandemdude/sqlc-gen-java`_ Beta Beta N/A +PHP `lcarilla/sqlc-plugin-php-dbal`_ Beta N/A N/A +Ruby `DaredevilOSS/sqlc-gen-ruby`_ Beta Beta Beta +Zig `tinyzimmer/sqlc-gen-zig`_ N/A Beta Beta +[Any] `fdietze/sqlc-gen-from-template`_ Stable Stable Stable +======== ================================= =============== =============== =============== + +Community projects +****************** + +======== ================================= =============== =============== =============== +Language Project MySQL PostgreSQL SQLite +======== ================================= =============== =============== =============== +Gleam `daniellionel01/parrot`_ Stable Stable Stable +======== ================================= =============== =============== =============== + +.. _sqlc-gen-go: https://github.com/sqlc-dev/sqlc-gen-go .. _kaashyapan/sqlc-gen-fsharp: https://github.com/kaashyapan/sqlc-gen-fsharp .. _sqlc-gen-kotlin: https://github.com/sqlc-dev/sqlc-gen-kotlin .. _sqlc-gen-python: https://github.com/sqlc-dev/sqlc-gen-python - -Future language support -************************ - -- `C# `_ -- `TypeScript `_ +.. _sqlc-gen-typescript: https://github.com/sqlc-dev/sqlc-gen-typescript +.. _DaredevilOSS/sqlc-gen-csharp: https://github.com/DaredevilOSS/sqlc-gen-csharp +.. _DaredevilOSS/sqlc-gen-ruby: https://github.com/DaredevilOSS/sqlc-gen-ruby +.. _fdietze/sqlc-gen-from-template: https://github.com/fdietze/sqlc-gen-from-template +.. _lcarilla/sqlc-plugin-php-dbal: https://github.com/lcarilla/sqlc-plugin-php-dbal +.. _tandemdude/sqlc-gen-java: https://github.com/tandemdude/sqlc-gen-java +.. _tinyzimmer/sqlc-gen-zig: https://github.com/tinyzimmer/sqlc-gen-zig +.. _daniellionel01/parrot: https://github.com/daniellionel01/parrot diff --git a/docs/reference/macros.md b/docs/reference/macros.md index 7c8bc67842..36c7c92420 100644 --- a/docs/reference/macros.md +++ b/docs/reference/macros.md @@ -116,4 +116,4 @@ Since the `/*SLICE:ages*/` placeholder is dynamically replaced on a per-query basis, this macro can't be used with prepared statements. See a full example in [Passing a slice as a parameter to a -query](../howto/select.html#mysql-and-sqlite). \ No newline at end of file +query](../howto/select.md#mysql-and-sqlite). diff --git a/docs/reference/query-annotations.md b/docs/reference/query-annotations.md index 0045f49fa7..4fabe05aae 100644 --- a/docs/reference/query-annotations.md +++ b/docs/reference/query-annotations.md @@ -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. diff --git a/docs/requirements.txt b/docs/requirements.txt index 215c2c144f..46685ac9b3 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,27 +1,27 @@ -alabaster==0.7.13 -Babel==2.12.1 -certifi==2023.7.22 +Babel==2.17.0 +Jinja2==3.1.6 +MarkupSafe==3.0.2 +Pygments==2.19.2 +Sphinx==7.4.7 +certifi==2025.8.3 chardet==5.2.0 commonmark==0.9.1 -docutils==0.18.1 -idna==3.4 +docutils==0.20.1 +idna==3.10 imagesize==1.4.1 -Jinja2==3.1.2 -MarkupSafe==2.1.3 -packaging==23.1 -Pygments==2.16.1 -pyparsing==3.1.1 -pytz==2023.3.post1 -recommonmark==0.7.1 -requests==2.31.0 -snowballstemmer==2.2.0 -Sphinx==6.2.1 +myst-parser==4.0.1 +packaging==25.0 +pyparsing==3.2.3 +pytz==2025.2 +requests==2.32.5 +snowballstemmer==3.0.1 sphinx-favicon==1.0.1 -sphinx-rtd-theme==1.3.0 -sphinxcontrib-applehelp==1.0.7 -sphinxcontrib-devhelp==1.0.5 -sphinxcontrib-serializinghtml==1.1.9 -sphinxcontrib-htmlhelp==2.0.4 +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==1.0.6 -urllib3==2.0.5 +sphinxcontrib-qthelp==2.0.0 +sphinxcontrib-serializinghtml==2.0.0 +sphinxext-rediraffe==0.2.7 +urllib3==2.5.0 diff --git a/docs/tutorials/getting-started-mysql.md b/docs/tutorials/getting-started-mysql.md index 2f86a7bd39..1c436e7e6a 100644 --- a/docs/tutorials/getting-started-mysql.md +++ b/docs/tutorials/getting-started-mysql.md @@ -3,20 +3,29 @@ This tutorial assumes that the latest version of sqlc is [installed](../overview/install.md) and ready to use. +We'll generate Go code here, but other +[language plugins](../reference/language-support.rst) are available. You'll +naturally need the Go toolchain if you want to build and run a program with the +code sqlc generates, but sqlc itself has no dependencies. + +At the end, you'll push your SQL queries to [sqlc Cloud](https://dashboard.sqlc.dev/) for further insights and analysis. + +## Setting up + Create a new directory called `sqlc-tutorial` and open it up. -Initialize a new Go module named `tutorial.sql.dev/app` +Initialize a new Go module named `tutorial.sqlc.dev/app` ```shell go mod init tutorial.sqlc.dev/app ``` -sqlc looks for either a `sqlc.yaml` or `sqlc.json` file in the current +sqlc looks for either a `sqlc.(yaml|yml)` or `sqlc.json` file in the current directory. In our new directory, create a file named `sqlc.yaml` with the following contents: ```yaml -version: 2 +version: "2" sql: - engine: "mysql" queries: "query.sql" @@ -27,8 +36,11 @@ sql: out: "tutorial" ``` -sqlc needs to know your database schema and queries. In the same directory, -create a file named `schema.sql` with the following contents: +## Schema and queries + +sqlc needs to know your database schema and queries in order to generate code. +In the same directory, create a file named `schema.sql` with the following +content: ```sql CREATE TABLE authors ( @@ -61,13 +73,17 @@ DELETE FROM authors WHERE id = ?; ``` -You are now ready to generate code. Run the `generate` command. You shouldn't see any errors or output. +## Generating code + +You are now ready to generate code. You shouldn't see any output when you run +the `generate` subcommand, unless something goes wrong: ```shell sqlc generate ``` -You should now have a `tutorial` package containing three files. +You should now have a `tutorial` subdirectory with three files containing Go +source code. These files comprise a Go package named `tutorial`: ``` ├── go.mod @@ -80,7 +96,10 @@ You should now have a `tutorial` package containing three files. └── query.sql.go ``` -You can use your newly generated queries in `app.go`. +## Using generated code + +You can use your newly-generated `tutorial` package from any Go program. +Create a file named `tutorial.go` and add the following contents: ```go package main @@ -91,9 +110,9 @@ import ( "log" "reflect" - "tutorial.sqlc.dev/app/tutorial" - _ "github.com/go-sql-driver/mysql" + + "tutorial.sqlc.dev/app/tutorial" ) func run() error { @@ -146,17 +165,57 @@ func main() { } ``` -Before the code will compile, you'll need to add the Go MySQL driver. +Before this code will compile you'll need to fetch the relevant MySQL driver: -``` +```shell go get github.com/go-sql-driver/mysql go build ./... ``` -To make that possible, sqlc generates readable, **idiomatic** Go code that you -otherwise would have had to write yourself. Take a look in `tutorial/query.sql.go`. +The program should compile without errors. To make that possible, sqlc generates +readable, **idiomatic** Go code that you otherwise would've had to write +yourself. Take a look in `tutorial/query.sql.go`. + +Of course for this program to run successfully you'll need +to compile after replacing the database connection parameters in the call to +`sql.Open()` with the correct parameters for your database. And your +database must have the `authors` table as defined in `schema.sql`. + +You should now have a working program using sqlc's generated Go source code, +and hopefully can see how you'd use sqlc in your own real-world applications. -If your tables have columns with date or time types, sqlc expects these values -to scan into `time.Time` structs. If you're using -`github.com/go-sql-driver/mysql`, ensure that `parseTime=true` has been added to -the connection string. +## Query verification + +[sqlc Cloud](https://dashboard.sqlc.dev) provides additional verification, catching subtle bugs. To get started, create a +[dashboard account](https://dashboard.sqlc.dev). Once you've signed in, create a +project and generate an auth token. Add your project's ID to the `cloud` block +to your sqlc.yaml. + + +```yaml +version: "2" +cloud: + # Replace with your project ID from the sqlc Cloud dashboard + project: "" +sql: + - engine: "mysql" + queries: "query.sql" + schema: "schema.sql" + gen: + go: + package: "tutorial" + out: "tutorial" +``` + +Replace `` with your project ID from the sqlc Cloud dashboard. It +will look something like `01HA8SZH31HKYE9RR3N3N3TSJM`. + +And finally, set the `SQLC_AUTH_TOKEN` environment variable: + +```shell +export SQLC_AUTH_TOKEN="" +``` + +```shell +$ sqlc push --tag tutorial +``` diff --git a/docs/tutorials/getting-started-postgresql.md b/docs/tutorials/getting-started-postgresql.md index bc761be004..a98c32ff37 100644 --- a/docs/tutorials/getting-started-postgresql.md +++ b/docs/tutorials/getting-started-postgresql.md @@ -1,17 +1,27 @@ -# Getting started with PostgreSQL +# Getting started with PostgreSQL This tutorial assumes that the latest version of sqlc is [installed](../overview/install.md) and ready to use. +We'll generate Go code here, but other +[language plugins](../reference/language-support.rst) are available. You'll +naturally need the Go toolchain if you want to build and run a program with the +code sqlc generates, but sqlc itself has no dependencies. + +At the end, you'll push your SQL queries to [sqlc +Cloud](https://dashboard.sqlc.dev/) for further insights and analysis. + +## Setting up + Create a new directory called `sqlc-tutorial` and open it up. -Initialize a new Go module named `tutorial.sqlc.dev/app` +Initialize a new Go module named `tutorial.sqlc.dev/app`: ```shell go mod init tutorial.sqlc.dev/app ``` -sqlc looks for either a `sqlc.yaml` or `sqlc.json` file in the current +sqlc looks for either a `sqlc.(yaml|yml)` or `sqlc.json` file in the current directory. In our new directory, create a file named `sqlc.yaml` with the following contents: @@ -25,8 +35,11 @@ sql: go: package: "tutorial" out: "tutorial" + sql_package: "pgx/v5" ``` +## Schema and queries + sqlc needs to know your database schema and queries in order to generate code. In the same directory, create a file named `schema.sql` with the following content: @@ -39,7 +52,7 @@ CREATE TABLE authors ( ); ``` -Next, create a `query.sql` file with the following four queries: +Next, create a `query.sql` file with the following five queries: ```sql -- name: GetAuthor :one @@ -58,23 +71,19 @@ INSERT INTO authors ( ) RETURNING *; --- name: DeleteAuthor :exec -DELETE FROM authors -WHERE id = $1; -``` - -If you **do not** want your SQL `UPDATE` queries to return the updated record -to the user, add this to `query.sql`: - -```sql -- name: UpdateAuthor :exec UPDATE authors set name = $2, bio = $3 WHERE id = $1; + +-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = $1; ``` -Otherwise, to return the updated record to the user, add this to `query.sql`: +If you prefer, you can alter the `UpdateAuthor` query to return the updated +record: ```sql -- name: UpdateAuthor :one @@ -85,13 +94,17 @@ WHERE id = $1 RETURNING *; ``` -You are now ready to generate code. You shouldn't see any errors or output. +## Generating code + +You are now ready to generate code. You shouldn't see any output when you run +the `generate` subcommand, unless something goes wrong: ```shell sqlc generate ``` -You should now have a `tutorial` package containing three files. +You should now have a `tutorial` subdirectory with three files containing Go +source code. These files comprise a Go package named `tutorial`: ``` ├── go.mod @@ -104,31 +117,35 @@ You should now have a `tutorial` package containing three files. └── query.sql.go ``` -You can use your newly generated queries in `app.go`. +## Using generated code + +You can use your newly-generated `tutorial` package from any Go program. +Create a file named `tutorial.go` and add the following contents: ```go package main import ( "context" - "database/sql" "log" "reflect" - "tutorial.sqlc.dev/app/tutorial" + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgtype" - _ "github.com/lib/pq" + "tutorial.sqlc.dev/app/tutorial" ) func run() error { ctx := context.Background() - db, err := sql.Open("postgres", "user=pqgotest dbname=pqgotest sslmode=verify-full") + conn, err := pgx.Connect(ctx, "user=pqgotest dbname=pqgotest sslmode=verify-full") if err != nil { return err } + defer conn.Close(ctx) - queries := tutorial.New(db) + queries := tutorial.New(conn) // list all authors authors, err := queries.ListAuthors(ctx) @@ -140,7 +157,7 @@ func run() error { // create an author insertedAuthor, err := queries.CreateAuthor(ctx, tutorial.CreateAuthorParams{ Name: "Brian Kernighan", - Bio: sql.NullString{String: "Co-author of The C Programming Language and The Go Programming Language", Valid: true}, + Bio: pgtype.Text{String: "Co-author of The C Programming Language and The Go Programming Language", Valid: true}, }) if err != nil { return err @@ -165,13 +182,67 @@ func main() { } ``` -Before the code will compile, you'll need to add the Go PostgreSQL driver. +Before this code will compile you'll need to fetch the relevant PostgreSQL +driver. You can use `lib/pq` with the standard library's `database/sql` +package, but in this tutorial we've used `pgx/v5`: -``` -go get github.com/lib/pq +```shell +go get github.com/jackc/pgx/v5 go build ./... ``` -sqlc generates readable, **idiomatic** Go code that you otherwise would have -had to write yourself. Take a look in the `tutorial` package to see what code -sqlc generated. +The program should compile without errors. To make that possible, sqlc generates +readable, **idiomatic** Go code that you otherwise would've had to write +yourself. Take a look in `tutorial/query.sql.go`. + +Of course for this program to run successfully you'll need +to compile after replacing the database connection parameters in the call to +`pgx.Connect()` with the correct parameters for your database. And your +database must have the `authors` table as defined in `schema.sql`. + +You should now have a working program using sqlc's generated Go source code, +and hopefully can see how you'd use sqlc in your own real-world applications. + +## Query verification + +[sqlc Cloud](https://dashboard.sqlc.dev) provides additional verification, catching subtle bugs. To get started, create a +[dashboard account](https://dashboard.sqlc.dev). Once you've signed in, create a +project and generate an auth token. Add your project's ID to the `cloud` block +to your sqlc.yaml. + +```yaml +version: "2" +cloud: + # Replace with your project ID from the sqlc Cloud dashboard + project: "" +sql: + - engine: "postgresql" + queries: "query.sql" + schema: "schema.sql" + gen: + go: + package: "tutorial" + out: "tutorial" + sql_package: "pgx/v5" +``` + +Replace `` with your project ID from the sqlc Cloud dashboard. It +will look something like `01HA8SZH31HKYE9RR3N3N3TSJM`. + +And finally, set the `SQLC_AUTH_TOKEN` environment variable: + +```shell +export SQLC_AUTH_TOKEN="" +``` + +```shell +$ sqlc push --tag tutorial +``` + +In the sidebar, go to the "Queries" section to see your published queries. Run +`verify` to ensure that previously published queries continue to work against +updated database schema. + +```shell +$ sqlc verify --against tutorial +``` diff --git a/docs/tutorials/getting-started-sqlite.md b/docs/tutorials/getting-started-sqlite.md index 96bb693e23..b3c2a570df 100644 --- a/docs/tutorials/getting-started-sqlite.md +++ b/docs/tutorials/getting-started-sqlite.md @@ -3,32 +3,42 @@ This tutorial assumes that the latest version of sqlc is [installed](../overview/install.md) and ready to use. +We'll generate Go code here, but other +[language plugins](../reference/language-support.rst) are available. You'll +naturally need the Go toolchain if you want to build and run a program with the +code sqlc generates, but sqlc itself has no dependencies. + +## Setting up + Create a new directory called `sqlc-tutorial` and open it up. -Initialize a new Go module named `tutorial.sql.dev/app` +Initialize a new Go module named `tutorial.sqlc.dev/app` ```shell go mod init tutorial.sqlc.dev/app ``` -sqlc looks for either a `sqlc.yaml` or `sqlc.json` file in the current +sqlc looks for either a `sqlc.(yaml|yml)` or `sqlc.json` file in the current directory. In our new directory, create a file named `sqlc.yaml` with the following contents: ```yaml -version: 2 +version: "2" sql: - engine: "sqlite" - schema: "schema.sql" queries: "query.sql" + schema: "schema.sql" gen: go: package: "tutorial" out: "tutorial" ``` -sqlc needs to know your database schema and queries. In the same directory, -create a file named `schema.sql` with the following contents: +## Schema and queries + +sqlc needs to know your database schema and queries in order to generate code. +In the same directory, create a file named `schema.sql` with the following +content: ```sql CREATE TABLE authors ( @@ -38,7 +48,7 @@ CREATE TABLE authors ( ); ``` -Next, create a `query.sql` file with the following four queries: +Next, create a `query.sql` file with the following five queries: ```sql -- name: GetAuthor :one @@ -57,22 +67,19 @@ INSERT INTO authors ( ) RETURNING *; --- name: DeleteAuthor :exec -DELETE FROM authors -WHERE id = ?; -``` - -For SQL UPDATE if you do not want to return the updated record to the user, add this to the `query.sql` file: - -```sql -- name: UpdateAuthor :exec UPDATE authors set name = ?, bio = ? WHERE id = ?; + +-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = ?; ``` -Otherwise, to return the updated record back to the user, add this to the `query.sql` file: +If you prefer, you can alter the `UpdateAuthor` query to return the updated +record: ```sql -- name: UpdateAuthor :one @@ -83,13 +90,17 @@ WHERE id = ? RETURNING *; ``` -You are now ready to generate code. Run the `generate` command. You shouldn't see any errors or output. +## Generating code + +You are now ready to generate code. You shouldn't see any output when you run +the `generate` subcommand, unless something goes wrong: ```shell sqlc generate ``` -You should now have a `tutorial` package containing three files. +You should now have a `tutorial` subdirectory with three files containing Go +source code. These files comprise a Go package named `tutorial`: ``` ├── go.mod @@ -102,7 +113,10 @@ You should now have a `tutorial` package containing three files. └── query.sql.go ``` -You can use your newly generated queries in `app.go`. +## Using generated code + +You can use your newly-generated `tutorial` package from any Go program. +Create a file named `tutorial.go` and add the following contents: ```go package main @@ -110,14 +124,13 @@ package main import ( "context" "database/sql" + _ "embed" "log" "reflect" - "tutorial.sqlc.dev/app/tutorial" + _ "modernc.org/sqlite" - _ "embed" - - _ "github.com/mattn/go-sqlite3" + "tutorial.sqlc.dev/app/tutorial" ) //go:embed schema.sql @@ -126,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 } @@ -173,12 +186,16 @@ func main() { } ``` -Before the code will compile, you'll need to add the Go SQLite driver. +Before this code will compile you'll need to fetch the relevant SQLite driver: -``` -go mod tidy +```shell +go get modernc.org/sqlite go build ./... ``` -To make that possible, sqlc generates readable, **idiomatic** Go code that you -otherwise would have had to write yourself. Take a look in `tutorial/query.sql.go`. +The program should compile without errors, and run successfully. To make that +possible, sqlc generates readable, **idiomatic** Go code that you +otherwise would've had to write yourself. Take a look in `tutorial/query.sql.go`. + +You should now have a working program using sqlc's generated Go source code, +and hopefully can see how you'd use sqlc in your own real-world applications. diff --git a/equinox.pub b/equinox.pub deleted file mode 100644 index f5a0c7e18c..0000000000 --- a/equinox.pub +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN ECDSA PUBLIC KEY----- -MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEDhl+JQVqmY5ZmFMyVDmuEOpr1ufM1SaH -3k/+e5eSvl6yMqTRkdt1i2X0zYJfOde/ho6DZ9CeGjscy4/CR5bhxAWPxggbjErf -Ta40WM9gdZI81uX8O5ES2DYYblQAiVRL ------END ECDSA PUBLIC KEY----- diff --git a/examples/authors/mysql/db.go b/examples/authors/mysql/db.go index f5d9de7305..fc409f7e3f 100644 --- a/examples/authors/mysql/db.go +++ b/examples/authors/mysql/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package authors diff --git a/examples/authors/mysql/db_test.go b/examples/authors/mysql/db_test.go index 26f3035b34..96ec363f77 100644 --- a/examples/authors/mysql/db_test.go +++ b/examples/authors/mysql/db_test.go @@ -1,5 +1,4 @@ //go:build examples -// +build examples package authors @@ -8,14 +7,20 @@ import ( "database/sql" "testing" - "github.com/sqlc-dev/sqlc/internal/sqltest" + _ "github.com/go-sql-driver/mysql" + + "github.com/sqlc-dev/sqlc/internal/sqltest/local" ) func TestAuthors(t *testing.T) { - sdb, cleanup := sqltest.MySQL(t, []string{"schema.sql"}) - defer cleanup() - ctx := context.Background() + uri := local.MySQL(t, []string{"schema.sql"}) + sdb, err := sql.Open("mysql", uri) + if err != nil { + t.Fatal(err) + } + defer sdb.Close() + db := New(sdb) // list all authors diff --git a/examples/authors/mysql/models.go b/examples/authors/mysql/models.go index ec61702f5a..24e47df1ef 100644 --- a/examples/authors/mysql/models.go +++ b/examples/authors/mysql/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package authors diff --git a/examples/authors/mysql/query.sql.go b/examples/authors/mysql/query.sql.go index 450f519d35..03aeb2ca83 100644 --- a/examples/authors/mysql/query.sql.go +++ b/examples/authors/mysql/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package authors diff --git a/examples/authors/postgresql/db.go b/examples/authors/postgresql/db.go index f5d9de7305..e1f93c6f1d 100644 --- a/examples/authors/postgresql/db.go +++ b/examples/authors/postgresql/db.go @@ -1,19 +1,20 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package authors import ( "context" - "database/sql" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) - PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row } func New(db DBTX) *Queries { @@ -24,7 +25,7 @@ type Queries struct { db DBTX } -func (q *Queries) WithTx(tx *sql.Tx) *Queries { +func (q *Queries) WithTx(tx pgx.Tx) *Queries { return &Queries{ db: tx, } diff --git a/examples/authors/postgresql/db_test.go b/examples/authors/postgresql/db_test.go index d2df436ae3..0fdd8824be 100644 --- a/examples/authors/postgresql/db_test.go +++ b/examples/authors/postgresql/db_test.go @@ -1,27 +1,26 @@ //go:build examples -// +build examples package authors import ( "context" - "database/sql" "testing" - _ "github.com/lib/pq" + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgtype" - "github.com/sqlc-dev/sqlc/internal/sqltest/hosted" + "github.com/sqlc-dev/sqlc/internal/sqltest/local" ) func TestAuthors(t *testing.T) { - uri := hosted.PostgreSQL(t, []string{"schema.sql"}) - db, err := sql.Open("postgres", uri) + ctx := context.Background() + uri := local.PostgreSQL(t, []string{"schema.sql"}) + db, err := pgx.Connect(ctx, uri) if err != nil { t.Fatal(err) } - defer db.Close() + defer db.Close(ctx) - ctx := context.Background() q := New(db) // list all authors @@ -34,7 +33,7 @@ func TestAuthors(t *testing.T) { // create an author insertedAuthor, err := q.CreateAuthor(ctx, CreateAuthorParams{ Name: "Brian Kernighan", - Bio: sql.NullString{String: "Co-author of The C Programming Language and The Go Programming Language", Valid: true}, + Bio: pgtype.Text{String: "Co-author of The C Programming Language and The Go Programming Language", Valid: true}, }) if err != nil { t.Fatal(err) diff --git a/examples/authors/postgresql/models.go b/examples/authors/postgresql/models.go index ec61702f5a..7845b91a3d 100644 --- a/examples/authors/postgresql/models.go +++ b/examples/authors/postgresql/models.go @@ -1,15 +1,15 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package authors import ( - "database/sql" + "github.com/jackc/pgx/v5/pgtype" ) type Author struct { ID int64 Name string - Bio sql.NullString + Bio pgtype.Text } diff --git a/examples/authors/postgresql/query.sql.go b/examples/authors/postgresql/query.sql.go index a3864f0d97..c3325a8524 100644 --- a/examples/authors/postgresql/query.sql.go +++ b/examples/authors/postgresql/query.sql.go @@ -1,13 +1,14 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package authors import ( "context" - "database/sql" + + "github.com/jackc/pgx/v5/pgtype" ) const createAuthor = `-- name: CreateAuthor :one @@ -21,11 +22,11 @@ RETURNING id, name, bio type CreateAuthorParams struct { Name string - Bio sql.NullString + Bio pgtype.Text } func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { - row := q.db.QueryRowContext(ctx, createAuthor, arg.Name, arg.Bio) + row := q.db.QueryRow(ctx, createAuthor, arg.Name, arg.Bio) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err @@ -37,7 +38,7 @@ WHERE id = $1 ` func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { - _, err := q.db.ExecContext(ctx, deleteAuthor, id) + _, err := q.db.Exec(ctx, deleteAuthor, id) return err } @@ -47,7 +48,7 @@ WHERE id = $1 LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRow(ctx, getAuthor, id) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err @@ -59,7 +60,7 @@ ORDER BY name ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.Query(ctx, listAuthors) if err != nil { return nil, err } @@ -72,9 +73,6 @@ func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { } items = append(items, i) } - if err := rows.Close(); err != nil { - return nil, err - } if err := rows.Err(); err != nil { return nil, err } diff --git a/examples/authors/sqlc.yaml b/examples/authors/sqlc.yaml index 8270782edd..57f2319ea1 100644 --- a/examples/authors/sqlc.yaml +++ b/examples/authors/sqlc.yaml @@ -2,23 +2,28 @@ version: '2' cloud: project: "01HAQMMECEYQYKFJN8MP16QC41" sql: -- schema: postgresql/schema.sql +- name: postgresql + schema: postgresql/schema.sql queries: postgresql/query.sql engine: postgresql database: - managed: true + uri: "${VET_TEST_EXAMPLES_POSTGRES_AUTHORS}" + analyzer: + database: false rules: - sqlc/db-prepare - postgresql-query-too-costly gen: go: package: authors + sql_package: pgx/v5 out: postgresql -- schema: mysql/schema.sql +- name: mysql + schema: mysql/schema.sql queries: mysql/query.sql engine: mysql database: - uri: root:${MYSQL_ROOT_PASSWORD}@tcp(${MYSQL_HOST}:${MYSQL_PORT})/authors?multiStatements=true&parseTime=true + uri: "${VET_TEST_EXAMPLES_MYSQL_AUTHORS}" rules: - sqlc/db-prepare # - mysql-query-too-costly @@ -26,7 +31,8 @@ sql: go: package: authors out: mysql -- schema: sqlite/schema.sql +- name: sqlite + schema: sqlite/schema.sql queries: sqlite/query.sql engine: sqlite database: @@ -43,4 +49,4 @@ rules: rule: "postgresql.explain.plan.total_cost > 300.0" - name: mysql-query-too-costly message: "Too costly" - rule: "has(mysql.explain.query_block.cost_info) && double(mysql.explain.query_block.cost_info.query_cost) > 2.0" \ No newline at end of file + rule: "has(mysql.explain.query_block.cost_info) && double(mysql.explain.query_block.cost_info.query_cost) > 2.0" diff --git a/examples/authors/sqlite/db.go b/examples/authors/sqlite/db.go index f5d9de7305..fc409f7e3f 100644 --- a/examples/authors/sqlite/db.go +++ b/examples/authors/sqlite/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package authors diff --git a/examples/authors/sqlite/db_test.go b/examples/authors/sqlite/db_test.go index b07804b627..e10ce46069 100644 --- a/examples/authors/sqlite/db_test.go +++ b/examples/authors/sqlite/db_test.go @@ -1,5 +1,4 @@ //go:build examples -// +build examples package authors @@ -13,6 +12,7 @@ import ( func TestAuthors(t *testing.T) { sdb, cleanup := sqltest.SQLite(t, []string{"schema.sql"}) + defer sdb.Close() defer cleanup() ctx := context.Background() diff --git a/examples/authors/sqlite/models.go b/examples/authors/sqlite/models.go index ec61702f5a..24e47df1ef 100644 --- a/examples/authors/sqlite/models.go +++ b/examples/authors/sqlite/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package authors diff --git a/examples/authors/sqlite/query.sql.go b/examples/authors/sqlite/query.sql.go index 450f519d35..03aeb2ca83 100644 --- a/examples/authors/sqlite/query.sql.go +++ b/examples/authors/sqlite/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package authors diff --git a/examples/batch/postgresql/batch.go b/examples/batch/postgresql/batch.go index aa905c88cf..44ab41b920 100644 --- a/examples/batch/postgresql/batch.go +++ b/examples/batch/postgresql/batch.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: batch.go package batch @@ -8,10 +8,9 @@ package batch import ( "context" "errors" - "time" - "github.com/jackc/pgtype" - "github.com/jackc/pgx/v4" + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgtype" ) var ( @@ -114,13 +113,13 @@ type CreateBookBatchResults struct { } type CreateBookParams struct { - AuthorID int32 `json:"author_id"` - Isbn string `json:"isbn"` - BookType BookType `json:"book_type"` - Title string `json:"title"` - Year int32 `json:"year"` - Available time.Time `json:"available"` - Tags []string `json:"tags"` + AuthorID int32 `json:"author_id"` + Isbn string `json:"isbn"` + BookType BookType `json:"book_type"` + Title string `json:"title"` + Year int32 `json:"year"` + Available pgtype.Timestamptz `json:"available"` + Tags []string `json:"tags"` } func (q *Queries) CreateBook(ctx context.Context, arg []CreateBookParams) *CreateBookBatchResults { @@ -328,10 +327,10 @@ func (q *Queries) GetBiography(ctx context.Context, authorID []int32) *GetBiogra return &GetBiographyBatchResults{br, len(authorID), false} } -func (b *GetBiographyBatchResults) QueryRow(f func(int, pgtype.JSONB, error)) { +func (b *GetBiographyBatchResults) QueryRow(f func(int, []byte, error)) { defer b.br.Close() for t := 0; t < b.tot; t++ { - var biography pgtype.JSONB + var biography []byte if b.closed { if f != nil { f(t, biography, ErrBatchAlreadyClosed) diff --git a/examples/batch/postgresql/db.go b/examples/batch/postgresql/db.go index c9a9445f74..b61e314055 100644 --- a/examples/batch/postgresql/db.go +++ b/examples/batch/postgresql/db.go @@ -1,14 +1,14 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package batch import ( "context" - "github.com/jackc/pgconn" - "github.com/jackc/pgx/v4" + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" ) type DBTX interface { diff --git a/examples/batch/postgresql/db_test.go b/examples/batch/postgresql/db_test.go index fd3ce4e72b..122fa1aa73 100644 --- a/examples/batch/postgresql/db_test.go +++ b/examples/batch/postgresql/db_test.go @@ -1,5 +1,4 @@ //go:build examples -// +build examples package batch @@ -8,12 +7,14 @@ import ( "testing" "time" - "github.com/jackc/pgx/v4" - "github.com/sqlc-dev/sqlc/internal/sqltest/hosted" + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgtype" + + "github.com/sqlc-dev/sqlc/internal/sqltest/local" ) func TestBatchBooks(t *testing.T) { - uri := hosted.PostgreSQL(t, []string{"schema.sql"}) + uri := local.PostgreSQL(t, []string{"schema.sql"}) ctx := context.Background() @@ -31,7 +32,7 @@ func TestBatchBooks(t *testing.T) { t.Fatal(err) } - now := time.Now() + now := pgtype.Timestamptz{Time: time.Now(), Valid: true} // batch insert new books newBooksParams := []CreateBookParams{ @@ -114,7 +115,7 @@ func TestBatchBooks(t *testing.T) { }) for _, book := range books0 { - t.Logf("Book %d (%s): %s available: %s\n", book.BookID, book.BookType, book.Title, book.Available.Format(time.RFC822Z)) + t.Logf("Book %d (%s): %s available: %s\n", book.BookID, book.BookType, book.Title, book.Available.Time.Format(time.RFC822Z)) author, err := dq.GetAuthor(ctx, book.AuthorID) if err != nil { t.Fatal(err) diff --git a/examples/batch/postgresql/models.go b/examples/batch/postgresql/models.go index fdb04683f4..5165b316d1 100644 --- a/examples/batch/postgresql/models.go +++ b/examples/batch/postgresql/models.go @@ -1,15 +1,14 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package batch import ( "database/sql/driver" "fmt" - "time" - "github.com/jackc/pgtype" + "github.com/jackc/pgx/v5/pgtype" ) type BookType string @@ -55,18 +54,18 @@ func (ns NullBookType) Value() (driver.Value, error) { } type Author struct { - AuthorID int32 `json:"author_id"` - Name string `json:"name"` - Biography pgtype.JSONB `json:"biography"` + AuthorID int32 `json:"author_id"` + Name string `json:"name"` + Biography []byte `json:"biography"` } type Book struct { - BookID int32 `json:"book_id"` - AuthorID int32 `json:"author_id"` - Isbn string `json:"isbn"` - BookType BookType `json:"book_type"` - Title string `json:"title"` - Year int32 `json:"year"` - Available time.Time `json:"available"` - Tags []string `json:"tags"` + BookID int32 `json:"book_id"` + AuthorID int32 `json:"author_id"` + Isbn string `json:"isbn"` + BookType BookType `json:"book_type"` + Title string `json:"title"` + Year int32 `json:"year"` + Available pgtype.Timestamptz `json:"available"` + Tags []string `json:"tags"` } diff --git a/examples/batch/postgresql/querier.go b/examples/batch/postgresql/querier.go index b103b84eec..d0ad76db3c 100644 --- a/examples/batch/postgresql/querier.go +++ b/examples/batch/postgresql/querier.go @@ -1,13 +1,13 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package batch import ( "context" - "github.com/jackc/pgconn" + "github.com/jackc/pgx/v5/pgconn" ) type Querier interface { diff --git a/examples/batch/postgresql/query.sql.go b/examples/batch/postgresql/query.sql.go index f6a6a42b5b..b72dd3be28 100644 --- a/examples/batch/postgresql/query.sql.go +++ b/examples/batch/postgresql/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package batch @@ -8,7 +8,7 @@ package batch import ( "context" - "github.com/jackc/pgconn" + "github.com/jackc/pgx/v5/pgconn" ) const createAuthor = `-- name: CreateAuthor :one diff --git a/examples/batch/sqlc.json b/examples/batch/sqlc.json index 8c27bc540c..2f6b9a9e7e 100644 --- a/examples/batch/sqlc.json +++ b/examples/batch/sqlc.json @@ -11,15 +11,18 @@ "queries": "postgresql/query.sql", "engine": "postgresql", "database": { - "managed": true + "uri": "${VET_TEST_EXAMPLES_POSTGRES_BATCH}" + }, + "analyzer": { + "database": false }, "rules": [ "sqlc/db-prepare" ], - "sql_package": "pgx/v4", + "sql_package": "pgx/v5", "emit_json_tags": true, "emit_prepared_queries": true, "emit_interface": true } ] -} \ No newline at end of file +} diff --git a/examples/booktest/mysql/db.go b/examples/booktest/mysql/db.go index 3014364432..548c1a9fbe 100644 --- a/examples/booktest/mysql/db.go +++ b/examples/booktest/mysql/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package booktest diff --git a/examples/booktest/mysql/db_test.go b/examples/booktest/mysql/db_test.go index 810b9d68c8..6f97178c94 100644 --- a/examples/booktest/mysql/db_test.go +++ b/examples/booktest/mysql/db_test.go @@ -1,21 +1,27 @@ //go:build examples -// +build examples package booktest import ( "context" + "database/sql" "testing" "time" - "github.com/sqlc-dev/sqlc/internal/sqltest" + _ "github.com/go-sql-driver/mysql" + + "github.com/sqlc-dev/sqlc/internal/sqltest/local" ) func TestBooks(t *testing.T) { - db, cleanup := sqltest.MySQL(t, []string{"schema.sql"}) - defer cleanup() - ctx := context.Background() + uri := local.MySQL(t, []string{"schema.sql"}) + db, err := sql.Open("mysql", uri) + if err != nil { + t.Fatal(err) + } + defer db.Close() + dq := New(db) // create an author diff --git a/examples/booktest/mysql/models.go b/examples/booktest/mysql/models.go index 3b290c4478..1340059137 100644 --- a/examples/booktest/mysql/models.go +++ b/examples/booktest/mysql/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package booktest diff --git a/examples/booktest/mysql/query.sql.go b/examples/booktest/mysql/query.sql.go index 541a305d62..887af77ce9 100644 --- a/examples/booktest/mysql/query.sql.go +++ b/examples/booktest/mysql/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package booktest diff --git a/examples/booktest/postgresql/db.go b/examples/booktest/postgresql/db.go index 3014364432..cec8f99059 100644 --- a/examples/booktest/postgresql/db.go +++ b/examples/booktest/postgresql/db.go @@ -1,19 +1,20 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package booktest import ( "context" - "database/sql" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) - PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row } func New(db DBTX) *Queries { @@ -24,7 +25,7 @@ type Queries struct { db DBTX } -func (q *Queries) WithTx(tx *sql.Tx) *Queries { +func (q *Queries) WithTx(tx pgx.Tx) *Queries { return &Queries{ db: tx, } diff --git a/examples/booktest/postgresql/db_test.go b/examples/booktest/postgresql/db_test.go index 9716f56844..ae71593852 100644 --- a/examples/booktest/postgresql/db_test.go +++ b/examples/booktest/postgresql/db_test.go @@ -1,28 +1,27 @@ //go:build examples -// +build examples package booktest import ( "context" - "database/sql" "testing" "time" - _ "github.com/lib/pq" + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgtype" - "github.com/sqlc-dev/sqlc/internal/sqltest/hosted" + "github.com/sqlc-dev/sqlc/internal/sqltest/local" ) func TestBooks(t *testing.T) { - uri := hosted.PostgreSQL(t, []string{"schema.sql"}) - db, err := sql.Open("postgres", uri) + ctx := context.Background() + uri := local.PostgreSQL(t, []string{"schema.sql"}) + db, err := pgx.Connect(ctx, uri) if err != nil { t.Fatal(err) } - defer db.Close() + defer db.Close(ctx) - ctx := context.Background() dq := New(db) // create an author @@ -32,7 +31,7 @@ func TestBooks(t *testing.T) { } // create transaction - tx, err := db.Begin() + tx, err := db.Begin(ctx) if err != nil { t.Fatal(err) } @@ -40,7 +39,7 @@ func TestBooks(t *testing.T) { tq := dq.WithTx(tx) // save first book - now := time.Now() + now := pgtype.Timestamptz{Time: time.Now(), Valid: true} _, err = tq.CreateBook(ctx, CreateBookParams{ AuthorID: a.AuthorID, Isbn: "1", @@ -107,7 +106,7 @@ func TestBooks(t *testing.T) { } // tx commit - err = tx.Commit() + err = tx.Commit(ctx) if err != nil { t.Fatal(err) } @@ -132,7 +131,7 @@ func TestBooks(t *testing.T) { t.Fatal(err) } for _, book := range books0 { - t.Logf("Book %d (%s): %s available: %s\n", book.BookID, book.BookType, book.Title, book.Available.Format(time.RFC822Z)) + t.Logf("Book %d (%s): %s available: %s\n", book.BookID, book.BookType, book.Title, book.Available.Time.Format(time.RFC822Z)) author, err := dq.GetAuthor(ctx, book.AuthorID) if err != nil { t.Fatal(err) @@ -150,7 +149,18 @@ func TestBooks(t *testing.T) { t.Logf("Book %d: '%s', Author: '%s', ISBN: '%s' Tags: '%v'\n", ab.BookID, ab.Title, ab.Name.String, ab.Isbn, ab.Tags) } - // TODO: call say_hello(varchar) + // call function + pgText, err := dq.SayHello(ctx, "world") + if err != nil { + t.Fatal(err) + } + str, err := pgText.Value() + if err != nil { + t.Fatal(err) + } + if str != "hello world" { + t.Fatal("expected function result to be \"hello world\". actual:", str) + } // get book 4 and delete b5, err := dq.GetBook(ctx, b3.BookID) diff --git a/examples/booktest/postgresql/models.go b/examples/booktest/postgresql/models.go index 3bfe237f71..7df113ef89 100644 --- a/examples/booktest/postgresql/models.go +++ b/examples/booktest/postgresql/models.go @@ -1,13 +1,14 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package booktest import ( "database/sql/driver" "fmt" - "time" + + "github.com/jackc/pgx/v5/pgtype" ) type BookType string @@ -64,6 +65,6 @@ type Book struct { BookType BookType Title string Year int32 - Available time.Time + Available pgtype.Timestamptz Tags []string } diff --git a/examples/booktest/postgresql/query.sql b/examples/booktest/postgresql/query.sql index 194897a4bb..75b8cd3b6d 100644 --- a/examples/booktest/postgresql/query.sql +++ b/examples/booktest/postgresql/query.sql @@ -58,3 +58,6 @@ WHERE book_id = $3; UPDATE books SET title = $1, tags = $2, isbn = $4 WHERE book_id = $3; + +-- name: SayHello :one +select * from say_hello($1); diff --git a/examples/booktest/postgresql/query.sql.go b/examples/booktest/postgresql/query.sql.go index 34e55ad96c..dd2d557bbd 100644 --- a/examples/booktest/postgresql/query.sql.go +++ b/examples/booktest/postgresql/query.sql.go @@ -1,16 +1,14 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package booktest import ( "context" - "database/sql" - "time" - "github.com/lib/pq" + "github.com/jackc/pgx/v5/pgtype" ) const booksByTags = `-- name: BooksByTags :many @@ -28,13 +26,13 @@ WHERE tags && $1::varchar[] type BooksByTagsRow struct { BookID int32 Title string - Name sql.NullString + Name pgtype.Text Isbn string Tags []string } func (q *Queries) BooksByTags(ctx context.Context, dollar_1 []string) ([]BooksByTagsRow, error) { - rows, err := q.db.QueryContext(ctx, booksByTags, pq.Array(dollar_1)) + rows, err := q.db.Query(ctx, booksByTags, dollar_1) if err != nil { return nil, err } @@ -47,15 +45,12 @@ func (q *Queries) BooksByTags(ctx context.Context, dollar_1 []string) ([]BooksBy &i.Title, &i.Name, &i.Isbn, - pq.Array(&i.Tags), + &i.Tags, ); err != nil { return nil, err } items = append(items, i) } - if err := rows.Close(); err != nil { - return nil, err - } if err := rows.Err(); err != nil { return nil, err } @@ -73,7 +68,7 @@ type BooksByTitleYearParams struct { } func (q *Queries) BooksByTitleYear(ctx context.Context, arg BooksByTitleYearParams) ([]Book, error) { - rows, err := q.db.QueryContext(ctx, booksByTitleYear, arg.Title, arg.Year) + rows, err := q.db.Query(ctx, booksByTitleYear, arg.Title, arg.Year) if err != nil { return nil, err } @@ -89,15 +84,12 @@ func (q *Queries) BooksByTitleYear(ctx context.Context, arg BooksByTitleYearPara &i.Title, &i.Year, &i.Available, - pq.Array(&i.Tags), + &i.Tags, ); err != nil { return nil, err } items = append(items, i) } - if err := rows.Close(); err != nil { - return nil, err - } if err := rows.Err(); err != nil { return nil, err } @@ -110,7 +102,7 @@ RETURNING author_id, name ` func (q *Queries) CreateAuthor(ctx context.Context, name string) (Author, error) { - row := q.db.QueryRowContext(ctx, createAuthor, name) + row := q.db.QueryRow(ctx, createAuthor, name) var i Author err := row.Scan(&i.AuthorID, &i.Name) return i, err @@ -143,19 +135,19 @@ type CreateBookParams struct { BookType BookType Title string Year int32 - Available time.Time + Available pgtype.Timestamptz Tags []string } func (q *Queries) CreateBook(ctx context.Context, arg CreateBookParams) (Book, error) { - row := q.db.QueryRowContext(ctx, createBook, + row := q.db.QueryRow(ctx, createBook, arg.AuthorID, arg.Isbn, arg.BookType, arg.Title, arg.Year, arg.Available, - pq.Array(arg.Tags), + arg.Tags, ) var i Book err := row.Scan( @@ -166,7 +158,7 @@ func (q *Queries) CreateBook(ctx context.Context, arg CreateBookParams) (Book, e &i.Title, &i.Year, &i.Available, - pq.Array(&i.Tags), + &i.Tags, ) return i, err } @@ -177,7 +169,7 @@ WHERE book_id = $1 ` func (q *Queries) DeleteBook(ctx context.Context, bookID int32) error { - _, err := q.db.ExecContext(ctx, deleteBook, bookID) + _, err := q.db.Exec(ctx, deleteBook, bookID) return err } @@ -187,7 +179,7 @@ WHERE author_id = $1 ` func (q *Queries) GetAuthor(ctx context.Context, authorID int32) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, authorID) + row := q.db.QueryRow(ctx, getAuthor, authorID) var i Author err := row.Scan(&i.AuthorID, &i.Name) return i, err @@ -199,7 +191,7 @@ WHERE book_id = $1 ` func (q *Queries) GetBook(ctx context.Context, bookID int32) (Book, error) { - row := q.db.QueryRowContext(ctx, getBook, bookID) + row := q.db.QueryRow(ctx, getBook, bookID) var i Book err := row.Scan( &i.BookID, @@ -209,11 +201,22 @@ func (q *Queries) GetBook(ctx context.Context, bookID int32) (Book, error) { &i.Title, &i.Year, &i.Available, - pq.Array(&i.Tags), + &i.Tags, ) return i, err } +const sayHello = `-- name: SayHello :one +select say_hello from say_hello($1) +` + +func (q *Queries) SayHello(ctx context.Context, s string) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, sayHello, s) + var say_hello pgtype.Text + err := row.Scan(&say_hello) + return say_hello, err +} + const updateBook = `-- name: UpdateBook :exec UPDATE books SET title = $1, tags = $2 @@ -227,7 +230,7 @@ type UpdateBookParams struct { } func (q *Queries) UpdateBook(ctx context.Context, arg UpdateBookParams) error { - _, err := q.db.ExecContext(ctx, updateBook, arg.Title, pq.Array(arg.Tags), arg.BookID) + _, err := q.db.Exec(ctx, updateBook, arg.Title, arg.Tags, arg.BookID) return err } @@ -245,9 +248,9 @@ type UpdateBookISBNParams struct { } func (q *Queries) UpdateBookISBN(ctx context.Context, arg UpdateBookISBNParams) error { - _, err := q.db.ExecContext(ctx, updateBookISBN, + _, err := q.db.Exec(ctx, updateBookISBN, arg.Title, - pq.Array(arg.Tags), + arg.Tags, arg.BookID, arg.Isbn, ) diff --git a/examples/booktest/postgresql/schema.sql b/examples/booktest/postgresql/schema.sql index 2beecaba1a..3cdd97ca5f 100644 --- a/examples/booktest/postgresql/schema.sql +++ b/examples/booktest/postgresql/schema.sql @@ -23,9 +23,9 @@ CREATE TABLE books ( CREATE INDEX books_title_idx ON books(title, year); -CREATE FUNCTION say_hello(text) RETURNS text AS $$ +CREATE FUNCTION say_hello(s text) RETURNS text AS $$ BEGIN - RETURN CONCAT('hello ', $1); + RETURN CONCAT('hello ', s); END; $$ LANGUAGE plpgsql; diff --git a/examples/booktest/sqlc.json b/examples/booktest/sqlc.json index 72cd08936d..b0b0d71d01 100644 --- a/examples/booktest/sqlc.json +++ b/examples/booktest/sqlc.json @@ -10,8 +10,12 @@ "schema": "postgresql/schema.sql", "queries": "postgresql/query.sql", "engine": "postgresql", + "sql_package": "pgx/v5", "database": { - "managed": true + "uri": "${VET_TEST_EXAMPLES_POSTGRES_BOOKTEST}" + }, + "analyzer": { + "database": false }, "rules": [ "sqlc/db-prepare" @@ -24,7 +28,7 @@ "queries": "mysql/query.sql", "engine": "mysql", "database": { - "uri": "root:${MYSQL_ROOT_PASSWORD}@tcp(${MYSQL_HOST}:${MYSQL_PORT})/booktest?multiStatements=true&parseTime=true" + "uri": "${VET_TEST_EXAMPLES_MYSQL_BOOKTEST}" }, "rules": [ "sqlc/db-prepare" @@ -44,4 +48,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/examples/booktest/sqlite/db.go b/examples/booktest/sqlite/db.go index 3014364432..548c1a9fbe 100644 --- a/examples/booktest/sqlite/db.go +++ b/examples/booktest/sqlite/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package booktest diff --git a/examples/booktest/sqlite/db_test.go b/examples/booktest/sqlite/db_test.go index f169c79148..42a8b396b1 100644 --- a/examples/booktest/sqlite/db_test.go +++ b/examples/booktest/sqlite/db_test.go @@ -1,5 +1,4 @@ //go:build examples -// +build examples package booktest @@ -19,6 +18,7 @@ const ( func TestBooks(t *testing.T) { db, cleanup := sqltest.SQLite(t, []string{"schema.sql"}) + defer db.Close() defer cleanup() ctx := context.Background() diff --git a/examples/booktest/sqlite/models.go b/examples/booktest/sqlite/models.go index 88d4527124..11bfe05d99 100644 --- a/examples/booktest/sqlite/models.go +++ b/examples/booktest/sqlite/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package booktest diff --git a/examples/booktest/sqlite/query.sql.go b/examples/booktest/sqlite/query.sql.go index 9152f1c02e..435399a965 100644 --- a/examples/booktest/sqlite/query.sql.go +++ b/examples/booktest/sqlite/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package booktest diff --git a/examples/jets/postgresql/db.go b/examples/jets/postgresql/db.go index bee0af2640..bccada1806 100644 --- a/examples/jets/postgresql/db.go +++ b/examples/jets/postgresql/db.go @@ -1,19 +1,20 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package jets import ( "context" - "database/sql" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) - PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row } func New(db DBTX) *Queries { @@ -24,7 +25,7 @@ type Queries struct { db DBTX } -func (q *Queries) WithTx(tx *sql.Tx) *Queries { +func (q *Queries) WithTx(tx pgx.Tx) *Queries { return &Queries{ db: tx, } diff --git a/examples/jets/postgresql/models.go b/examples/jets/postgresql/models.go index c66a94e7eb..166bf06f3d 100644 --- a/examples/jets/postgresql/models.go +++ b/examples/jets/postgresql/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package jets -import () - type Jet struct { ID int32 PilotID int32 diff --git a/examples/jets/postgresql/query-building.sql.go b/examples/jets/postgresql/query-building.sql.go index 64db2dfdf8..0697bc12bc 100644 --- a/examples/jets/postgresql/query-building.sql.go +++ b/examples/jets/postgresql/query-building.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query-building.sql package jets @@ -14,7 +14,7 @@ SELECT COUNT(*) FROM pilots ` func (q *Queries) CountPilots(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, countPilots) + row := q.db.QueryRow(ctx, countPilots) var count int64 err := row.Scan(&count) return count, err @@ -25,7 +25,7 @@ DELETE FROM pilots WHERE id = $1 ` func (q *Queries) DeletePilot(ctx context.Context, id int32) error { - _, err := q.db.ExecContext(ctx, deletePilot, id) + _, err := q.db.Exec(ctx, deletePilot, id) return err } @@ -34,7 +34,7 @@ SELECT id, name FROM pilots LIMIT 5 ` func (q *Queries) ListPilots(ctx context.Context) ([]Pilot, error) { - rows, err := q.db.QueryContext(ctx, listPilots) + rows, err := q.db.Query(ctx, listPilots) if err != nil { return nil, err } @@ -47,9 +47,6 @@ func (q *Queries) ListPilots(ctx context.Context) ([]Pilot, error) { } items = append(items, i) } - if err := rows.Close(); err != nil { - return nil, err - } if err := rows.Err(); err != nil { return nil, err } diff --git a/examples/jets/sqlc.json b/examples/jets/sqlc.json index 85a35a4f7a..8dfa0df777 100644 --- a/examples/jets/sqlc.json +++ b/examples/jets/sqlc.json @@ -10,8 +10,12 @@ "schema": "postgresql/schema.sql", "queries": "postgresql/query-building.sql", "engine": "postgresql", + "sql_package": "pgx/v5", "database": { - "managed": true + "uri": "${VET_TEST_EXAMPLES_POSTGRES_JETS}" + }, + "analyzer": { + "database": false }, "rules": [ "sqlc/db-prepare" diff --git a/examples/kotlin/.gitignore b/examples/kotlin/.gitignore deleted file mode 100644 index fbb16c8de7..0000000000 --- a/examples/kotlin/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/.gradle/ -/.idea/ -/build/ -/out/ diff --git a/examples/kotlin/README.md b/examples/kotlin/README.md deleted file mode 100644 index 717425cb51..0000000000 --- a/examples/kotlin/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# Kotlin examples - -This is a Kotlin gradle project configured to compile and test all examples. Currently tests have only been written for the `authors` example. - -To run tests: - -```shell script -docker run --name dinosql-postgres -d -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=mysecretpassword -e POSTGRES_DB=postgres -p 5432:5432 postgres:11 -./gradlew clean test -``` - -The project can be easily imported into Intellij. - -1. Install Java if you don't already have it -1. Download Intellij IDEA Community Edition -1. In the "Welcome" modal, click "Import Project" -1. Open the `build.gradle` file adjacent to this README file -1. Wait for Intellij to sync the gradle modules and complete indexing diff --git a/examples/kotlin/build.gradle b/examples/kotlin/build.gradle deleted file mode 100644 index 0dfec90887..0000000000 --- a/examples/kotlin/build.gradle +++ /dev/null @@ -1,34 +0,0 @@ -plugins { - id 'org.jetbrains.kotlin.jvm' version '1.3.60' -} - -group 'com.example' -version '1.0-SNAPSHOT' - -repositories { - mavenCentral() -} - -dependencies { - implementation 'mysql:mysql-connector-java:8.0.22' - implementation 'org.postgresql:postgresql:42.2.9' - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.6.0' -} - -test { - useJUnitPlatform() -} - -compileKotlin { - kotlinOptions.jvmTarget = "1.8" -} -compileTestKotlin { - kotlinOptions.jvmTarget = "1.8" -} - -buildScan { - termsOfServiceUrl = "https://gradle.com/terms-of-service" - termsOfServiceAgree = "yes" -} diff --git a/examples/kotlin/gradle.properties b/examples/kotlin/gradle.properties deleted file mode 100644 index 29e08e8ca8..0000000000 --- a/examples/kotlin/gradle.properties +++ /dev/null @@ -1 +0,0 @@ -kotlin.code.style=official \ No newline at end of file diff --git a/examples/kotlin/gradle/wrapper/gradle-wrapper.jar b/examples/kotlin/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 87b738cbd0..0000000000 Binary files a/examples/kotlin/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/examples/kotlin/gradle/wrapper/gradle-wrapper.properties b/examples/kotlin/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index fd68b0da3e..0000000000 --- a/examples/kotlin/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Sat Jan 25 10:45:34 EST 2020 -distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.1-all.zip -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStorePath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME diff --git a/examples/kotlin/gradlew b/examples/kotlin/gradlew deleted file mode 100755 index af6708ff22..0000000000 --- a/examples/kotlin/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/examples/kotlin/gradlew.bat b/examples/kotlin/gradlew.bat deleted file mode 100644 index 6d57edc706..0000000000 --- a/examples/kotlin/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/examples/kotlin/settings.gradle b/examples/kotlin/settings.gradle deleted file mode 100644 index 5a094655c6..0000000000 --- a/examples/kotlin/settings.gradle +++ /dev/null @@ -1,5 +0,0 @@ -plugins { - id("com.gradle.enterprise").version("3.1.1") -} - -rootProject.name = 'dbtest' diff --git a/examples/kotlin/sqlc.json b/examples/kotlin/sqlc.json deleted file mode 100644 index 284b76ec91..0000000000 --- a/examples/kotlin/sqlc.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "version": "2", - "plugins": [ - { - "name": "kt", - "wasm": { - "url": "https://downloads.sqlc.dev/plugin/sqlc-gen-kotlin_1.1.0.wasm", - "sha256": "57890144f4effed4fe71855418b87ad26d53dc5ed2030a66ad77e5e3a93d77fb" - } - } - ], - "sql": [ - { - "schema": "src/main/resources/authors/postgresql/schema.sql", - "queries": "src/main/resources/authors/postgresql/query.sql", - "engine": "postgresql", - "codegen": [ - { - "out": "src/main/kotlin/com/example/authors/postgresql", - "plugin": "kt", - "options": { - "package": "com.example.authors.postgresql" - } - } - ] - }, - { - "schema": "src/main/resources/ondeck/postgresql/schema", - "queries": "src/main/resources/ondeck/postgresql/query", - "engine": "postgresql", - "codegen": [ - { - "out": "src/main/kotlin/com/example/ondeck/postgresql", - "plugin": "kt", - "options": { - "package": "com.example.ondeck.postgresql" - } - } - ] - }, - { - "schema": "src/main/resources/jets/postgresql/schema.sql", - "queries": "src/main/resources/jets/postgresql/query-building.sql", - "engine": "postgresql", - "codegen": [ - { - "plugin": "kt", - "out": "src/main/kotlin/com/example/jets", - "options": { - "package": "com.example.jets" - } - } - ] - }, - { - "schema": "src/main/resources/booktest/postgresql/schema.sql", - "queries": "src/main/resources/booktest/postgresql/query.sql", - "engine": "postgresql", - "codegen": [ - { - "out": "src/main/kotlin/com/example/booktest/postgresql", - "plugin": "kt", - "options": { - "package": "com.example.booktest.postgresql" - } - } - ] - }, - { - "schema": "src/main/resources/authors/mysql/schema.sql", - "queries": "src/main/resources/authors/mysql/query.sql", - "engine": "mysql", - "codegen": [ - { - "out": "src/main/kotlin/com/example/authors/mysql", - "plugin": "kt", - "options": { - "package": "com.example.authors.mysql" - } - } - ] - }, - { - "schema": "src/main/resources/booktest/mysql/schema.sql", - "queries": "src/main/resources/booktest/mysql/query.sql", - "engine": "mysql", - "codegen": [ - { - "out": "src/main/kotlin/com/example/booktest/mysql", - "plugin": "kt", - "options": { - "package": "com.example.booktest.mysql" - } - } - ] - }, - { - "schema": "src/main/resources/ondeck/mysql/schema", - "queries": "src/main/resources/ondeck/mysql/query", - "engine": "mysql", - "codegen": [ - { - "out": "src/main/kotlin/com/example/ondeck/mysql", - "plugin": "kt", - "options": { - "package": "com.example.ondeck.mysql" - } - } - ] - } - ] -} diff --git a/examples/kotlin/src/main/kotlin/com/example/authors/mysql/Models.kt b/examples/kotlin/src/main/kotlin/com/example/authors/mysql/Models.kt deleted file mode 100644 index 4d492e5a69..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/authors/mysql/Models.kt +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.authors.mysql - -data class Author ( - val id: Long, - val name: String, - val bio: String? -) - diff --git a/examples/kotlin/src/main/kotlin/com/example/authors/mysql/Queries.kt b/examples/kotlin/src/main/kotlin/com/example/authors/mysql/Queries.kt deleted file mode 100644 index 5b6b46eb26..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/authors/mysql/Queries.kt +++ /dev/null @@ -1,25 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.authors.mysql - -import java.sql.Connection -import java.sql.SQLException -import java.sql.Statement - -interface Queries { - @Throws(SQLException::class) - fun createAuthor(name: String, bio: String?): Long - - @Throws(SQLException::class) - fun deleteAuthor(id: Long) - - @Throws(SQLException::class) - fun getAuthor(id: Long): Author? - - @Throws(SQLException::class) - fun listAuthors(): List - -} - diff --git a/examples/kotlin/src/main/kotlin/com/example/authors/mysql/QueriesImpl.kt b/examples/kotlin/src/main/kotlin/com/example/authors/mysql/QueriesImpl.kt deleted file mode 100644 index dfc170f116..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/authors/mysql/QueriesImpl.kt +++ /dev/null @@ -1,100 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.authors.mysql - -import java.sql.Connection -import java.sql.SQLException -import java.sql.Statement - -const val createAuthor = """-- name: createAuthor :execresult -INSERT INTO authors ( - name, bio -) VALUES ( - ?, ? -) -""" - -const val deleteAuthor = """-- name: deleteAuthor :exec -DELETE FROM authors -WHERE id = ? -""" - -const val getAuthor = """-- name: getAuthor :one -SELECT id, name, bio FROM authors -WHERE id = ? LIMIT 1 -""" - -const val listAuthors = """-- name: listAuthors :many -SELECT id, name, bio FROM authors -ORDER BY name -""" - -class QueriesImpl(private val conn: Connection) : Queries { - - @Throws(SQLException::class) - override fun createAuthor(name: String, bio: String?): Long { - return conn.prepareStatement(createAuthor, Statement.RETURN_GENERATED_KEYS).use { stmt -> - stmt.setString(1, name) - stmt.setString(2, bio) - - stmt.execute() - - val results = stmt.generatedKeys - if (!results.next()) { - throw SQLException("no generated key returned") - } - results.getLong(1) - } - } - - @Throws(SQLException::class) - override fun deleteAuthor(id: Long) { - conn.prepareStatement(deleteAuthor).use { stmt -> - stmt.setLong(1, id) - - stmt.execute() - } - } - - @Throws(SQLException::class) - override fun getAuthor(id: Long): Author? { - return conn.prepareStatement(getAuthor).use { stmt -> - stmt.setLong(1, id) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = Author( - results.getLong(1), - results.getString(2), - results.getString(3) - ) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun listAuthors(): List { - return conn.prepareStatement(listAuthors).use { stmt -> - - val results = stmt.executeQuery() - val ret = mutableListOf() - while (results.next()) { - ret.add(Author( - results.getLong(1), - results.getString(2), - results.getString(3) - )) - } - ret - } - } - -} - diff --git a/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/Models.kt b/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/Models.kt deleted file mode 100644 index 226aa46cb9..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/Models.kt +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.authors.postgresql - -data class Author ( - val id: Long, - val name: String, - val bio: String? -) - diff --git a/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/Queries.kt b/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/Queries.kt deleted file mode 100644 index 61b3a01667..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/Queries.kt +++ /dev/null @@ -1,25 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.authors.postgresql - -import java.sql.Connection -import java.sql.SQLException -import java.sql.Statement - -interface Queries { - @Throws(SQLException::class) - fun createAuthor(name: String, bio: String?): Author? - - @Throws(SQLException::class) - fun deleteAuthor(id: Long) - - @Throws(SQLException::class) - fun getAuthor(id: Long): Author? - - @Throws(SQLException::class) - fun listAuthors(): List - -} - diff --git a/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/QueriesImpl.kt b/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/QueriesImpl.kt deleted file mode 100644 index 177d61d445..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/QueriesImpl.kt +++ /dev/null @@ -1,107 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.authors.postgresql - -import java.sql.Connection -import java.sql.SQLException -import java.sql.Statement - -const val createAuthor = """-- name: createAuthor :one -INSERT INTO authors ( - name, bio -) VALUES ( - ?, ? -) -RETURNING id, name, bio -""" - -const val deleteAuthor = """-- name: deleteAuthor :exec -DELETE FROM authors -WHERE id = ? -""" - -const val getAuthor = """-- name: getAuthor :one -SELECT id, name, bio FROM authors -WHERE id = ? LIMIT 1 -""" - -const val listAuthors = """-- name: listAuthors :many -SELECT id, name, bio FROM authors -ORDER BY name -""" - -class QueriesImpl(private val conn: Connection) : Queries { - - @Throws(SQLException::class) - override fun createAuthor(name: String, bio: String?): Author? { - return conn.prepareStatement(createAuthor).use { stmt -> - stmt.setString(1, name) - stmt.setString(2, bio) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = Author( - results.getLong(1), - results.getString(2), - results.getString(3) - ) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun deleteAuthor(id: Long) { - conn.prepareStatement(deleteAuthor).use { stmt -> - stmt.setLong(1, id) - - stmt.execute() - } - } - - @Throws(SQLException::class) - override fun getAuthor(id: Long): Author? { - return conn.prepareStatement(getAuthor).use { stmt -> - stmt.setLong(1, id) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = Author( - results.getLong(1), - results.getString(2), - results.getString(3) - ) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun listAuthors(): List { - return conn.prepareStatement(listAuthors).use { stmt -> - - val results = stmt.executeQuery() - val ret = mutableListOf() - while (results.next()) { - ret.add(Author( - results.getLong(1), - results.getString(2), - results.getString(3) - )) - } - ret - } - } - -} - diff --git a/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/Models.kt b/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/Models.kt deleted file mode 100644 index 9c5cd1d531..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/Models.kt +++ /dev/null @@ -1,34 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.booktest.mysql - -import java.time.LocalDateTime - -enum class BooksBookType(val value: String) { - FICTION("FICTION"), - NONFICTION("NONFICTION"); - - companion object { - private val map = BooksBookType.values().associateBy(BooksBookType::value) - fun lookup(value: String) = map[value] - } -} - -data class Author ( - val authorId: Int, - val name: String -) - -data class Book ( - val bookId: Int, - val authorId: Int, - val isbn: String, - val bookType: BooksBookType, - val title: String, - val yr: Int, - val available: LocalDateTime, - val tags: String -) - diff --git a/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/Queries.kt b/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/Queries.kt deleted file mode 100644 index 03af9a6f3a..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/Queries.kt +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.booktest.mysql - -import java.sql.Connection -import java.sql.SQLException -import java.sql.Statement -import java.time.LocalDateTime - -interface Queries { - @Throws(SQLException::class) - fun booksByTags(tags: String): List - - @Throws(SQLException::class) - fun booksByTitleYear(title: String, yr: Int): List - - @Throws(SQLException::class) - fun createAuthor(name: String): Long - - @Throws(SQLException::class) - fun createBook( - authorId: Int, - isbn: String, - bookType: BooksBookType, - title: String, - yr: Int, - available: LocalDateTime, - tags: String): Long - - @Throws(SQLException::class) - fun deleteAuthorBeforeYear(yr: Int, authorId: Int) - - @Throws(SQLException::class) - fun deleteBook(bookId: Int) - - @Throws(SQLException::class) - fun getAuthor(authorId: Int): Author? - - @Throws(SQLException::class) - fun getBook(bookId: Int): Book? - - @Throws(SQLException::class) - fun updateBook( - title: String, - tags: String, - bookId: Int) - - @Throws(SQLException::class) - fun updateBookISBN( - title: String, - tags: String, - isbn: String, - bookId: Int) - -} - diff --git a/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/QueriesImpl.kt b/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/QueriesImpl.kt deleted file mode 100644 index be81242bab..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/QueriesImpl.kt +++ /dev/null @@ -1,278 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.booktest.mysql - -import java.sql.Connection -import java.sql.SQLException -import java.sql.Statement -import java.time.LocalDateTime - -const val booksByTags = """-- name: booksByTags :many -SELECT - book_id, - title, - name, - isbn, - tags -FROM books -LEFT JOIN authors ON books.author_id = authors.author_id -WHERE tags = ? -""" - -data class BooksByTagsRow ( - val bookId: Int, - val title: String, - val name: String?, - val isbn: String, - val tags: String -) - -const val booksByTitleYear = """-- name: booksByTitleYear :many -SELECT book_id, author_id, isbn, book_type, title, yr, available, tags FROM books -WHERE title = ? AND yr = ? -""" - -const val createAuthor = """-- name: createAuthor :execresult -INSERT INTO authors (name) VALUES (?) -""" - -const val createBook = """-- name: createBook :execresult -INSERT INTO books ( - author_id, - isbn, - book_type, - title, - yr, - available, - tags -) VALUES ( - ?, - ?, - ?, - ?, - ?, - ?, - ? -) -""" - -const val deleteAuthorBeforeYear = """-- name: deleteAuthorBeforeYear :exec -DELETE FROM books -WHERE yr < ? AND author_id = ? -""" - -const val deleteBook = """-- name: deleteBook :exec -DELETE FROM books -WHERE book_id = ? -""" - -const val getAuthor = """-- name: getAuthor :one -SELECT author_id, name FROM authors -WHERE author_id = ? -""" - -const val getBook = """-- name: getBook :one -SELECT book_id, author_id, isbn, book_type, title, yr, available, tags FROM books -WHERE book_id = ? -""" - -const val updateBook = """-- name: updateBook :exec -UPDATE books -SET title = ?, tags = ? -WHERE book_id = ? -""" - -const val updateBookISBN = """-- name: updateBookISBN :exec -UPDATE books -SET title = ?, tags = ?, isbn = ? -WHERE book_id = ? -""" - -class QueriesImpl(private val conn: Connection) : Queries { - - @Throws(SQLException::class) - override fun booksByTags(tags: String): List { - return conn.prepareStatement(booksByTags).use { stmt -> - stmt.setString(1, tags) - - val results = stmt.executeQuery() - val ret = mutableListOf() - while (results.next()) { - ret.add(BooksByTagsRow( - results.getInt(1), - results.getString(2), - results.getString(3), - results.getString(4), - results.getString(5) - )) - } - ret - } - } - - @Throws(SQLException::class) - override fun booksByTitleYear(title: String, yr: Int): List { - return conn.prepareStatement(booksByTitleYear).use { stmt -> - stmt.setString(1, title) - stmt.setInt(2, yr) - - val results = stmt.executeQuery() - val ret = mutableListOf() - while (results.next()) { - ret.add(Book( - results.getInt(1), - results.getInt(2), - results.getString(3), - BooksBookType.lookup(results.getString(4))!!, - results.getString(5), - results.getInt(6), - results.getObject(7, LocalDateTime::class.java), - results.getString(8) - )) - } - ret - } - } - - @Throws(SQLException::class) - override fun createAuthor(name: String): Long { - return conn.prepareStatement(createAuthor, Statement.RETURN_GENERATED_KEYS).use { stmt -> - stmt.setString(1, name) - - stmt.execute() - - val results = stmt.generatedKeys - if (!results.next()) { - throw SQLException("no generated key returned") - } - results.getLong(1) - } - } - - @Throws(SQLException::class) - override fun createBook( - authorId: Int, - isbn: String, - bookType: BooksBookType, - title: String, - yr: Int, - available: LocalDateTime, - tags: String): Long { - return conn.prepareStatement(createBook, Statement.RETURN_GENERATED_KEYS).use { stmt -> - stmt.setInt(1, authorId) - stmt.setString(2, isbn) - stmt.setString(3, bookType.value) - stmt.setString(4, title) - stmt.setInt(5, yr) - stmt.setObject(6, available) - stmt.setString(7, tags) - - stmt.execute() - - val results = stmt.generatedKeys - if (!results.next()) { - throw SQLException("no generated key returned") - } - results.getLong(1) - } - } - - @Throws(SQLException::class) - override fun deleteAuthorBeforeYear(yr: Int, authorId: Int) { - conn.prepareStatement(deleteAuthorBeforeYear).use { stmt -> - stmt.setInt(1, yr) - stmt.setInt(2, authorId) - - stmt.execute() - } - } - - @Throws(SQLException::class) - override fun deleteBook(bookId: Int) { - conn.prepareStatement(deleteBook).use { stmt -> - stmt.setInt(1, bookId) - - stmt.execute() - } - } - - @Throws(SQLException::class) - override fun getAuthor(authorId: Int): Author? { - return conn.prepareStatement(getAuthor).use { stmt -> - stmt.setInt(1, authorId) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = Author( - results.getInt(1), - results.getString(2) - ) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun getBook(bookId: Int): Book? { - return conn.prepareStatement(getBook).use { stmt -> - stmt.setInt(1, bookId) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = Book( - results.getInt(1), - results.getInt(2), - results.getString(3), - BooksBookType.lookup(results.getString(4))!!, - results.getString(5), - results.getInt(6), - results.getObject(7, LocalDateTime::class.java), - results.getString(8) - ) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun updateBook( - title: String, - tags: String, - bookId: Int) { - conn.prepareStatement(updateBook).use { stmt -> - stmt.setString(1, title) - stmt.setString(2, tags) - stmt.setInt(3, bookId) - - stmt.execute() - } - } - - @Throws(SQLException::class) - override fun updateBookISBN( - title: String, - tags: String, - isbn: String, - bookId: Int) { - conn.prepareStatement(updateBookISBN).use { stmt -> - stmt.setString(1, title) - stmt.setString(2, tags) - stmt.setString(3, isbn) - stmt.setInt(4, bookId) - - stmt.execute() - } - } - -} - diff --git a/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/Models.kt b/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/Models.kt deleted file mode 100644 index 3f3d92ad58..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/Models.kt +++ /dev/null @@ -1,34 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.booktest.postgresql - -import java.time.OffsetDateTime - -enum class BookType(val value: String) { - FICTION("FICTION"), - NONFICTION("NONFICTION"); - - companion object { - private val map = BookType.values().associateBy(BookType::value) - fun lookup(value: String) = map[value] - } -} - -data class Author ( - val authorId: Int, - val name: String -) - -data class Book ( - val bookId: Int, - val authorId: Int, - val isbn: String, - val bookType: BookType, - val title: String, - val year: Int, - val available: OffsetDateTime, - val tags: List -) - diff --git a/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/Queries.kt b/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/Queries.kt deleted file mode 100644 index 207dbf84e7..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/Queries.kt +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.booktest.postgresql - -import java.sql.Connection -import java.sql.SQLException -import java.sql.Statement -import java.sql.Types -import java.time.OffsetDateTime - -interface Queries { - @Throws(SQLException::class) - fun booksByTags(dollar1: List): List - - @Throws(SQLException::class) - fun booksByTitleYear(title: String, year: Int): List - - @Throws(SQLException::class) - fun createAuthor(name: String): Author? - - @Throws(SQLException::class) - fun createBook( - authorId: Int, - isbn: String, - bookType: BookType, - title: String, - year: Int, - available: OffsetDateTime, - tags: List): Book? - - @Throws(SQLException::class) - fun deleteBook(bookId: Int) - - @Throws(SQLException::class) - fun getAuthor(authorId: Int): Author? - - @Throws(SQLException::class) - fun getBook(bookId: Int): Book? - - @Throws(SQLException::class) - fun updateBook( - title: String, - tags: List, - bookId: Int) - - @Throws(SQLException::class) - fun updateBookISBN( - title: String, - tags: List, - isbn: String, - bookId: Int) - -} - diff --git a/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/QueriesImpl.kt b/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/QueriesImpl.kt deleted file mode 100644 index f40ea684b0..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/QueriesImpl.kt +++ /dev/null @@ -1,282 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.booktest.postgresql - -import java.sql.Connection -import java.sql.SQLException -import java.sql.Statement -import java.sql.Types -import java.time.OffsetDateTime - -const val booksByTags = """-- name: booksByTags :many -SELECT - book_id, - title, - name, - isbn, - tags -FROM books -LEFT JOIN authors ON books.author_id = authors.author_id -WHERE tags && ?::varchar[] -""" - -data class BooksByTagsRow ( - val bookId: Int, - val title: String, - val name: String?, - val isbn: String, - val tags: List -) - -const val booksByTitleYear = """-- name: booksByTitleYear :many -SELECT book_id, author_id, isbn, book_type, title, year, available, tags FROM books -WHERE title = ? AND year = ? -""" - -const val createAuthor = """-- name: createAuthor :one -INSERT INTO authors (name) VALUES (?) -RETURNING author_id, name -""" - -const val createBook = """-- name: createBook :one -INSERT INTO books ( - author_id, - isbn, - book_type, - title, - year, - available, - tags -) VALUES ( - ?, - ?, - ?, - ?, - ?, - ?, - ? -) -RETURNING book_id, author_id, isbn, book_type, title, year, available, tags -""" - -const val deleteBook = """-- name: deleteBook :exec -DELETE FROM books -WHERE book_id = ? -""" - -const val getAuthor = """-- name: getAuthor :one -SELECT author_id, name FROM authors -WHERE author_id = ? -""" - -const val getBook = """-- name: getBook :one -SELECT book_id, author_id, isbn, book_type, title, year, available, tags FROM books -WHERE book_id = ? -""" - -const val updateBook = """-- name: updateBook :exec -UPDATE books -SET title = ?, tags = ? -WHERE book_id = ? -""" - -const val updateBookISBN = """-- name: updateBookISBN :exec -UPDATE books -SET title = ?, tags = ?, isbn = ? -WHERE book_id = ? -""" - -class QueriesImpl(private val conn: Connection) : Queries { - - @Throws(SQLException::class) - override fun booksByTags(dollar1: List): List { - return conn.prepareStatement(booksByTags).use { stmt -> - stmt.setArray(1, conn.createArrayOf("pg_catalog.varchar", dollar1.toTypedArray())) - - val results = stmt.executeQuery() - val ret = mutableListOf() - while (results.next()) { - ret.add(BooksByTagsRow( - results.getInt(1), - results.getString(2), - results.getString(3), - results.getString(4), - (results.getArray(5).array as Array).toList() - )) - } - ret - } - } - - @Throws(SQLException::class) - override fun booksByTitleYear(title: String, year: Int): List { - return conn.prepareStatement(booksByTitleYear).use { stmt -> - stmt.setString(1, title) - stmt.setInt(2, year) - - val results = stmt.executeQuery() - val ret = mutableListOf() - while (results.next()) { - ret.add(Book( - results.getInt(1), - results.getInt(2), - results.getString(3), - BookType.lookup(results.getString(4))!!, - results.getString(5), - results.getInt(6), - results.getObject(7, OffsetDateTime::class.java), - (results.getArray(8).array as Array).toList() - )) - } - ret - } - } - - @Throws(SQLException::class) - override fun createAuthor(name: String): Author? { - return conn.prepareStatement(createAuthor).use { stmt -> - stmt.setString(1, name) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = Author( - results.getInt(1), - results.getString(2) - ) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun createBook( - authorId: Int, - isbn: String, - bookType: BookType, - title: String, - year: Int, - available: OffsetDateTime, - tags: List): Book? { - return conn.prepareStatement(createBook).use { stmt -> - stmt.setInt(1, authorId) - stmt.setString(2, isbn) - stmt.setObject(3, bookType.value, Types.OTHER) - stmt.setString(4, title) - stmt.setInt(5, year) - stmt.setObject(6, available) - stmt.setArray(7, conn.createArrayOf("pg_catalog.varchar", tags.toTypedArray())) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = Book( - results.getInt(1), - results.getInt(2), - results.getString(3), - BookType.lookup(results.getString(4))!!, - results.getString(5), - results.getInt(6), - results.getObject(7, OffsetDateTime::class.java), - (results.getArray(8).array as Array).toList() - ) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun deleteBook(bookId: Int) { - conn.prepareStatement(deleteBook).use { stmt -> - stmt.setInt(1, bookId) - - stmt.execute() - } - } - - @Throws(SQLException::class) - override fun getAuthor(authorId: Int): Author? { - return conn.prepareStatement(getAuthor).use { stmt -> - stmt.setInt(1, authorId) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = Author( - results.getInt(1), - results.getString(2) - ) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun getBook(bookId: Int): Book? { - return conn.prepareStatement(getBook).use { stmt -> - stmt.setInt(1, bookId) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = Book( - results.getInt(1), - results.getInt(2), - results.getString(3), - BookType.lookup(results.getString(4))!!, - results.getString(5), - results.getInt(6), - results.getObject(7, OffsetDateTime::class.java), - (results.getArray(8).array as Array).toList() - ) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun updateBook( - title: String, - tags: List, - bookId: Int) { - conn.prepareStatement(updateBook).use { stmt -> - stmt.setString(1, title) - stmt.setArray(2, conn.createArrayOf("pg_catalog.varchar", tags.toTypedArray())) - stmt.setInt(3, bookId) - - stmt.execute() - } - } - - @Throws(SQLException::class) - override fun updateBookISBN( - title: String, - tags: List, - isbn: String, - bookId: Int) { - conn.prepareStatement(updateBookISBN).use { stmt -> - stmt.setString(1, title) - stmt.setArray(2, conn.createArrayOf("pg_catalog.varchar", tags.toTypedArray())) - stmt.setString(3, isbn) - stmt.setInt(4, bookId) - - stmt.execute() - } - } - -} - diff --git a/examples/kotlin/src/main/kotlin/com/example/jets/Models.kt b/examples/kotlin/src/main/kotlin/com/example/jets/Models.kt deleted file mode 100644 index 86e15ee2ed..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/jets/Models.kt +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.jets - -data class Jet ( - val id: Int, - val pilotId: Int, - val age: Int, - val name: String, - val color: String -) - -data class Language ( - val id: Int, - val language: String -) - -data class Pilot ( - val id: Int, - val name: String -) - -data class PilotLanguage ( - val pilotId: Int, - val languageId: Int -) - diff --git a/examples/kotlin/src/main/kotlin/com/example/jets/Queries.kt b/examples/kotlin/src/main/kotlin/com/example/jets/Queries.kt deleted file mode 100644 index d727ebb70f..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/jets/Queries.kt +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.jets - -import java.sql.Connection -import java.sql.SQLException -import java.sql.Statement - -interface Queries { - @Throws(SQLException::class) - fun countPilots(): Long? - - @Throws(SQLException::class) - fun deletePilot(id: Int) - - @Throws(SQLException::class) - fun listPilots(): List - -} - diff --git a/examples/kotlin/src/main/kotlin/com/example/jets/QueriesImpl.kt b/examples/kotlin/src/main/kotlin/com/example/jets/QueriesImpl.kt deleted file mode 100644 index 9b3f2b57c1..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/jets/QueriesImpl.kt +++ /dev/null @@ -1,67 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.jets - -import java.sql.Connection -import java.sql.SQLException -import java.sql.Statement - -const val countPilots = """-- name: countPilots :one -SELECT COUNT(*) FROM pilots -""" - -const val deletePilot = """-- name: deletePilot :exec -DELETE FROM pilots WHERE id = ? -""" - -const val listPilots = """-- name: listPilots :many -SELECT id, name FROM pilots LIMIT 5 -""" - -class QueriesImpl(private val conn: Connection) : Queries { - - @Throws(SQLException::class) - override fun countPilots(): Long? { - return conn.prepareStatement(countPilots).use { stmt -> - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = results.getLong(1) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun deletePilot(id: Int) { - conn.prepareStatement(deletePilot).use { stmt -> - stmt.setInt(1, id) - - stmt.execute() - } - } - - @Throws(SQLException::class) - override fun listPilots(): List { - return conn.prepareStatement(listPilots).use { stmt -> - - val results = stmt.executeQuery() - val ret = mutableListOf() - while (results.next()) { - ret.add(Pilot( - results.getInt(1), - results.getString(2) - )) - } - ret - } - } - -} - diff --git a/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/Models.kt b/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/Models.kt deleted file mode 100644 index 4cb2a95793..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/Models.kt +++ /dev/null @@ -1,40 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.ondeck.mysql - -import java.sql.Timestamp -import java.time.Instant - -enum class VenuesStatus(val value: String) { - OPEN("open"), - CLOSED("closed"); - - companion object { - private val map = VenuesStatus.values().associateBy(VenuesStatus::value) - fun lookup(value: String) = map[value] - } -} - -data class City ( - val slug: String, - val name: String -) - -// Venues are places where muisc happens -data class Venue ( - val id: Long, - // Venues can be either open or closed - val status: VenuesStatus, - val statuses: String?, - // This value appears in public URLs - val slug: String, - val name: String, - val city: String, - val spotifyPlaylist: String, - val songkickId: String?, - val tags: String?, - val createdAt: Instant -) - diff --git a/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/Queries.kt b/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/Queries.kt deleted file mode 100644 index 5e97478f49..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/Queries.kt +++ /dev/null @@ -1,52 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.ondeck.mysql - -import java.sql.Connection -import java.sql.SQLException -import java.sql.Statement -import java.sql.Timestamp -import java.time.Instant - -interface Queries { - @Throws(SQLException::class) - fun createCity(name: String, slug: String) - - @Throws(SQLException::class) - fun createVenue( - slug: String, - name: String, - city: String, - spotifyPlaylist: String, - status: VenuesStatus, - statuses: String?, - tags: String?): Long - - @Throws(SQLException::class) - fun deleteVenue(slug: String, slug_2: String) - - @Throws(SQLException::class) - fun getCity(slug: String): City? - - @Throws(SQLException::class) - fun getVenue(slug: String, city: String): Venue? - - @Throws(SQLException::class) - fun listCities(): List - - @Throws(SQLException::class) - fun listVenues(city: String): List - - @Throws(SQLException::class) - fun updateCityName(name: String, slug: String) - - @Throws(SQLException::class) - fun updateVenueName(name: String, slug: String) - - @Throws(SQLException::class) - fun venueCountByCity(): List - -} - diff --git a/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/QueriesImpl.kt b/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/QueriesImpl.kt deleted file mode 100644 index c3cba30364..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/QueriesImpl.kt +++ /dev/null @@ -1,278 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.ondeck.mysql - -import java.sql.Connection -import java.sql.SQLException -import java.sql.Statement -import java.sql.Timestamp -import java.time.Instant - -const val createCity = """-- name: createCity :exec -INSERT INTO city ( - name, - slug -) VALUES ( - ?, - ? -) -""" - -const val createVenue = """-- name: createVenue :execresult -INSERT INTO venue ( - slug, - name, - city, - created_at, - spotify_playlist, - status, - statuses, - tags -) VALUES ( - ?, - ?, - ?, - NOW(), - ?, - ?, - ?, - ? -) -""" - -const val deleteVenue = """-- name: deleteVenue :exec -DELETE FROM venue -WHERE slug = ? AND slug = ? -""" - -const val getCity = """-- name: getCity :one -SELECT slug, name -FROM city -WHERE slug = ? -""" - -const val getVenue = """-- name: getVenue :one -SELECT id, status, statuses, slug, name, city, spotify_playlist, songkick_id, tags, created_at -FROM venue -WHERE slug = ? AND city = ? -""" - -const val listCities = """-- name: listCities :many -SELECT slug, name -FROM city -ORDER BY name -""" - -const val listVenues = """-- name: listVenues :many -SELECT id, status, statuses, slug, name, city, spotify_playlist, songkick_id, tags, created_at -FROM venue -WHERE city = ? -ORDER BY name -""" - -const val updateCityName = """-- name: updateCityName :exec -UPDATE city -SET name = ? -WHERE slug = ? -""" - -const val updateVenueName = """-- name: updateVenueName :exec -UPDATE venue -SET name = ? -WHERE slug = ? -""" - -const val venueCountByCity = """-- name: venueCountByCity :many -SELECT - city, - count(*) -FROM venue -GROUP BY 1 -ORDER BY 1 -""" - -data class VenueCountByCityRow ( - val city: String, - val count: Long -) - -class QueriesImpl(private val conn: Connection) : Queries { - - @Throws(SQLException::class) - override fun createCity(name: String, slug: String) { - conn.prepareStatement(createCity).use { stmt -> - stmt.setString(1, name) - stmt.setString(2, slug) - - stmt.execute() - } - } - - @Throws(SQLException::class) - override fun createVenue( - slug: String, - name: String, - city: String, - spotifyPlaylist: String, - status: VenuesStatus, - statuses: String?, - tags: String?): Long { - return conn.prepareStatement(createVenue, Statement.RETURN_GENERATED_KEYS).use { stmt -> - stmt.setString(1, slug) - stmt.setString(2, name) - stmt.setString(3, city) - stmt.setString(4, spotifyPlaylist) - stmt.setString(5, status.value) - stmt.setString(6, statuses) - stmt.setString(7, tags) - - stmt.execute() - - val results = stmt.generatedKeys - if (!results.next()) { - throw SQLException("no generated key returned") - } - results.getLong(1) - } - } - - @Throws(SQLException::class) - override fun deleteVenue(slug: String, slug_2: String) { - conn.prepareStatement(deleteVenue).use { stmt -> - stmt.setString(1, slug) - stmt.setString(2, slug_2) - - stmt.execute() - } - } - - @Throws(SQLException::class) - override fun getCity(slug: String): City? { - return conn.prepareStatement(getCity).use { stmt -> - stmt.setString(1, slug) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = City( - results.getString(1), - results.getString(2) - ) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun getVenue(slug: String, city: String): Venue? { - return conn.prepareStatement(getVenue).use { stmt -> - stmt.setString(1, slug) - stmt.setString(2, city) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = Venue( - results.getLong(1), - VenuesStatus.lookup(results.getString(2))!!, - results.getString(3), - results.getString(4), - results.getString(5), - results.getString(6), - results.getString(7), - results.getString(8), - results.getString(9), - results.getTimestamp(10).toInstant() - ) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun listCities(): List { - return conn.prepareStatement(listCities).use { stmt -> - - val results = stmt.executeQuery() - val ret = mutableListOf() - while (results.next()) { - ret.add(City( - results.getString(1), - results.getString(2) - )) - } - ret - } - } - - @Throws(SQLException::class) - override fun listVenues(city: String): List { - return conn.prepareStatement(listVenues).use { stmt -> - stmt.setString(1, city) - - val results = stmt.executeQuery() - val ret = mutableListOf() - while (results.next()) { - ret.add(Venue( - results.getLong(1), - VenuesStatus.lookup(results.getString(2))!!, - results.getString(3), - results.getString(4), - results.getString(5), - results.getString(6), - results.getString(7), - results.getString(8), - results.getString(9), - results.getTimestamp(10).toInstant() - )) - } - ret - } - } - - @Throws(SQLException::class) - override fun updateCityName(name: String, slug: String) { - conn.prepareStatement(updateCityName).use { stmt -> - stmt.setString(1, name) - stmt.setString(2, slug) - - stmt.execute() - } - } - - @Throws(SQLException::class) - override fun updateVenueName(name: String, slug: String) { - conn.prepareStatement(updateVenueName).use { stmt -> - stmt.setString(1, name) - stmt.setString(2, slug) - - stmt.execute() - } - } - - @Throws(SQLException::class) - override fun venueCountByCity(): List { - return conn.prepareStatement(venueCountByCity).use { stmt -> - - val results = stmt.executeQuery() - val ret = mutableListOf() - while (results.next()) { - ret.add(VenueCountByCityRow( - results.getString(1), - results.getLong(2) - )) - } - ret - } - } - -} - diff --git a/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/Models.kt b/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/Models.kt deleted file mode 100644 index 69c9c622d7..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/Models.kt +++ /dev/null @@ -1,39 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.ondeck.postgresql - -import java.time.LocalDateTime - -// Venues can be either open or closed -enum class Status(val value: String) { - OPEN("op!en"), - CLOSED("clo@sed"); - - companion object { - private val map = Status.values().associateBy(Status::value) - fun lookup(value: String) = map[value] - } -} - -data class City ( - val slug: String, - val name: String -) - -// Venues are places where muisc happens -data class Venue ( - val id: Int, - val status: Status, - val statuses: List, - // This value appears in public URLs - val slug: String, - val name: String, - val city: String, - val spotifyPlaylist: String, - val songkickId: String?, - val tags: List, - val createdAt: LocalDateTime -) - diff --git a/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/Queries.kt b/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/Queries.kt deleted file mode 100644 index e564af4e33..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/Queries.kt +++ /dev/null @@ -1,52 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.ondeck.postgresql - -import java.sql.Connection -import java.sql.SQLException -import java.sql.Statement -import java.sql.Types -import java.time.LocalDateTime - -interface Queries { - @Throws(SQLException::class) - fun createCity(name: String, slug: String): City? - - @Throws(SQLException::class) - fun createVenue( - slug: String, - name: String, - city: String, - spotifyPlaylist: String, - status: Status, - statuses: List, - tags: List): Int? - - @Throws(SQLException::class) - fun deleteVenue(slug: String) - - @Throws(SQLException::class) - fun getCity(slug: String): City? - - @Throws(SQLException::class) - fun getVenue(slug: String, city: String): Venue? - - @Throws(SQLException::class) - fun listCities(): List - - @Throws(SQLException::class) - fun listVenues(city: String): List - - @Throws(SQLException::class) - fun updateCityName(name: String, slug: String) - - @Throws(SQLException::class) - fun updateVenueName(name: String, slug: String): Int? - - @Throws(SQLException::class) - fun venueCountByCity(): List - -} - diff --git a/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/QueriesImpl.kt b/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/QueriesImpl.kt deleted file mode 100644 index a4d1dca384..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/QueriesImpl.kt +++ /dev/null @@ -1,304 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.ondeck.postgresql - -import java.sql.Connection -import java.sql.SQLException -import java.sql.Statement -import java.sql.Types -import java.time.LocalDateTime - -const val createCity = """-- name: createCity :one -INSERT INTO city ( - name, - slug -) VALUES ( - ?, - ? -) RETURNING slug, name -""" - -const val createVenue = """-- name: createVenue :one -INSERT INTO venue ( - slug, - name, - city, - created_at, - spotify_playlist, - status, - statuses, - tags -) VALUES ( - ?, - ?, - ?, - NOW(), - ?, - ?, - ?, - ? -) RETURNING id -""" - -const val deleteVenue = """-- name: deleteVenue :exec -DELETE FROM venue -WHERE slug = ? AND slug = ? -""" - -const val getCity = """-- name: getCity :one -SELECT slug, name -FROM city -WHERE slug = ? -""" - -const val getVenue = """-- name: getVenue :one -SELECT id, status, statuses, slug, name, city, spotify_playlist, songkick_id, tags, created_at -FROM venue -WHERE slug = ? AND city = ? -""" - -const val listCities = """-- name: listCities :many -SELECT slug, name -FROM city -ORDER BY name -""" - -const val listVenues = """-- name: listVenues :many -SELECT id, status, statuses, slug, name, city, spotify_playlist, songkick_id, tags, created_at -FROM venue -WHERE city = ? -ORDER BY name -""" - -const val updateCityName = """-- name: updateCityName :exec -UPDATE city -SET name = ? -WHERE slug = ? -""" - -const val updateVenueName = """-- name: updateVenueName :one -UPDATE venue -SET name = ? -WHERE slug = ? -RETURNING id -""" - -const val venueCountByCity = """-- name: venueCountByCity :many -SELECT - city, - count(*) -FROM venue -GROUP BY 1 -ORDER BY 1 -""" - -data class VenueCountByCityRow ( - val city: String, - val count: Long -) - -class QueriesImpl(private val conn: Connection) : Queries { - -// Create a new city. The slug must be unique. -// This is the second line of the comment -// This is the third line - - @Throws(SQLException::class) - override fun createCity(name: String, slug: String): City? { - return conn.prepareStatement(createCity).use { stmt -> - stmt.setString(1, name) - stmt.setString(2, slug) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = City( - results.getString(1), - results.getString(2) - ) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun createVenue( - slug: String, - name: String, - city: String, - spotifyPlaylist: String, - status: Status, - statuses: List, - tags: List): Int? { - return conn.prepareStatement(createVenue).use { stmt -> - stmt.setString(1, slug) - stmt.setString(2, name) - stmt.setString(3, city) - stmt.setString(4, spotifyPlaylist) - stmt.setObject(5, status.value, Types.OTHER) - stmt.setArray(6, conn.createArrayOf("status", statuses.map { v -> v.value }.toTypedArray())) - stmt.setArray(7, conn.createArrayOf("text", tags.toTypedArray())) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = results.getInt(1) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun deleteVenue(slug: String) { - conn.prepareStatement(deleteVenue).use { stmt -> - stmt.setString(1, slug) - stmt.setString(2, slug) - - stmt.execute() - } - } - - @Throws(SQLException::class) - override fun getCity(slug: String): City? { - return conn.prepareStatement(getCity).use { stmt -> - stmt.setString(1, slug) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = City( - results.getString(1), - results.getString(2) - ) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun getVenue(slug: String, city: String): Venue? { - return conn.prepareStatement(getVenue).use { stmt -> - stmt.setString(1, slug) - stmt.setString(2, city) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = Venue( - results.getInt(1), - Status.lookup(results.getString(2))!!, - (results.getArray(3).array as Array).map { v -> Status.lookup(v)!! }.toList(), - results.getString(4), - results.getString(5), - results.getString(6), - results.getString(7), - results.getString(8), - (results.getArray(9).array as Array).toList(), - results.getObject(10, LocalDateTime::class.java) - ) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun listCities(): List { - return conn.prepareStatement(listCities).use { stmt -> - - val results = stmt.executeQuery() - val ret = mutableListOf() - while (results.next()) { - ret.add(City( - results.getString(1), - results.getString(2) - )) - } - ret - } - } - - @Throws(SQLException::class) - override fun listVenues(city: String): List { - return conn.prepareStatement(listVenues).use { stmt -> - stmt.setString(1, city) - - val results = stmt.executeQuery() - val ret = mutableListOf() - while (results.next()) { - ret.add(Venue( - results.getInt(1), - Status.lookup(results.getString(2))!!, - (results.getArray(3).array as Array).map { v -> Status.lookup(v)!! }.toList(), - results.getString(4), - results.getString(5), - results.getString(6), - results.getString(7), - results.getString(8), - (results.getArray(9).array as Array).toList(), - results.getObject(10, LocalDateTime::class.java) - )) - } - ret - } - } - - @Throws(SQLException::class) - override fun updateCityName(name: String, slug: String) { - conn.prepareStatement(updateCityName).use { stmt -> - stmt.setString(1, name) - stmt.setString(2, slug) - - stmt.execute() - } - } - - @Throws(SQLException::class) - override fun updateVenueName(name: String, slug: String): Int? { - return conn.prepareStatement(updateVenueName).use { stmt -> - stmt.setString(1, name) - stmt.setString(2, slug) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = results.getInt(1) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun venueCountByCity(): List { - return conn.prepareStatement(venueCountByCity).use { stmt -> - - val results = stmt.executeQuery() - val ret = mutableListOf() - while (results.next()) { - ret.add(VenueCountByCityRow( - results.getString(1), - results.getLong(2) - )) - } - ret - } - } - -} - diff --git a/examples/kotlin/src/main/resources/authors b/examples/kotlin/src/main/resources/authors deleted file mode 120000 index f391af0e5a..0000000000 --- a/examples/kotlin/src/main/resources/authors +++ /dev/null @@ -1 +0,0 @@ -../../../../authors \ No newline at end of file diff --git a/examples/kotlin/src/main/resources/booktest b/examples/kotlin/src/main/resources/booktest deleted file mode 120000 index a397d4ae21..0000000000 --- a/examples/kotlin/src/main/resources/booktest +++ /dev/null @@ -1 +0,0 @@ -../../../../booktest \ No newline at end of file diff --git a/examples/kotlin/src/main/resources/jets b/examples/kotlin/src/main/resources/jets deleted file mode 120000 index 24ed880a40..0000000000 --- a/examples/kotlin/src/main/resources/jets +++ /dev/null @@ -1 +0,0 @@ -../../../../jets \ No newline at end of file diff --git a/examples/kotlin/src/main/resources/ondeck b/examples/kotlin/src/main/resources/ondeck deleted file mode 120000 index 37517cb367..0000000000 --- a/examples/kotlin/src/main/resources/ondeck +++ /dev/null @@ -1 +0,0 @@ -../../../../ondeck \ No newline at end of file diff --git a/examples/kotlin/src/test/kotlin/com/example/authors/mysql/QueriesImplTest.kt b/examples/kotlin/src/test/kotlin/com/example/authors/mysql/QueriesImplTest.kt deleted file mode 100644 index 3cb7d7887d..0000000000 --- a/examples/kotlin/src/test/kotlin/com/example/authors/mysql/QueriesImplTest.kt +++ /dev/null @@ -1,65 +0,0 @@ -package com.example.authors.mysql - -import com.example.dbtest.MysqlDbTestExtension -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.RegisterExtension - -class QueriesImplTest() { - - companion object { - @JvmField - @RegisterExtension - val dbtest = MysqlDbTestExtension("src/main/resources/authors/mysql/schema.sql") - } - - @Test - fun testCreateAuthor() { - val db = QueriesImpl(dbtest.getConnection()) - - val initialAuthors = db.listAuthors() - assert(initialAuthors.isEmpty()) - - val name = "Brian Kernighan" - val bio = "Co-author of The C Programming Language and The Go Programming Language" - val id = db.createAuthor( - name = name, - bio = bio - ) - assertEquals(id, 1) - val expectedAuthor = Author(id, name, bio) - - val fetchedAuthor = db.getAuthor(id) - assertEquals(expectedAuthor, fetchedAuthor) - - val listedAuthors = db.listAuthors() - assertEquals(1, listedAuthors.size) - assertEquals(expectedAuthor, listedAuthors[0]) - - val id2 = db.createAuthor( - name = name, - bio = bio - ) - assertEquals(id2, 2) - } - - @Test - fun testNull() { - val db = QueriesImpl(dbtest.getConnection()) - - val initialAuthors = db.listAuthors() - assert(initialAuthors.isEmpty()) - - val name = "Brian Kernighan" - val bio = null - val id = db.createAuthor(name, bio) - val expectedAuthor = Author(id, name, bio) - - val fetchedAuthor = db.getAuthor(id) - assertEquals(expectedAuthor, fetchedAuthor) - - val listedAuthors = db.listAuthors() - assertEquals(1, listedAuthors.size) - assertEquals(expectedAuthor, listedAuthors[0]) - } -} diff --git a/examples/kotlin/src/test/kotlin/com/example/authors/postgresql/QueriesImplTest.kt b/examples/kotlin/src/test/kotlin/com/example/authors/postgresql/QueriesImplTest.kt deleted file mode 100644 index 86c24fb68c..0000000000 --- a/examples/kotlin/src/test/kotlin/com/example/authors/postgresql/QueriesImplTest.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.example.authors.postgresql - -import com.example.dbtest.PostgresDbTestExtension -import org.junit.jupiter.api.Assertions -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.RegisterExtension - -class QueriesImplTest() { - - companion object { - @JvmField - @RegisterExtension - val dbtest = PostgresDbTestExtension("src/main/resources/authors/postgresql/schema.sql") - } - - @Test - fun testCreateAuthor() { - val db = QueriesImpl(dbtest.getConnection()) - - val initialAuthors = db.listAuthors() - assert(initialAuthors.isEmpty()) - - val name = "Brian Kernighan" - val bio = "Co-author of The C Programming Language and The Go Programming Language" - val insertedAuthor = db.createAuthor( - name = name, - bio = bio - )!! - val expectedAuthor = Author(insertedAuthor.id, name, bio) - Assertions.assertEquals(expectedAuthor, insertedAuthor) - - val fetchedAuthor = db.getAuthor(insertedAuthor.id) - Assertions.assertEquals(expectedAuthor, fetchedAuthor) - - val listedAuthors = db.listAuthors() - Assertions.assertEquals(1, listedAuthors.size) - Assertions.assertEquals(expectedAuthor, listedAuthors[0]) - } - - @Test - fun testNull() { - val db = QueriesImpl(dbtest.getConnection()) - - val initialAuthors = db.listAuthors() - assert(initialAuthors.isEmpty()) - - val name = "Brian Kernighan" - val bio = null - val insertedAuthor = db.createAuthor(name, bio)!! - val expectedAuthor = Author(insertedAuthor.id, name, bio) - Assertions.assertEquals(expectedAuthor, insertedAuthor) - - val fetchedAuthor = db.getAuthor(insertedAuthor.id) - Assertions.assertEquals(expectedAuthor, fetchedAuthor) - - val listedAuthors = db.listAuthors() - Assertions.assertEquals(1, listedAuthors.size) - Assertions.assertEquals(expectedAuthor, listedAuthors[0]) - } -} \ No newline at end of file diff --git a/examples/kotlin/src/test/kotlin/com/example/booktest/mysql/QueriesImplTest.kt b/examples/kotlin/src/test/kotlin/com/example/booktest/mysql/QueriesImplTest.kt deleted file mode 100644 index f69cd85e12..0000000000 --- a/examples/kotlin/src/test/kotlin/com/example/booktest/mysql/QueriesImplTest.kt +++ /dev/null @@ -1,98 +0,0 @@ -package com.example.booktest.mysql - -import com.example.dbtest.MysqlDbTestExtension -import com.example.dbtest.PostgresDbTestExtension -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.RegisterExtension -import java.time.LocalDateTime -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter - -class QueriesImplTest { - companion object { - @JvmField @RegisterExtension val dbtest = MysqlDbTestExtension("src/main/resources/booktest/mysql/schema.sql") - } - - @Test - fun testQueries() { - val conn = dbtest.getConnection() - val db = QueriesImpl(conn) - val authorId = db.createAuthor("Unknown Master") - val author = db.getAuthor(authorId.toInt())!! - - // Start a transaction - conn.autoCommit = false - db.createBook( - authorId = author.authorId, - isbn = "1", - title = "my book title", - bookType = BooksBookType.NONFICTION, - yr = 2016, - available = LocalDateTime.now(), - tags = "" - ) - - val b1Id = db.createBook( - authorId = author.authorId, - isbn = "2", - title = "the second book", - bookType = BooksBookType.NONFICTION, - yr = 2016, - available = LocalDateTime.now(), - tags = listOf("cool", "unique").joinToString(",") - ) - - db.updateBook( - bookId = b1Id.toInt(), - title = "changed second title", - tags = listOf("cool", "disastor").joinToString(",") - ) - - val b3Id = db.createBook( - authorId = author.authorId, - isbn = "3", - title = "the third book", - bookType = BooksBookType.NONFICTION, - yr = 2001, - available = LocalDateTime.now(), - tags = listOf("cool").joinToString(",") - ) - - db.createBook( - authorId = author.authorId, - isbn = "4", - title = "4th place finisher", - bookType = BooksBookType.NONFICTION, - yr = 2011, - available = LocalDateTime.now(), - tags = listOf("other").joinToString(",") - ) - - // Commit transaction - conn.commit() - conn.autoCommit = true - - db.updateBookISBN( - bookId = b3Id.toInt(), - isbn = "NEW ISBN", - title = "never ever gonna finish, a quatrain", - tags = listOf("someother").joinToString(",") - ) - - val books0 = db.booksByTitleYear("my book title", 2016) - - val formatter = DateTimeFormatter.ISO_DATE_TIME - for (book in books0) { - println("Book ${book.bookId} (${book.bookType}): ${book.title} available: ${book.available.format(formatter)}") - val author2 = db.getAuthor(book.authorId)!! - println("Book ${book.bookId} author: ${author2.name}") - } - - // find a book with either "cool" or "other" tag - println("---------\\nTag search results:\\n") - val res = db.booksByTags(listOf("cool", "other", "someother").joinToString(",")) - for (ab in res) { - println("Book ${ab.bookId}: '${ab.title}', Author: '${ab.name}', ISBN: '${ab.isbn}' Tags: '${ab.tags.toList()}'") - } - } -} \ No newline at end of file diff --git a/examples/kotlin/src/test/kotlin/com/example/booktest/postgresql/QueriesImplTest.kt b/examples/kotlin/src/test/kotlin/com/example/booktest/postgresql/QueriesImplTest.kt deleted file mode 100644 index 1a4316123d..0000000000 --- a/examples/kotlin/src/test/kotlin/com/example/booktest/postgresql/QueriesImplTest.kt +++ /dev/null @@ -1,97 +0,0 @@ -package com.example.booktest.postgresql - -import com.example.dbtest.PostgresDbTestExtension -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.RegisterExtension -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter - -class QueriesImplTest { - companion object { - @JvmField @RegisterExtension val dbtest = PostgresDbTestExtension("src/main/resources/booktest/postgresql/schema.sql") - } - - @Test - fun testQueries() { - val conn = dbtest.getConnection() - val db = QueriesImpl(conn) - val author = db.createAuthor("Unknown Master")!! - - // Start a transaction - conn.autoCommit = false - db.createBook( - authorId = author.authorId, - isbn = "1", - title = "my book title", - bookType = BookType.NONFICTION, - year = 2016, - available = OffsetDateTime.now(), - tags = listOf() - ) - - val b1 = db.createBook( - authorId = author.authorId, - isbn = "2", - title = "the second book", - bookType = BookType.NONFICTION, - year = 2016, - available = OffsetDateTime.now(), - tags = listOf("cool", "unique") - )!! - - db.updateBook( - bookId = b1.bookId, - title = "changed second title", - tags = listOf("cool", "disastor") - ) - - val b3 = db.createBook( - authorId = author.authorId, - isbn = "3", - title = "the third book", - bookType = BookType.NONFICTION, - year = 2001, - available = OffsetDateTime.now(), - tags = listOf("cool") - )!! - - db.createBook( - authorId = author.authorId, - isbn = "4", - title = "4th place finisher", - bookType = BookType.NONFICTION, - year = 2011, - available = OffsetDateTime.now(), - tags = listOf("other") - ) - - // Commit transaction - conn.commit() - conn.autoCommit = true - - // ISBN update fails because parameters are not in sequential order. After changing $N to ?, ordering is lost, - // and the parameters are filled into the wrong slots. - db.updateBookISBN( - bookId = b3.bookId, - isbn = "NEW ISBN", - title = "never ever gonna finish, a quatrain", - tags = listOf("someother") - ) - - val books0 = db.booksByTitleYear("my book title", 2016) - - val formatter = DateTimeFormatter.ISO_DATE_TIME - for (book in books0) { - println("Book ${book.bookId} (${book.bookType}): ${book.title} available: ${book.available.format(formatter)}") - val author2 = db.getAuthor(book.authorId)!! - println("Book ${book.bookId} author: ${author2.name}") - } - - // find a book with either "cool" or "other" tag - println("---------\\nTag search results:\\n") - val res = db.booksByTags(listOf("cool", "other", "someother")) - for (ab in res) { - println("Book ${ab.bookId}: '${ab.title}', Author: '${ab.name}', ISBN: '${ab.isbn}' Tags: '${ab.tags.toList()}'") - } - } -} \ No newline at end of file diff --git a/examples/kotlin/src/test/kotlin/com/example/dbtest/MysqlDbTestExtension.kt b/examples/kotlin/src/test/kotlin/com/example/dbtest/MysqlDbTestExtension.kt deleted file mode 100644 index 243a441476..0000000000 --- a/examples/kotlin/src/test/kotlin/com/example/dbtest/MysqlDbTestExtension.kt +++ /dev/null @@ -1,46 +0,0 @@ -package com.example.dbtest - -import org.junit.jupiter.api.extension.AfterEachCallback -import org.junit.jupiter.api.extension.BeforeEachCallback -import org.junit.jupiter.api.extension.ExtensionContext -import java.nio.file.Files -import java.nio.file.Paths -import java.sql.Connection -import java.sql.DriverManager -import kotlin.streams.toList - - -class MysqlDbTestExtension(private val migrationsPath: String) : BeforeEachCallback, AfterEachCallback { - val user = System.getenv("MYSQL_USER") ?: "root" - val pass = System.getenv("MYSQL_ROOT_PASSWORD") ?: "mysecretpassword" - val host = System.getenv("MYSQL_HOST") ?: "127.0.0.1" - val port = System.getenv("MYSQL_PORT") ?: "3306" - val mainDb = System.getenv("MYSQL_DATABASE") ?: "dinotest" - val testDb = "sqltest_mysql" - - override fun beforeEach(context: ExtensionContext) { - getConnection(mainDb).createStatement().execute("CREATE DATABASE $testDb") - val path = Paths.get(migrationsPath) - val migrations = if (Files.isDirectory(path)) { - Files.list(path).filter { it.toString().endsWith(".sql") }.sorted().map { Files.readString(it) }.toList() - } else { - listOf(Files.readString(path)) - } - migrations.forEach { - getConnection().createStatement().execute(it) - } - } - - override fun afterEach(context: ExtensionContext) { - getConnection(mainDb).createStatement().execute("DROP DATABASE $testDb") - } - - private fun getConnection(db: String): Connection { - val url = "jdbc:mysql://$host:$port/$db?user=$user&password=$pass&allowMultiQueries=true" - return DriverManager.getConnection(url) - } - - fun getConnection(): Connection { - return getConnection(testDb) - } -} \ No newline at end of file diff --git a/examples/kotlin/src/test/kotlin/com/example/dbtest/PostgresDbTestExtension.kt b/examples/kotlin/src/test/kotlin/com/example/dbtest/PostgresDbTestExtension.kt deleted file mode 100644 index 55a7d6f91d..0000000000 --- a/examples/kotlin/src/test/kotlin/com/example/dbtest/PostgresDbTestExtension.kt +++ /dev/null @@ -1,51 +0,0 @@ -package com.example.dbtest - -import org.junit.jupiter.api.extension.AfterEachCallback -import org.junit.jupiter.api.extension.BeforeEachCallback -import org.junit.jupiter.api.extension.ExtensionContext -import java.nio.file.Files -import java.nio.file.Paths -import java.sql.Connection -import java.sql.DriverManager -import kotlin.streams.toList - -class PostgresDbTestExtension(private val migrationsPath: String) : BeforeEachCallback, AfterEachCallback { - private val schemaConn: Connection - private val url: String - - companion object { - const val schema = "dinosql_test" - } - - init { - val user = System.getenv("PG_USER") ?: "postgres" - val pass = System.getenv("PG_PASSWORD") ?: "mysecretpassword" - val host = System.getenv("PG_HOST") ?: "127.0.0.1" - val port = System.getenv("PG_PORT") ?: "5432" - val db = System.getenv("PG_DATABASE") ?: "dinotest" - url = "jdbc:postgresql://$host:$port/$db?user=$user&password=$pass&sslmode=disable" - - schemaConn = DriverManager.getConnection(url) - } - - override fun beforeEach(context: ExtensionContext) { - schemaConn.createStatement().execute("CREATE SCHEMA $schema") - val path = Paths.get(migrationsPath) - val migrations = if (Files.isDirectory(path)) { - Files.list(path).filter{ it.toString().endsWith(".sql")}.sorted().map { Files.readString(it) }.toList() - } else { - listOf(Files.readString(path)) - } - migrations.forEach { - getConnection().createStatement().execute(it) - } - } - - override fun afterEach(context: ExtensionContext) { - schemaConn.createStatement().execute("DROP SCHEMA $schema CASCADE") - } - - fun getConnection(): Connection { - return DriverManager.getConnection("$url¤tSchema=$schema") - } -} \ No newline at end of file diff --git a/examples/kotlin/src/test/kotlin/com/example/ondeck/mysql/QueriesImplTest.kt b/examples/kotlin/src/test/kotlin/com/example/ondeck/mysql/QueriesImplTest.kt deleted file mode 100644 index e946157bab..0000000000 --- a/examples/kotlin/src/test/kotlin/com/example/ondeck/mysql/QueriesImplTest.kt +++ /dev/null @@ -1,50 +0,0 @@ -package com.example.ondeck.mysql - -import com.example.dbtest.MysqlDbTestExtension -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.RegisterExtension - -class QueriesImplTest { - companion object { - @JvmField - @RegisterExtension - val dbtest = MysqlDbTestExtension("src/main/resources/ondeck/mysql/schema") - } - - @Test - fun testQueries() { - val q = QueriesImpl(dbtest.getConnection()) - q.createCity( - slug = "san-francisco", - name = "San Francisco" - ) - val city = q.listCities()[0] - val venueId = q.createVenue( - slug = "the-fillmore", - name = "The Fillmore", - city = city.slug, - spotifyPlaylist = "spotify=uri", - status = VenuesStatus.OPEN, - statuses = listOf(VenuesStatus.OPEN, VenuesStatus.CLOSED).joinToString(","), - tags = listOf("rock", "punk").joinToString(",") - ) - val venue = q.getVenue( - slug = "the-fillmore", - city = city.slug - )!! - assertEquals(venueId, venue.id) - - assertEquals(city, q.getCity(city.slug)) - assertEquals(listOf(VenueCountByCityRow(city.slug, 1)), q.venueCountByCity()) - assertEquals(listOf(city), q.listCities()) - assertEquals(listOf(venue), q.listVenues(city.slug)) - - q.updateCityName(slug = city.slug, name = "SF") - q.updateVenueName(slug = venue.slug, name = "Fillmore") - val fresh = q.getVenue(venue.slug, city.slug)!! - assertEquals("Fillmore", fresh.name) - - q.deleteVenue(venue.slug, venue.slug) - } -} diff --git a/examples/kotlin/src/test/kotlin/com/example/ondeck/postgresql/QueriesImplTest.kt b/examples/kotlin/src/test/kotlin/com/example/ondeck/postgresql/QueriesImplTest.kt deleted file mode 100644 index 990f4398d1..0000000000 --- a/examples/kotlin/src/test/kotlin/com/example/ondeck/postgresql/QueriesImplTest.kt +++ /dev/null @@ -1,46 +0,0 @@ -package com.example.ondeck.postgresql - -import com.example.dbtest.PostgresDbTestExtension -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.RegisterExtension - -class QueriesImplTest { - companion object { - @JvmField @RegisterExtension val dbtest = PostgresDbTestExtension("src/main/resources/ondeck/postgresql/schema") - } - - @Test - fun testQueries() { - val q = QueriesImpl(dbtest.getConnection()) - val city = q.createCity( - slug = "san-francisco", - name = "San Francisco" - )!! - val venueId = q.createVenue( - slug = "the-fillmore", - name = "The Fillmore", - city = city.slug, - spotifyPlaylist = "spotify=uri", - status = Status.OPEN, - statuses = listOf(Status.OPEN, Status.CLOSED), - tags = listOf("rock", "punk") - ) - val venue = q.getVenue( - slug = "the-fillmore", - city = city.slug - )!! - assertEquals(venueId, venue.id) - - assertEquals(city, q.getCity(city.slug)) - assertEquals(listOf(VenueCountByCityRow(city.slug, 1)), q.venueCountByCity()) - assertEquals(listOf(city), q.listCities()) - assertEquals(listOf(venue), q.listVenues(city.slug)) - - q.updateCityName(slug = city.slug, name = "SF") - val id = q.updateVenueName(slug = venue.slug, name = "Fillmore") - assertEquals(venue.id, id) - - q.deleteVenue(venue.slug) - } -} diff --git a/examples/ondeck/mysql/city.sql.go b/examples/ondeck/mysql/city.sql.go index ca691a7b61..b1476a1c44 100644 --- a/examples/ondeck/mysql/city.sql.go +++ b/examples/ondeck/mysql/city.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: city.sql package ondeck diff --git a/examples/ondeck/mysql/db.go b/examples/ondeck/mysql/db.go index 06afcda08e..273ff8b8cf 100644 --- a/examples/ondeck/mysql/db.go +++ b/examples/ondeck/mysql/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package ondeck diff --git a/examples/ondeck/mysql/db_test.go b/examples/ondeck/mysql/db_test.go index b4b343f9dc..6ac70aaf06 100644 --- a/examples/ondeck/mysql/db_test.go +++ b/examples/ondeck/mysql/db_test.go @@ -1,5 +1,4 @@ //go:build examples -// +build examples package ondeck @@ -9,9 +8,10 @@ import ( "strings" "testing" - "github.com/sqlc-dev/sqlc/internal/sqltest" - + _ "github.com/go-sql-driver/mysql" "github.com/google/go-cmp/cmp" + + "github.com/sqlc-dev/sqlc/internal/sqltest/local" ) func join(vals ...string) sql.NullString { @@ -45,8 +45,8 @@ func runOnDeckQueries(t *testing.T, q *Queries) { Name: "The Fillmore", City: city.Slug, SpotifyPlaylist: "spotify:uri", - Status: VenuesStatusOpen, - Statuses: join(string(VenuesStatusOpen), string(VenuesStatusClosed)), + Status: VenueStatusOpen, + Statuses: join(string(VenueStatusOpen), string(VenueStatusClosed)), Tags: join("rock", "punk"), }) if err != nil { @@ -143,10 +143,14 @@ func runOnDeckQueries(t *testing.T, q *Queries) { func TestPrepared(t *testing.T) { t.Parallel() - sdb, cleanup := sqltest.MySQL(t, []string{"schema"}) - defer cleanup() + uri := local.MySQL(t, []string{"schema"}) + db, err := sql.Open("mysql", uri) + if err != nil { + t.Fatalf("%s: %s", uri, err) + } + defer db.Close() - q, err := Prepare(context.Background(), sdb) + q, err := Prepare(context.Background(), db) if err != nil { t.Fatal(err) } @@ -157,8 +161,12 @@ func TestPrepared(t *testing.T) { func TestQueries(t *testing.T) { t.Parallel() - sdb, cleanup := sqltest.MySQL(t, []string{"schema"}) - defer cleanup() + uri := local.MySQL(t, []string{"schema"}) + db, err := sql.Open("mysql", uri) + if err != nil { + t.Fatalf("%s: %s", uri, err) + } + defer db.Close() - runOnDeckQueries(t, New(sdb)) + runOnDeckQueries(t, New(db)) } diff --git a/examples/ondeck/mysql/models.go b/examples/ondeck/mysql/models.go index 0ca972f6a0..aab664813c 100644 --- a/examples/ondeck/mysql/models.go +++ b/examples/ondeck/mysql/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package ondeck @@ -11,46 +11,46 @@ import ( "time" ) -type VenuesStatus string +type VenueStatus string const ( - VenuesStatusOpen VenuesStatus = "open" - VenuesStatusClosed VenuesStatus = "closed" + VenueStatusOpen VenueStatus = "open" + VenueStatusClosed VenueStatus = "closed" ) -func (e *VenuesStatus) Scan(src interface{}) error { +func (e *VenueStatus) Scan(src interface{}) error { switch s := src.(type) { case []byte: - *e = VenuesStatus(s) + *e = VenueStatus(s) case string: - *e = VenuesStatus(s) + *e = VenueStatus(s) default: - return fmt.Errorf("unsupported scan type for VenuesStatus: %T", src) + return fmt.Errorf("unsupported scan type for VenueStatus: %T", src) } return nil } -type NullVenuesStatus struct { - VenuesStatus VenuesStatus `json:"venues_status"` - Valid bool `json:"valid"` // Valid is true if VenuesStatus is not NULL +type NullVenueStatus struct { + VenueStatus VenueStatus `json:"venue_status"` + Valid bool `json:"valid"` // Valid is true if VenueStatus is not NULL } // Scan implements the Scanner interface. -func (ns *NullVenuesStatus) Scan(value interface{}) error { +func (ns *NullVenueStatus) Scan(value interface{}) error { if value == nil { - ns.VenuesStatus, ns.Valid = "", false + ns.VenueStatus, ns.Valid = "", false return nil } ns.Valid = true - return ns.VenuesStatus.Scan(value) + return ns.VenueStatus.Scan(value) } // Value implements the driver Valuer interface. -func (ns NullVenuesStatus) Value() (driver.Value, error) { +func (ns NullVenueStatus) Value() (driver.Value, error) { if !ns.Valid { return nil, nil } - return string(ns.VenuesStatus), nil + return string(ns.VenueStatus), nil } type City struct { @@ -62,7 +62,7 @@ type City struct { type Venue struct { ID uint64 `json:"id"` // Venues can be either open or closed - Status VenuesStatus `json:"status"` + Status VenueStatus `json:"status"` Statuses sql.NullString `json:"statuses"` // This value appears in public URLs Slug string `json:"slug"` diff --git a/examples/ondeck/mysql/querier.go b/examples/ondeck/mysql/querier.go index 5b92523605..68b2ff51e8 100644 --- a/examples/ondeck/mysql/querier.go +++ b/examples/ondeck/mysql/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package ondeck diff --git a/examples/ondeck/mysql/schema/0001_city.sql b/examples/ondeck/mysql/schema/0001_city.sql index 6be35d16bf..94e9b0f8d4 100644 --- a/examples/ondeck/mysql/schema/0001_city.sql +++ b/examples/ondeck/mysql/schema/0001_city.sql @@ -1,4 +1,4 @@ CREATE TABLE city ( slug varchar(255) PRIMARY KEY, name text NOT NULL -) +); diff --git a/examples/ondeck/mysql/schema/0002_venue.sql b/examples/ondeck/mysql/schema/0002_venue.sql index 4fc842cee0..dcab205c96 100644 --- a/examples/ondeck/mysql/schema/0002_venue.sql +++ b/examples/ondeck/mysql/schema/0002_venue.sql @@ -5,7 +5,7 @@ CREATE TABLE venues ( statuses text, -- status[], slug text not null COMMENT 'This value appears in public URLs', name varchar(255) not null, - city text not null references city(slug), + city varchar(255) not null references city(slug), spotify_playlist varchar(255) not null, songkick_id text, tags text -- text[] diff --git a/examples/ondeck/mysql/venue.sql.go b/examples/ondeck/mysql/venue.sql.go index 55d37ad785..9d598b8116 100644 --- a/examples/ondeck/mysql/venue.sql.go +++ b/examples/ondeck/mysql/venue.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: venue.sql package ondeck @@ -37,7 +37,7 @@ type CreateVenueParams struct { Name string `json:"name"` City string `json:"city"` SpotifyPlaylist string `json:"spotify_playlist"` - Status VenuesStatus `json:"status"` + Status VenueStatus `json:"status"` Statuses sql.NullString `json:"statuses"` Tags sql.NullString `json:"tags"` } diff --git a/examples/ondeck/postgresql/city.sql.go b/examples/ondeck/postgresql/city.sql.go index a054b1b8d8..306e76f643 100644 --- a/examples/ondeck/postgresql/city.sql.go +++ b/examples/ondeck/postgresql/city.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: city.sql package ondeck diff --git a/examples/ondeck/postgresql/db.go b/examples/ondeck/postgresql/db.go index 06afcda08e..273ff8b8cf 100644 --- a/examples/ondeck/postgresql/db.go +++ b/examples/ondeck/postgresql/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package ondeck diff --git a/examples/ondeck/postgresql/db_test.go b/examples/ondeck/postgresql/db_test.go index c4e4ce8bbf..6d2fba6714 100644 --- a/examples/ondeck/postgresql/db_test.go +++ b/examples/ondeck/postgresql/db_test.go @@ -1,5 +1,4 @@ //go:build examples -// +build examples package ondeck @@ -11,7 +10,7 @@ import ( "github.com/google/go-cmp/cmp" _ "github.com/lib/pq" - "github.com/sqlc-dev/sqlc/internal/sqltest/hosted" + "github.com/sqlc-dev/sqlc/internal/sqltest/local" ) func runOnDeckQueries(t *testing.T, q *Queries) { @@ -126,10 +125,10 @@ func runOnDeckQueries(t *testing.T, q *Queries) { func TestPrepared(t *testing.T) { t.Parallel() - uri := hosted.PostgreSQL(t, []string{"schema"}) + uri := local.PostgreSQL(t, []string{"schema"}) db, err := sql.Open("postgres", uri) if err != nil { - t.Fatal(err) + t.Fatalf("%s: %s", uri, err) } defer db.Close() @@ -144,10 +143,10 @@ func TestPrepared(t *testing.T) { func TestQueries(t *testing.T) { t.Parallel() - uri := hosted.PostgreSQL(t, []string{"schema"}) + uri := local.PostgreSQL(t, []string{"schema"}) db, err := sql.Open("postgres", uri) if err != nil { - t.Fatal(err) + t.Fatalf("%s: %s", uri, err) } defer db.Close() diff --git a/examples/ondeck/postgresql/models.go b/examples/ondeck/postgresql/models.go index 5f32237c2e..0b1e4ef06c 100644 --- a/examples/ondeck/postgresql/models.go +++ b/examples/ondeck/postgresql/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package ondeck diff --git a/examples/ondeck/postgresql/querier.go b/examples/ondeck/postgresql/querier.go index 27f622ca45..a6685141a2 100644 --- a/examples/ondeck/postgresql/querier.go +++ b/examples/ondeck/postgresql/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package ondeck diff --git a/examples/ondeck/postgresql/venue.sql.go b/examples/ondeck/postgresql/venue.sql.go index 212c4bd94a..e3134010ca 100644 --- a/examples/ondeck/postgresql/venue.sql.go +++ b/examples/ondeck/postgresql/venue.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: venue.sql package ondeck diff --git a/examples/ondeck/sqlc.json b/examples/ondeck/sqlc.json index c9290db568..7b97328b3f 100644 --- a/examples/ondeck/sqlc.json +++ b/examples/ondeck/sqlc.json @@ -10,8 +10,12 @@ "schema": "postgresql/schema", "queries": "postgresql/query", "engine": "postgresql", + "sql_package": "database/sql", "database": { - "managed": true + "uri": "${VET_TEST_EXAMPLES_POSTGRES_ONDECK}" + }, + "analyzer": { + "database": false }, "rules": [ "sqlc/db-prepare" @@ -21,13 +25,13 @@ "emit_interface": true }, { - "path": "mysql", + "path": "mysql", "name": "ondeck", "schema": "mysql/schema", "queries": "mysql/query", "engine": "mysql", "database": { - "uri": "root:${MYSQL_ROOT_PASSWORD}@tcp(${MYSQL_HOST}:${MYSQL_PORT})/ondeck?multiStatements=true&parseTime=true" + "uri": "${VET_TEST_EXAMPLES_MYSQL_ONDECK}" }, "rules": [ "sqlc/db-prepare" @@ -53,4 +57,4 @@ "emit_interface": true } ] -} \ No newline at end of file +} diff --git a/examples/ondeck/sqlite/city.sql.go b/examples/ondeck/sqlite/city.sql.go index ca691a7b61..b1476a1c44 100644 --- a/examples/ondeck/sqlite/city.sql.go +++ b/examples/ondeck/sqlite/city.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: city.sql package ondeck diff --git a/examples/ondeck/sqlite/db.go b/examples/ondeck/sqlite/db.go index 06afcda08e..273ff8b8cf 100644 --- a/examples/ondeck/sqlite/db.go +++ b/examples/ondeck/sqlite/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package ondeck diff --git a/examples/ondeck/sqlite/db_test.go b/examples/ondeck/sqlite/db_test.go index f106256d45..e4bb4e4195 100644 --- a/examples/ondeck/sqlite/db_test.go +++ b/examples/ondeck/sqlite/db_test.go @@ -1,5 +1,4 @@ //go:build examples -// +build examples package ondeck @@ -150,6 +149,7 @@ func TestPrepared(t *testing.T) { t.Parallel() sdb, cleanup := sqltest.SQLite(t, []string{"schema"}) + defer sdb.Close() defer cleanup() q, err := Prepare(context.Background(), sdb) @@ -164,6 +164,7 @@ func TestQueries(t *testing.T) { t.Parallel() sdb, cleanup := sqltest.SQLite(t, []string{"schema"}) + defer sdb.Close() defer cleanup() runOnDeckQueries(t, New(sdb)) diff --git a/examples/ondeck/sqlite/models.go b/examples/ondeck/sqlite/models.go index 3d8ba8832c..215fde338f 100644 --- a/examples/ondeck/sqlite/models.go +++ b/examples/ondeck/sqlite/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package ondeck diff --git a/examples/ondeck/sqlite/querier.go b/examples/ondeck/sqlite/querier.go index 5b92523605..68b2ff51e8 100644 --- a/examples/ondeck/sqlite/querier.go +++ b/examples/ondeck/sqlite/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package ondeck diff --git a/examples/ondeck/sqlite/venue.sql.go b/examples/ondeck/sqlite/venue.sql.go index 99eedb79da..44f4f37705 100644 --- a/examples/ondeck/sqlite/venue.sql.go +++ b/examples/ondeck/sqlite/venue.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: venue.sql package ondeck diff --git a/examples/python/requirements.txt b/examples/python/requirements.txt deleted file mode 100644 index 26f645a169..0000000000 --- a/examples/python/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -pytest~=6.2.2 -pytest-asyncio~=0.14.0 -psycopg2-binary~=2.8.6 -asyncpg~=0.21.0 -sqlalchemy==1.4.0 diff --git a/examples/python/sqlc.json b/examples/python/sqlc.json deleted file mode 100644 index 29d3cc8464..0000000000 --- a/examples/python/sqlc.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "version": "2", - "plugins": [ - { - "name": "py", - "wasm": { - "url": "https://downloads.sqlc.dev/plugin/sqlc-gen-python_1.1.0.wasm", - "sha256": "ef58f143a8c116781091441770c7166caaf361dd645f62b8f05f462e9f95c3b2" - } - } - ], - "sql": [ - { - "schema": "../authors/postgresql/schema.sql", - "queries": "../authors/postgresql/query.sql", - "engine": "postgresql", - "codegen": [ - { - "out": "src/authors", - "plugin": "py", - "options": { - "package": "authors", - "emit_sync_querier": true, - "emit_async_querier": true, - "query_parameter_limit": 5 - } - } - ] - }, - { - "schema": "../booktest/postgresql/schema.sql", - "queries": "../booktest/postgresql/query.sql", - "engine": "postgresql", - "codegen": [ - { - "out": "src/booktest", - "plugin": "py", - "options": { - "package": "booktest", - "emit_async_querier": true, - "query_parameter_limit": 5 - } - } - ] - }, - { - "schema": "../jets/postgresql/schema.sql", - "queries": "../jets/postgresql/query-building.sql", - "engine": "postgresql", - "codegen": [ - { - "out": "src/jets", - "plugin": "py", - "options": { - "package": "jets", - "emit_async_querier": true, - "query_parameter_limit": 5 - } - } - ] - }, - { - "schema": "../ondeck/postgresql/schema", - "queries": "../ondeck/postgresql/query", - "engine": "postgresql", - "codegen": [ - { - "out": "src/ondeck", - "plugin": "py", - "options": { - "package": "ondeck", - "emit_async_querier": true, - "query_parameter_limit": 5 - } - } - ] - } - ] -} diff --git a/examples/python/src/authors/models.py b/examples/python/src/authors/models.py deleted file mode 100644 index 143b8f88d3..0000000000 --- a/examples/python/src/authors/models.py +++ /dev/null @@ -1,12 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -import dataclasses -from typing import Optional - - -@dataclasses.dataclass() -class Author: - id: int - name: str - bio: Optional[str] diff --git a/examples/python/src/authors/query.py b/examples/python/src/authors/query.py deleted file mode 100644 index f4db2bd03d..0000000000 --- a/examples/python/src/authors/query.py +++ /dev/null @@ -1,112 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -# source: query.sql -from typing import AsyncIterator, Iterator, Optional - -import sqlalchemy -import sqlalchemy.ext.asyncio - -from authors import models - - -CREATE_AUTHOR = """-- name: create_author \\:one -INSERT INTO authors ( - name, bio -) VALUES ( - :p1, :p2 -) -RETURNING id, name, bio -""" - - -DELETE_AUTHOR = """-- name: delete_author \\:exec -DELETE FROM authors -WHERE id = :p1 -""" - - -GET_AUTHOR = """-- name: get_author \\:one -SELECT id, name, bio FROM authors -WHERE id = :p1 LIMIT 1 -""" - - -LIST_AUTHORS = """-- name: list_authors \\:many -SELECT id, name, bio FROM authors -ORDER BY name -""" - - -class Querier: - def __init__(self, conn: sqlalchemy.engine.Connection): - self._conn = conn - - def create_author(self, *, name: str, bio: Optional[str]) -> Optional[models.Author]: - row = self._conn.execute(sqlalchemy.text(CREATE_AUTHOR), {"p1": name, "p2": bio}).first() - if row is None: - return None - return models.Author( - id=row[0], - name=row[1], - bio=row[2], - ) - - def delete_author(self, *, id: int) -> None: - self._conn.execute(sqlalchemy.text(DELETE_AUTHOR), {"p1": id}) - - def get_author(self, *, id: int) -> Optional[models.Author]: - row = self._conn.execute(sqlalchemy.text(GET_AUTHOR), {"p1": id}).first() - if row is None: - return None - return models.Author( - id=row[0], - name=row[1], - bio=row[2], - ) - - def list_authors(self) -> Iterator[models.Author]: - result = self._conn.execute(sqlalchemy.text(LIST_AUTHORS)) - for row in result: - yield models.Author( - id=row[0], - name=row[1], - bio=row[2], - ) - - -class AsyncQuerier: - def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection): - self._conn = conn - - async def create_author(self, *, name: str, bio: Optional[str]) -> Optional[models.Author]: - row = (await self._conn.execute(sqlalchemy.text(CREATE_AUTHOR), {"p1": name, "p2": bio})).first() - if row is None: - return None - return models.Author( - id=row[0], - name=row[1], - bio=row[2], - ) - - async def delete_author(self, *, id: int) -> None: - await self._conn.execute(sqlalchemy.text(DELETE_AUTHOR), {"p1": id}) - - async def get_author(self, *, id: int) -> Optional[models.Author]: - row = (await self._conn.execute(sqlalchemy.text(GET_AUTHOR), {"p1": id})).first() - if row is None: - return None - return models.Author( - id=row[0], - name=row[1], - bio=row[2], - ) - - async def list_authors(self) -> AsyncIterator[models.Author]: - result = await self._conn.stream(sqlalchemy.text(LIST_AUTHORS)) - async for row in result: - yield models.Author( - id=row[0], - name=row[1], - bio=row[2], - ) diff --git a/examples/python/src/booktest/models.py b/examples/python/src/booktest/models.py deleted file mode 100644 index 903f299d50..0000000000 --- a/examples/python/src/booktest/models.py +++ /dev/null @@ -1,30 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -import dataclasses -import datetime -import enum -from typing import List - - -class BookType(str, enum.Enum): - FICTION = "FICTION" - NONFICTION = "NONFICTION" - - -@dataclasses.dataclass() -class Author: - author_id: int - name: str - - -@dataclasses.dataclass() -class Book: - book_id: int - author_id: int - isbn: str - book_type: BookType - title: str - year: int - available: datetime.datetime - tags: List[str] diff --git a/examples/python/src/booktest/query.py b/examples/python/src/booktest/query.py deleted file mode 100644 index c54eba214e..0000000000 --- a/examples/python/src/booktest/query.py +++ /dev/null @@ -1,211 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -# source: query.sql -import dataclasses -import datetime -from typing import AsyncIterator, List, Optional - -import sqlalchemy -import sqlalchemy.ext.asyncio - -from booktest import models - - -BOOKS_BY_TAGS = """-- name: books_by_tags \\:many -SELECT - book_id, - title, - name, - isbn, - tags -FROM books -LEFT JOIN authors ON books.author_id = authors.author_id -WHERE tags && :p1\\:\\:varchar[] -""" - - -@dataclasses.dataclass() -class BooksByTagsRow: - book_id: int - title: str - name: Optional[str] - isbn: str - tags: List[str] - - -BOOKS_BY_TITLE_YEAR = """-- name: books_by_title_year \\:many -SELECT book_id, author_id, isbn, book_type, title, year, available, tags FROM books -WHERE title = :p1 AND year = :p2 -""" - - -CREATE_AUTHOR = """-- name: create_author \\:one -INSERT INTO authors (name) VALUES (:p1) -RETURNING author_id, name -""" - - -CREATE_BOOK = """-- name: create_book \\:one -INSERT INTO books ( - author_id, - isbn, - book_type, - title, - year, - available, - tags -) VALUES ( - :p1, - :p2, - :p3, - :p4, - :p5, - :p6, - :p7 -) -RETURNING book_id, author_id, isbn, book_type, title, year, available, tags -""" - - -@dataclasses.dataclass() -class CreateBookParams: - author_id: int - isbn: str - book_type: models.BookType - title: str - year: int - available: datetime.datetime - tags: List[str] - - -DELETE_BOOK = """-- name: delete_book \\:exec -DELETE FROM books -WHERE book_id = :p1 -""" - - -GET_AUTHOR = """-- name: get_author \\:one -SELECT author_id, name FROM authors -WHERE author_id = :p1 -""" - - -GET_BOOK = """-- name: get_book \\:one -SELECT book_id, author_id, isbn, book_type, title, year, available, tags FROM books -WHERE book_id = :p1 -""" - - -UPDATE_BOOK = """-- name: update_book \\:exec -UPDATE books -SET title = :p1, tags = :p2 -WHERE book_id = :p3 -""" - - -UPDATE_BOOK_ISBN = """-- name: update_book_isbn \\:exec -UPDATE books -SET title = :p1, tags = :p2, isbn = :p4 -WHERE book_id = :p3 -""" - - -class AsyncQuerier: - def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection): - self._conn = conn - - async def books_by_tags(self, *, dollar_1: List[str]) -> AsyncIterator[BooksByTagsRow]: - result = await self._conn.stream(sqlalchemy.text(BOOKS_BY_TAGS), {"p1": dollar_1}) - async for row in result: - yield BooksByTagsRow( - book_id=row[0], - title=row[1], - name=row[2], - isbn=row[3], - tags=row[4], - ) - - async def books_by_title_year(self, *, title: str, year: int) -> AsyncIterator[models.Book]: - result = await self._conn.stream(sqlalchemy.text(BOOKS_BY_TITLE_YEAR), {"p1": title, "p2": year}) - async for row in result: - yield models.Book( - book_id=row[0], - author_id=row[1], - isbn=row[2], - book_type=row[3], - title=row[4], - year=row[5], - available=row[6], - tags=row[7], - ) - - async def create_author(self, *, name: str) -> Optional[models.Author]: - row = (await self._conn.execute(sqlalchemy.text(CREATE_AUTHOR), {"p1": name})).first() - if row is None: - return None - return models.Author( - author_id=row[0], - name=row[1], - ) - - async def create_book(self, arg: CreateBookParams) -> Optional[models.Book]: - row = (await self._conn.execute(sqlalchemy.text(CREATE_BOOK), { - "p1": arg.author_id, - "p2": arg.isbn, - "p3": arg.book_type, - "p4": arg.title, - "p5": arg.year, - "p6": arg.available, - "p7": arg.tags, - })).first() - if row is None: - return None - return models.Book( - book_id=row[0], - author_id=row[1], - isbn=row[2], - book_type=row[3], - title=row[4], - year=row[5], - available=row[6], - tags=row[7], - ) - - async def delete_book(self, *, book_id: int) -> None: - await self._conn.execute(sqlalchemy.text(DELETE_BOOK), {"p1": book_id}) - - async def get_author(self, *, author_id: int) -> Optional[models.Author]: - row = (await self._conn.execute(sqlalchemy.text(GET_AUTHOR), {"p1": author_id})).first() - if row is None: - return None - return models.Author( - author_id=row[0], - name=row[1], - ) - - async def get_book(self, *, book_id: int) -> Optional[models.Book]: - row = (await self._conn.execute(sqlalchemy.text(GET_BOOK), {"p1": book_id})).first() - if row is None: - return None - return models.Book( - book_id=row[0], - author_id=row[1], - isbn=row[2], - book_type=row[3], - title=row[4], - year=row[5], - available=row[6], - tags=row[7], - ) - - async def update_book(self, *, title: str, tags: List[str], book_id: int) -> None: - await self._conn.execute(sqlalchemy.text(UPDATE_BOOK), {"p1": title, "p2": tags, "p3": book_id}) - - async def update_book_isbn(self, *, title: str, tags: List[str], book_id: int, isbn: str) -> None: - await self._conn.execute(sqlalchemy.text(UPDATE_BOOK_ISBN), { - "p1": title, - "p2": tags, - "p3": book_id, - "p4": isbn, - }) diff --git a/examples/python/src/dbtest/migrations.py b/examples/python/src/dbtest/migrations.py deleted file mode 100644 index 6ace6bcd63..0000000000 --- a/examples/python/src/dbtest/migrations.py +++ /dev/null @@ -1,43 +0,0 @@ -import os -from typing import List - -import sqlalchemy -import sqlalchemy.ext.asyncio - - -def apply_migrations(conn: sqlalchemy.engine.Connection, paths: List[str]): - files = _find_sql_files(paths) - - for file in files: - with open(file, "r") as fd: - blob = fd.read() - stmts = blob.split(";") - for stmt in stmts: - if stmt.strip(): - conn.execute(sqlalchemy.text(stmt)) - - -async def apply_migrations_async(conn: sqlalchemy.ext.asyncio.AsyncConnection, paths: List[str]): - files = _find_sql_files(paths) - - for file in files: - with open(file, "r") as fd: - blob = fd.read() - raw_conn = await conn.get_raw_connection() - # The asyncpg sqlalchemy adapter uses a prepared statement cache which can't handle the migration statements - await raw_conn._connection.execute(blob) - - -def _find_sql_files(paths: List[str]) -> List[str]: - files = [] - for path in paths: - if not os.path.exists(path): - raise FileNotFoundError(f"{path} does not exist") - if os.path.isdir(path): - for file in os.listdir(path): - if file.endswith(".sql"): - files.append(os.path.join(path, file)) - else: - files.append(path) - files.sort() - return files diff --git a/examples/python/src/jets/models.py b/examples/python/src/jets/models.py deleted file mode 100644 index 506a586b6e..0000000000 --- a/examples/python/src/jets/models.py +++ /dev/null @@ -1,31 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -import dataclasses - - -@dataclasses.dataclass() -class Jet: - id: int - pilot_id: int - age: int - name: str - color: str - - -@dataclasses.dataclass() -class Language: - id: int - language: str - - -@dataclasses.dataclass() -class Pilot: - id: int - name: str - - -@dataclasses.dataclass() -class PilotLanguage: - pilot_id: int - language_id: int diff --git a/examples/python/src/jets/query-building.py b/examples/python/src/jets/query-building.py deleted file mode 100644 index e02a371619..0000000000 --- a/examples/python/src/jets/query-building.py +++ /dev/null @@ -1,47 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -# source: query-building.sql -from typing import AsyncIterator, Optional - -import sqlalchemy -import sqlalchemy.ext.asyncio - -from jets import models - - -COUNT_PILOTS = """-- name: count_pilots \\:one -SELECT COUNT(*) FROM pilots -""" - - -DELETE_PILOT = """-- name: delete_pilot \\:exec -DELETE FROM pilots WHERE id = :p1 -""" - - -LIST_PILOTS = """-- name: list_pilots \\:many -SELECT id, name FROM pilots LIMIT 5 -""" - - -class AsyncQuerier: - def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection): - self._conn = conn - - async def count_pilots(self) -> Optional[int]: - row = (await self._conn.execute(sqlalchemy.text(COUNT_PILOTS))).first() - if row is None: - return None - return row[0] - - async def delete_pilot(self, *, id: int) -> None: - await self._conn.execute(sqlalchemy.text(DELETE_PILOT), {"p1": id}) - - async def list_pilots(self) -> AsyncIterator[models.Pilot]: - result = await self._conn.stream(sqlalchemy.text(LIST_PILOTS)) - async for row in result: - yield models.Pilot( - id=row[0], - name=row[1], - ) diff --git a/examples/python/src/ondeck/city.py b/examples/python/src/ondeck/city.py deleted file mode 100644 index afd338ca3f..0000000000 --- a/examples/python/src/ondeck/city.py +++ /dev/null @@ -1,76 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -# source: city.sql -from typing import AsyncIterator, Optional - -import sqlalchemy -import sqlalchemy.ext.asyncio - -from ondeck import models - - -CREATE_CITY = """-- name: create_city \\:one -INSERT INTO city ( - name, - slug -) VALUES ( - :p1, - :p2 -) RETURNING slug, name -""" - - -GET_CITY = """-- name: get_city \\:one -SELECT slug, name -FROM city -WHERE slug = :p1 -""" - - -LIST_CITIES = """-- name: list_cities \\:many -SELECT slug, name -FROM city -ORDER BY name -""" - - -UPDATE_CITY_NAME = """-- name: update_city_name \\:exec -UPDATE city -SET name = :p2 -WHERE slug = :p1 -""" - - -class AsyncQuerier: - def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection): - self._conn = conn - - async def create_city(self, *, name: str, slug: str) -> Optional[models.City]: - row = (await self._conn.execute(sqlalchemy.text(CREATE_CITY), {"p1": name, "p2": slug})).first() - if row is None: - return None - return models.City( - slug=row[0], - name=row[1], - ) - - async def get_city(self, *, slug: str) -> Optional[models.City]: - row = (await self._conn.execute(sqlalchemy.text(GET_CITY), {"p1": slug})).first() - if row is None: - return None - return models.City( - slug=row[0], - name=row[1], - ) - - async def list_cities(self) -> AsyncIterator[models.City]: - result = await self._conn.stream(sqlalchemy.text(LIST_CITIES)) - async for row in result: - yield models.City( - slug=row[0], - name=row[1], - ) - - async def update_city_name(self, *, slug: str, name: str) -> None: - await self._conn.execute(sqlalchemy.text(UPDATE_CITY_NAME), {"p1": slug, "p2": name}) diff --git a/examples/python/src/ondeck/models.py b/examples/python/src/ondeck/models.py deleted file mode 100644 index b89452e35c..0000000000 --- a/examples/python/src/ondeck/models.py +++ /dev/null @@ -1,35 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -import dataclasses -import datetime -import enum -from typing import List, Optional - - -class Status(str, enum.Enum): - """Venues can be either open or closed""" - OPEN = "op!en" - CLOSED = "clo@sed" - - -@dataclasses.dataclass() -class City: - slug: str - name: str - - -@dataclasses.dataclass() -class Venue: - """Venues are places where muisc happens""" - id: int - status: Status - statuses: Optional[List[Status]] - # This value appears in public URLs - slug: str - name: str - city: str - spotify_playlist: str - songkick_id: Optional[str] - tags: Optional[List[str]] - created_at: datetime.datetime diff --git a/examples/python/src/ondeck/venue.py b/examples/python/src/ondeck/venue.py deleted file mode 100644 index 081a0d7780..0000000000 --- a/examples/python/src/ondeck/venue.py +++ /dev/null @@ -1,159 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -# source: venue.sql -import dataclasses -from typing import AsyncIterator, List, Optional - -import sqlalchemy -import sqlalchemy.ext.asyncio - -from ondeck import models - - -CREATE_VENUE = """-- name: create_venue \\:one -INSERT INTO venue ( - slug, - name, - city, - created_at, - spotify_playlist, - status, - statuses, - tags -) VALUES ( - :p1, - :p2, - :p3, - NOW(), - :p4, - :p5, - :p6, - :p7 -) RETURNING id -""" - - -@dataclasses.dataclass() -class CreateVenueParams: - slug: str - name: str - city: str - spotify_playlist: str - status: models.Status - statuses: Optional[List[models.Status]] - tags: Optional[List[str]] - - -DELETE_VENUE = """-- name: delete_venue \\:exec -DELETE FROM venue -WHERE slug = :p1 AND slug = :p1 -""" - - -GET_VENUE = """-- name: get_venue \\:one -SELECT id, status, statuses, slug, name, city, spotify_playlist, songkick_id, tags, created_at -FROM venue -WHERE slug = :p1 AND city = :p2 -""" - - -LIST_VENUES = """-- name: list_venues \\:many -SELECT id, status, statuses, slug, name, city, spotify_playlist, songkick_id, tags, created_at -FROM venue -WHERE city = :p1 -ORDER BY name -""" - - -UPDATE_VENUE_NAME = """-- name: update_venue_name \\:one -UPDATE venue -SET name = :p2 -WHERE slug = :p1 -RETURNING id -""" - - -VENUE_COUNT_BY_CITY = """-- name: venue_count_by_city \\:many -SELECT - city, - count(*) -FROM venue -GROUP BY 1 -ORDER BY 1 -""" - - -@dataclasses.dataclass() -class VenueCountByCityRow: - city: str - count: int - - -class AsyncQuerier: - def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection): - self._conn = conn - - async def create_venue(self, arg: CreateVenueParams) -> Optional[int]: - row = (await self._conn.execute(sqlalchemy.text(CREATE_VENUE), { - "p1": arg.slug, - "p2": arg.name, - "p3": arg.city, - "p4": arg.spotify_playlist, - "p5": arg.status, - "p6": arg.statuses, - "p7": arg.tags, - })).first() - if row is None: - return None - return row[0] - - async def delete_venue(self, *, slug: str) -> None: - await self._conn.execute(sqlalchemy.text(DELETE_VENUE), {"p1": slug}) - - async def get_venue(self, *, slug: str, city: str) -> Optional[models.Venue]: - row = (await self._conn.execute(sqlalchemy.text(GET_VENUE), {"p1": slug, "p2": city})).first() - if row is None: - return None - return models.Venue( - id=row[0], - status=row[1], - statuses=row[2], - slug=row[3], - name=row[4], - city=row[5], - spotify_playlist=row[6], - songkick_id=row[7], - tags=row[8], - created_at=row[9], - ) - - async def list_venues(self, *, city: str) -> AsyncIterator[models.Venue]: - result = await self._conn.stream(sqlalchemy.text(LIST_VENUES), {"p1": city}) - async for row in result: - yield models.Venue( - id=row[0], - status=row[1], - statuses=row[2], - slug=row[3], - name=row[4], - city=row[5], - spotify_playlist=row[6], - songkick_id=row[7], - tags=row[8], - created_at=row[9], - ) - - async def update_venue_name(self, *, slug: str, name: str) -> Optional[int]: - row = (await self._conn.execute(sqlalchemy.text(UPDATE_VENUE_NAME), {"p1": slug, "p2": name})).first() - if row is None: - return None - return row[0] - - async def venue_count_by_city(self) -> AsyncIterator[VenueCountByCityRow]: - result = await self._conn.stream(sqlalchemy.text(VENUE_COUNT_BY_CITY)) - async for row in result: - yield VenueCountByCityRow( - city=row[0], - count=row[1], - ) diff --git a/examples/python/src/tests/conftest.py b/examples/python/src/tests/conftest.py deleted file mode 100644 index f807209229..0000000000 --- a/examples/python/src/tests/conftest.py +++ /dev/null @@ -1,67 +0,0 @@ -import asyncio -import os -import random - -import pytest -import sqlalchemy -import sqlalchemy.ext.asyncio - - -@pytest.fixture(scope="session") -def postgres_uri() -> str: - pg_host = os.environ.get("PG_HOST", "postgres") - pg_port = os.environ.get("PG_PORT", 5432) - pg_user = os.environ.get("PG_USER", "postgres") - pg_password = os.environ.get("PG_PASSWORD", "mysecretpassword") - pg_db = os.environ.get("PG_DATABASE", "dinotest") - - return f"postgresql://{pg_user}:{pg_password}@{pg_host}:{pg_port}/{pg_db}" - - -@pytest.fixture(scope="session") -def sqlalchemy_connection(postgres_uri) -> sqlalchemy.engine.Connection: - engine = sqlalchemy.create_engine(postgres_uri, future=True) - with engine.connect() as conn: - yield conn - - -@pytest.fixture(scope="function") -def db(sqlalchemy_connection: sqlalchemy.engine.Connection) -> sqlalchemy.engine.Connection: - conn = sqlalchemy_connection - schema_name = f"sqltest_{random.randint(0, 1000)}" - conn.execute(sqlalchemy.text(f"CREATE SCHEMA {schema_name}")) - conn.execute(sqlalchemy.text(f"SET search_path TO {schema_name}")) - conn.commit() - yield conn - conn.rollback() - conn.execute(sqlalchemy.text(f"DROP SCHEMA {schema_name} CASCADE")) - conn.execute(sqlalchemy.text("SET search_path TO public")) - - -@pytest.fixture(scope="session") -async def async_sqlalchemy_connection(postgres_uri) -> sqlalchemy.ext.asyncio.AsyncConnection: - postgres_uri = postgres_uri.replace("postgresql", "postgresql+asyncpg") - engine = sqlalchemy.ext.asyncio.create_async_engine(postgres_uri) - async with engine.connect() as conn: - yield conn - - -@pytest.fixture(scope="function") -async def async_db(async_sqlalchemy_connection: sqlalchemy.ext.asyncio.AsyncConnection) -> sqlalchemy.ext.asyncio.AsyncConnection: - conn = async_sqlalchemy_connection - schema_name = f"sqltest_{random.randint(0, 1000)}" - await conn.execute(sqlalchemy.text(f"CREATE SCHEMA {schema_name}")) - await conn.execute(sqlalchemy.text(f"SET search_path TO {schema_name}")) - await conn.commit() - yield conn - await conn.rollback() - await conn.execute(sqlalchemy.text(f"DROP SCHEMA {schema_name} CASCADE")) - await conn.execute(sqlalchemy.text("SET search_path TO public")) - - -@pytest.fixture(scope="session") -def event_loop(): - """Change event_loop fixture to session level.""" - loop = asyncio.get_event_loop_policy().new_event_loop() - yield loop - loop.close() diff --git a/examples/python/src/tests/test_authors.py b/examples/python/src/tests/test_authors.py deleted file mode 100644 index 7b0a954276..0000000000 --- a/examples/python/src/tests/test_authors.py +++ /dev/null @@ -1,56 +0,0 @@ -import os - -import pytest -import sqlalchemy.ext.asyncio - -from authors import query -from dbtest.migrations import apply_migrations, apply_migrations_async - - -def test_authors(db: sqlalchemy.engine.Connection): - apply_migrations(db, [os.path.dirname(__file__) + "/../../../authors/postgresql/schema.sql"]) - - querier = query.Querier(db) - - authors = list(querier.list_authors()) - assert authors == [] - - author_name = "Brian Kernighan" - author_bio = "Co-author of The C Programming Language and The Go Programming Language" - new_author = querier.create_author(name=author_name, bio=author_bio) - assert new_author.id > 0 - assert new_author.name == author_name - assert new_author.bio == author_bio - - db_author = querier.get_author(id=new_author.id) - assert db_author == new_author - - author_list = list(querier.list_authors()) - assert len(author_list) == 1 - assert author_list[0] == new_author - - -@pytest.mark.asyncio -async def test_authors_async(async_db: sqlalchemy.ext.asyncio.AsyncConnection): - await apply_migrations_async(async_db, [os.path.dirname(__file__) + "/../../../authors/postgresql/schema.sql"]) - - querier = query.AsyncQuerier(async_db) - - async for _ in querier.list_authors(): - assert False, "No authors should exist" - - author_name = "Brian Kernighan" - author_bio = "Co-author of The C Programming Language and The Go Programming Language" - new_author = await querier.create_author(name=author_name, bio=author_bio) - assert new_author.id > 0 - assert new_author.name == author_name - assert new_author.bio == author_bio - - db_author = await querier.get_author(id=new_author.id) - assert db_author == new_author - - author_list = [] - async for author in querier.list_authors(): - author_list.append(author) - assert len(author_list) == 1 - assert author_list[0] == new_author diff --git a/examples/python/src/tests/test_booktest.py b/examples/python/src/tests/test_booktest.py deleted file mode 100644 index 6106d9d3fd..0000000000 --- a/examples/python/src/tests/test_booktest.py +++ /dev/null @@ -1,85 +0,0 @@ -import datetime -import os - -import pytest -import sqlalchemy.ext.asyncio - -from booktest import query, models -from dbtest.migrations import apply_migrations_async - - -@pytest.mark.asyncio -async def test_books(async_db: sqlalchemy.ext.asyncio.AsyncConnection): - await apply_migrations_async(async_db, [os.path.dirname(__file__) + "/../../../booktest/postgresql/schema.sql"]) - - querier = query.AsyncQuerier(async_db) - - author = await querier.create_author(name="Unknown Master") - assert author is not None - - now = datetime.datetime.now() - await querier.create_book(query.CreateBookParams( - author_id=author.author_id, - isbn="1", - title="my book title", - book_type=models.BookType.FICTION, - year=2016, - available=now, - tags=[], - )) - - b1 = await querier.create_book(query.CreateBookParams( - author_id=author.author_id, - isbn="2", - title="the second book", - book_type=models.BookType.FICTION, - year=2016, - available=now, - tags=["cool", "unique"], - )) - - await querier.update_book(book_id=b1.book_id, title="changed second title", tags=["cool", "disastor"]) - - b3 = await querier.create_book(query.CreateBookParams( - author_id=author.author_id, - isbn="3", - title="the third book", - book_type=models.BookType.FICTION, - year=2001, - available=now, - tags=["cool"], - )) - - b4 = await querier.create_book(query.CreateBookParams( - author_id=author.author_id, - isbn="4", - title="4th place finisher", - book_type=models.BookType.NONFICTION, - year=2011, - available=now, - tags=["other"], - )) - - await querier.update_book_isbn(book_id=b4.book_id, isbn="NEW ISBN", title="never ever gonna finish, a quatrain", tags=["someother"]) - - books0 = querier.books_by_title_year(title="my book title", year=2016) - expected_titles = {"my book title"} - async for book in books0: - expected_titles.remove(book.title) # raises a key error if the title does not exist - assert len(book.tags) == 0 - - author = await querier.get_author(author_id=book.author_id) - assert author.name == "Unknown Master" - assert len(expected_titles) == 0 - - books = querier.books_by_tags(dollar_1=["cool", "other", "someother"]) - expected_titles = {"changed second title", "the third book", "never ever gonna finish, a quatrain"} - async for book in books: - expected_titles.remove(book.title) - assert len(expected_titles) == 0 - - b5 = await querier.get_book(book_id=b3.book_id) - assert b5 is not None - await querier.delete_book(book_id=b5.book_id) - b6 = await querier.get_book(book_id=b5.book_id) - assert b6 is None diff --git a/examples/python/src/tests/test_ondeck.py b/examples/python/src/tests/test_ondeck.py deleted file mode 100644 index 68cfbc9bcb..0000000000 --- a/examples/python/src/tests/test_ondeck.py +++ /dev/null @@ -1,53 +0,0 @@ -import os - -import pytest -import sqlalchemy.ext.asyncio - -from ondeck import models -from ondeck import city as city_queries -from ondeck import venue as venue_queries -from dbtest.migrations import apply_migrations_async - - -@pytest.mark.asyncio -async def test_ondeck(async_db: sqlalchemy.ext.asyncio.AsyncConnection): - await apply_migrations_async(async_db, [os.path.dirname(__file__) + "/../../../ondeck/postgresql/schema"]) - - city_querier = city_queries.AsyncQuerier(async_db) - venue_querier = venue_queries.AsyncQuerier(async_db) - - city = await city_querier.create_city(slug="san-francisco", name="San Francisco") - assert city is not None - - venue_id = await venue_querier.create_venue(venue_queries.CreateVenueParams( - slug="the-fillmore", - name="The Fillmore", - city=city.slug, - spotify_playlist="spotify:uri", - status=models.Status.OPEN, - statuses=[models.Status.OPEN, models.Status.CLOSED], - tags=["rock", "punk"], - )) - assert venue_id is not None - - venue = await venue_querier.get_venue(slug="the-fillmore", city=city.slug) - assert venue is not None - assert venue.id == venue_id - - assert city == await city_querier.get_city(slug=city.slug) - assert [venue_queries.VenueCountByCityRow(city=city.slug, count=1)] == await _to_list(venue_querier.venue_count_by_city()) - assert [city] == await _to_list(city_querier.list_cities()) - assert [venue] == await _to_list(venue_querier.list_venues(city=city.slug)) - - await city_querier.update_city_name(slug=city.slug, name="SF") - _id = await venue_querier.update_venue_name(slug=venue.slug, name="Fillmore") - assert _id == venue_id - - await venue_querier.delete_venue(slug=venue.slug) - - -async def _to_list(it): - out = [] - async for i in it: - out.append(i) - return out diff --git a/go.mod b/go.mod index f159367c74..b1ad21b290 100644 --- a/go.mod +++ b/go.mod @@ -1,65 +1,73 @@ module github.com/sqlc-dev/sqlc -go 1.21 +go 1.24.0 + +toolchain go1.24.1 require ( - github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230321174746-8dcc6526cfb1 - github.com/bytecodealliance/wasmtime-go/v13 v13.0.0 + 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/go-sql-driver/mysql v1.7.1 - github.com/google/cel-go v0.18.1 - github.com/google/go-cmp v0.5.9 - github.com/jackc/pgconn v1.14.1 - github.com/jackc/pgx/v4 v4.18.1 - github.com/jackc/pgx/v5 v5.4.3 + github.com/fatih/structtag v1.2.0 + github.com/go-sql-driver/mysql v1.9.3 + github.com/google/cel-go v0.26.1 + github.com/google/go-cmp v0.7.0 + github.com/jackc/pgx/v4 v4.18.3 + github.com/jackc/pgx/v5 v5.7.6 github.com/jinzhu/inflection v1.0.0 github.com/lib/pq v1.10.9 - github.com/mattn/go-sqlite3 v1.14.17 - github.com/pganalyze/pg_query_go/v4 v4.2.3 + github.com/pganalyze/pg_query_go/v6 v6.1.0 + github.com/pingcap/tidb/pkg/parser v0.0.0-20250324122243-d51e00e5bbf0 github.com/riza-io/grpc-go v0.2.0 - github.com/spf13/cobra v1.7.0 - github.com/spf13/pflag v1.0.5 + github.com/spf13/cobra v1.10.1 + github.com/spf13/pflag v1.0.10 + github.com/tetratelabs/wazero v1.9.0 + github.com/wasilibs/go-pgquery v0.0.0-20250409022910-10ac41983c07 github.com/xeipuuv/gojsonschema v1.2.0 - golang.org/x/sync v0.3.0 - google.golang.org/grpc v1.58.2 - google.golang.org/protobuf v1.31.0 + golang.org/x/sync v0.17.0 + google.golang.org/grpc v1.75.1 + google.golang.org/protobuf v1.36.9 gopkg.in/yaml.v3 v3.0.1 + modernc.org/sqlite v1.38.2 ) require ( - github.com/benbjohnson/clock v1.3.5 // indirect - github.com/pingcap/failpoint v0.0.0-20220801062533-2eaa32854a6c // indirect - github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect - github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230803162519-f966b187b2e5 // indirect -) - -require ( - github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548 // indirect - github.com/fatih/structtag v1.2.0 - github.com/golang/protobuf v1.5.3 // indirect + cel.dev/expr v0.24.0 // indirect + filippo.io/edwards25519 v1.1.0 // indirect + github.com/dustin/go-humanize v1.0.1 // indirect + github.com/google/uuid v1.6.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jackc/chunkreader/v2 v2.0.1 // indirect + github.com/jackc/pgconn v1.14.3 // indirect github.com/jackc/pgio v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect - github.com/jackc/pgproto3/v2 v2.3.2 // indirect - github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect - github.com/jackc/pgtype v1.14.0 - github.com/pingcap/errors v0.11.5-0.20210425183316-da1aaba5fb63 // indirect + github.com/jackc/pgproto3/v2 v2.3.3 // 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.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.20240311024730-e056997136bb // indirect + github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 // indirect github.com/pingcap/log v1.1.0 // indirect - github.com/pingcap/tidb/parser v0.0.0-20230815160630-b69fa21942d1 github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect github.com/stoewer/go-strcase v1.2.0 // indirect + github.com/wasilibs/wazero-helpers v0.0.0-20240620070341-3dff1577cd52 // indirect + github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect + github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect - go.uber.org/zap v1.25.0 // indirect - golang.org/x/crypto v0.11.0 // indirect - golang.org/x/exp v0.0.0-20230724220655-d98519c11495 // indirect - golang.org/x/net v0.12.0 // indirect - golang.org/x/sys v0.10.0 // indirect - golang.org/x/text v0.12.0 // indirect + go.uber.org/zap v1.27.0 // indirect + golang.org/x/crypto v0.39.0 // indirect + golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b // indirect + golang.org/x/net v0.41.0 // indirect + golang.org/x/sys v0.34.0 // indirect + golang.org/x/text v0.26.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20250707201910-8d1bb00bc6a7 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250707201910-8d1bb00bc6a7 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect + modernc.org/libc v1.66.3 // indirect + modernc.org/mathutil v1.7.1 // indirect + modernc.org/memory v1.11.0 // indirect ) diff --git a/go.sum b/go.sum index 5c7434d1c3..6ded446821 100644 --- a/go.sum +++ b/go.sum @@ -1,53 +1,51 @@ +cel.dev/expr v0.24.0 h1:56OvJKSH3hDGL0ml5uSxZmz3/3Pq4tJ+fb1unVLAFcY= +cel.dev/expr v0.24.0/go.mod h1:hLPLo1W4QUmuYdA72RBX06QTs6MXw941piREPl3Yfiw= +filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= +filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= -github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230321174746-8dcc6526cfb1 h1:X8MJ0fnN5FPdcGF5Ij2/OW+HgiJrRg3AfHAx1PJtIzM= -github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230321174746-8dcc6526cfb1/go.mod h1:pSwJ0fSY5KhvocuWSx4fz3BA8OrA1bQn+K1Eli3BRwM= +github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ= +github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= -github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o= -github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= -github.com/bytecodealliance/wasmtime-go/v13 v13.0.0 h1:o2PsUgSu6vMKr5S0+mz8EL3mZGQ0M8gHwS8/R0wY/wY= -github.com/bytecodealliance/wasmtime-go/v13 v13.0.0/go.mod h1:KmsZLdjjzNH/E5wbfoRehqP70tHzKlfNOi730VCAR4E= github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/cubicdaiya/gonp v1.0.4 h1:ky2uIAJh81WiLcGKBVD5R7KsM/36W6IqqTy6Bo6rGws= github.com/cubicdaiya/gonp v1.0.4/go.mod h1:iWGuP/7+JVTn02OWhRemVbMmG1DOUnmrGTYYACpOI0I= -github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548 h1:iwZdTE0PVqJCos1vaoKsclOGD3ADKpshg3SRtYBbwso= -github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI= -github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= +github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-sql-driver/mysql v1.9.3 h1:U/N249h2WzJ3Ukj8SowVFjdtZKfu9vlLZxjPXV1aweo= +github.com/go-sql-driver/mysql v1.9.3/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/cel-go v0.18.1 h1:V/lAXKq4C3BYLDy/ARzMtpkEEYfHQpZzVyzy69nEUjs= -github.com/google/cel-go v0.18.1/go.mod h1:PVAybmSnWkNMUZR/tEWFUiJ1Np4Hz0MHsZJcgC4zln4= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/cel-go v0.26.1 h1:iPbVVEdkhTX++hpe3lzSk7D3G3QSYqLGoHOcEio+UXQ= +github.com/google/cel-go v0.26.1/go.mod h1:A9O8OU9rdvrK5MQyrqfIxo1a0u4g3sF8KB6PUIaryMM= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e h1:ijClszYn+mADRFY17kjQEVQ1XRhq2/JR1M3sGqeJoxs= +github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= @@ -60,9 +58,8 @@ github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsU github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o= github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY= github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= -github.com/jackc/pgconn v1.14.0/go.mod h1:9mBNlny0UvkgJdCDvdVHYSjI+8tD2rnKK69Wz8ti++E= -github.com/jackc/pgconn v1.14.1 h1:smbxIaZA08n6YuxEX1sDyjV/qkbtUtkH20qLkR9MUR4= -github.com/jackc/pgconn v1.14.1/go.mod h1:9mBNlny0UvkgJdCDvdVHYSjI+8tD2rnKK69Wz8ti++E= +github.com/jackc/pgconn v1.14.3 h1:bVoTr12EGANZz66nZPkMInAV/KHD2TxH9npjXXgiB3w= +github.com/jackc/pgconn v1.14.3/go.mod h1:RZbme4uasqzybK2RK5c65VsHxoyaml09lx3tXOcO/VM= github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= @@ -78,11 +75,11 @@ github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvW github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= -github.com/jackc/pgproto3/v2 v2.3.2 h1:7eY55bdBeCz1F2fTzSz69QC+pG46jYq9/jtSPiJ5nn0= -github.com/jackc/pgproto3/v2 v2.3.2/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgproto3/v2 v2.3.3 h1:1HLSx5H+tXR9pW3in3zaztoEwQYRC9SQaYUHjTSUOag= +github.com/jackc/pgproto3/v2 v2.3.3/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= -github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk= -github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg= github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc= github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw= @@ -93,14 +90,15 @@ github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08 github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM= github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc= github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= -github.com/jackc/pgx/v4 v4.18.1 h1:YP7G1KABtKpB5IHrO9vYwSrCOhs7p3uqhvhhQBptya0= -github.com/jackc/pgx/v4 v4.18.1/go.mod h1:FydWkUyadDmdNH/mHnGob881GawxeEm7TcMCzkb+qQE= -github.com/jackc/pgx/v5 v5.4.3 h1:cxFyXhxlvAifxnkKKdlxv8XqUf59tDlYjnV5YYfsJJY= -github.com/jackc/pgx/v5 v5.4.3/go.mod h1:Ig06C2Vu0t5qXC60W8sqIthScaEnFvojjj9dSljmHRA= +github.com/jackc/pgx/v4 v4.18.3 h1:dE2/TrEsGX3RBprb3qryqSV9Y60iZN1C6i8IrmW9/BA= +github.com/jackc/pgx/v4 v4.18.3/go.mod h1:Ey4Oru5tH5sB6tV7hDmfWFahwF15Eb7DNXlRKx2CkVw= +github.com/jackc/pgx/v5 v5.7.6 h1:rWQc5FwZSPX58r1OQmkuaNicxdmExaEz5A2DO2hUuTk= +github.com/jackc/pgx/v5 v5.7.6/go.mod h1:aruU7o91Tc2q2cFp5h4uP3f6ztExVpyVv88Xl/8Vl8M= github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= -github.com/jackc/puddle v1.3.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= +github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= @@ -125,20 +123,21 @@ github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-sqlite3 v1.14.17 h1:mCRHCLDUBXgpKAqIKsaAaAsrAlbkeomtRFKXh2L6YIM= -github.com/mattn/go-sqlite3 v1.14.17/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= -github.com/pganalyze/pg_query_go/v4 v4.2.3 h1:cNLqyiVMasV7YGWyYV+fkXyHp32gDfXVNCqoHztEGNk= -github.com/pganalyze/pg_query_go/v4 v4.2.3/go.mod h1:aEkDNOXNM5j0YGzaAapwJ7LB3dLNj+bvbWcLv1hOVqA= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4= +github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= +github.com/pganalyze/pg_query_go/v6 v6.1.0 h1:jG5ZLhcVgL1FAw4C/0VNQaVmX1SUJx71wBGdtTtBvls= +github.com/pganalyze/pg_query_go/v6 v6.1.0/go.mod h1:nvTHIuoud6e1SfrUaFwHqT0i4b5Nr+1rPWVds3B5+50= github.com/pingcap/errors v0.11.0/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= -github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= -github.com/pingcap/errors v0.11.5-0.20210425183316-da1aaba5fb63 h1:+FZIDR/D97YOPik4N4lPDaUcLDF/EQPogxtlHB2ZZRM= -github.com/pingcap/errors v0.11.5-0.20210425183316-da1aaba5fb63/go.mod h1:X2r9ueLEUZgtx2cIogM0v4Zj5uvvzhuuiu7Pn8HzMPg= -github.com/pingcap/failpoint v0.0.0-20220801062533-2eaa32854a6c h1:CgbKAHto5CQgWM9fSBIvaxsJHuGP0uM74HXtv3MyyGQ= -github.com/pingcap/failpoint v0.0.0-20220801062533-2eaa32854a6c/go.mod h1:4qGtCB0QK0wBzKtFEGDhxXnSnbQApw1gc9siScUl8ew= +github.com/pingcap/errors v0.11.5-0.20240311024730-e056997136bb h1:3pSi4EDG6hg0orE1ndHkXvX6Qdq2cZn8gAPir8ymKZk= +github.com/pingcap/errors v0.11.5-0.20240311024730-e056997136bb/go.mod h1:X2r9ueLEUZgtx2cIogM0v4Zj5uvvzhuuiu7Pn8HzMPg= +github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= +github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= github.com/pingcap/log v1.1.0 h1:ELiPxACz7vdo1qAvvaWJg1NrYFoY6gqAh/+Uo6aXdD8= github.com/pingcap/log v1.1.0/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= -github.com/pingcap/tidb/parser v0.0.0-20230815160630-b69fa21942d1 h1:FvX5fDJ32eblK9f6KJIOVujjtu3FDEfcRGHsEDfJ4kI= -github.com/pingcap/tidb/parser v0.0.0-20230815160630-b69fa21942d1/go.mod h1:pWA6mNa/o7UTDKrg+4H75NdpRgpWRTox/cqQjaQ4ZBU= +github.com/pingcap/tidb/pkg/parser v0.0.0-20250324122243-d51e00e5bbf0 h1:W3rpAI3bubR6VWOcwxDIG0Gz9G5rl5b3SL116T0vBt0= +github.com/pingcap/tidb/pkg/parser v0.0.0-20250324122243-d51e00e5bbf0/go.mod h1:+8feuexTKcXHZF/dkDfvCwEyBAmgb4paFc3/WeYV2eE= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -156,41 +155,53 @@ github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OK github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= -github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s= +github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0= +github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= +github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stoewer/go-strcase v1.2.0 h1:Z2iHWqGXH00XYgqDmNgQbIBxf3wrNq0F3feEy0ainaU= github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/tetratelabs/wazero v1.9.0 h1:IcZ56OuxrtaEz8UYNRHBrUa9bYeX9oVY93KspZZBf/I= +github.com/tetratelabs/wazero v1.9.0/go.mod h1:TSbcXCfFP0L2FGkRPxHphadXPjo1T6W+CseNNY7EkjM= +github.com/wasilibs/go-pgquery v0.0.0-20250409022910-10ac41983c07 h1:mJdDDPblDfPe7z7go8Dvv1AJQDI3eQ/5xith3q2mFlo= +github.com/wasilibs/go-pgquery v0.0.0-20250409022910-10ac41983c07/go.mod h1:Ak17IJ037caFp4jpCw/iQQ7/W74Sqpb1YuKJU6HTKfM= +github.com/wasilibs/wazero-helpers v0.0.0-20240620070341-3dff1577cd52 h1:OvLBa8SqJnZ6P+mjlzc2K7PM22rRUPE1x32G9DTPrC4= +github.com/wasilibs/wazero-helpers v0.0.0-20240620070341-3dff1577cd52/go.mod h1:jMeV4Vpbi8osrE/pKUxRZkVaA0EX7NZN0A9/oRzgpgY= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= +go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= +go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= +go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= +go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= +go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= +go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= +go.opentelemetry.io/otel/sdk/metric v1.37.0 h1:90lI228XrB9jCMuSdA0673aubgRobVZFhbjxHHspCPc= +go.opentelemetry.io/otel/sdk/metric v1.37.0/go.mod h1:cNen4ZWfiD37l5NhS+Keb5RXVWZWpRE+9WyVCpbo5ps= +go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= +go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= @@ -200,8 +211,8 @@ go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= -go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= @@ -214,8 +225,8 @@ go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.19.0/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= -go.uber.org/zap v1.25.0 h1:4Hvk6GtkucQ790dqmj7l1eEnRdKm3k3ZUrUMS2d5+5c= -go.uber.org/zap v1.25.0/go.mod h1:JIAUzQIH94IC4fOJQm7gMmBJP5k7wQfdcnYdPoEXJYk= +go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= +go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -225,29 +236,25 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= -golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= -golang.org/x/exp v0.0.0-20230724220655-d98519c11495 h1:zKGKw2WlGb8oPoRGqQ2PT8g2YoCN1w/YbbQjHXCdUWE= -golang.org/x/exp v0.0.0-20230724220655-d98519c11495/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= +golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM= +golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U= +golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b h1:M2rDM6z3Fhozi9O7NWsxAkg/yqS/lQJ6PmkyIV3YP+o= +golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b/go.mod h1:3//PLf8L/X+8b4vuAfHzxeRUl04Adcb341+IGKfnqS8= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w= +golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw= +golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= +golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -260,24 +267,18 @@ golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= +golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= -golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M= +golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= @@ -286,34 +287,29 @@ golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.34.0 h1:qIpSLOxeCYGg9TrcJokLBG4KFA6d795g0xkBkiESGlo= +golang.org/x/tools v0.34.0/go.mod h1:pAP9OwEaY1CAW3HOmg3hLZC5Z0CCmzjAF2UQMSqNARg= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5 h1:nIgk/EEq3/YlnmVVXVnm14rC2oxgs1o0ong4sD/rd44= -google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5/go.mod h1:5DZzOUPCLYL3mNkQ0ms0F3EuUNZ7py1Bqeq6sxzI7/Q= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230803162519-f966b187b2e5 h1:eSaPbMR4T7WfH9FvABk36NBMacoTUKdWCvV0dx+KfOg= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230803162519-f966b187b2e5/go.mod h1:zBEcrKX2ZOcEkHWxBPAIvYUWOKKMIhYcmNiUIu2ji3I= -google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I= -google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= +gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= +google.golang.org/genproto/googleapis/api v0.0.0-20250707201910-8d1bb00bc6a7 h1:FiusG7LWj+4byqhbvmB+Q93B/mOxJLN2DTozDuZm4EU= +google.golang.org/genproto/googleapis/api v0.0.0-20250707201910-8d1bb00bc6a7/go.mod h1:kXqgZtrWaf6qS3jZOCnCH7WYfrvFjkC51bM8fz3RsCA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250707201910-8d1bb00bc6a7 h1:pFyd6EwwL2TqFf8emdthzeX+gZE1ElRq3iM8pui4KBY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250707201910-8d1bb00bc6a7/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A= +google.golang.org/grpc v1.75.1 h1:/ODCNEuf9VghjgO3rqLcfg8fiOP0nSluljWFlDxELLI= +google.golang.org/grpc v1.75.1/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw= +google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= @@ -322,10 +318,35 @@ gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24 gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +modernc.org/cc/v4 v4.26.2 h1:991HMkLjJzYBIfha6ECZdjrIYz2/1ayr+FL8GN+CNzM= +modernc.org/cc/v4 v4.26.2/go.mod h1:uVtb5OGqUKpoLWhqwNQo/8LwvoiEBLvZXIQ/SmO6mL0= +modernc.org/ccgo/v4 v4.28.0 h1:rjznn6WWehKq7dG4JtLRKxb52Ecv8OUGah8+Z/SfpNU= +modernc.org/ccgo/v4 v4.28.0/go.mod h1:JygV3+9AV6SmPhDasu4JgquwU81XAKLd3OKTUDNOiKE= +modernc.org/fileutil v1.3.8 h1:qtzNm7ED75pd1C7WgAGcK4edm4fvhtBsEiI/0NQ54YM= +modernc.org/fileutil v1.3.8/go.mod h1:HxmghZSZVAz/LXcMNwZPA/DRrQZEVP9VX0V4LQGQFOc= +modernc.org/gc/v2 v2.6.5 h1:nyqdV8q46KvTpZlsw66kWqwXRHdjIlJOhG6kxiV/9xI= +modernc.org/gc/v2 v2.6.5/go.mod h1:YgIahr1ypgfe7chRuJi2gD7DBQiKSLMPgBQe9oIiito= +modernc.org/goabi0 v0.2.0 h1:HvEowk7LxcPd0eq6mVOAEMai46V+i7Jrj13t4AzuNks= +modernc.org/goabi0 v0.2.0/go.mod h1:CEFRnnJhKvWT1c1JTI3Avm+tgOWbkOu5oPA8eH8LnMI= +modernc.org/libc v1.66.3 h1:cfCbjTUcdsKyyZZfEUKfoHcP3S0Wkvz3jgSzByEWVCQ= +modernc.org/libc v1.66.3/go.mod h1:XD9zO8kt59cANKvHPXpx7yS2ELPheAey0vjIuZOhOU8= +modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU= +modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg= +modernc.org/memory v1.11.0 h1:o4QC8aMQzmcwCK3t3Ux/ZHmwFPzE6hf2Y5LbkRs+hbI= +modernc.org/memory v1.11.0/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw= +modernc.org/opt v0.1.4 h1:2kNGMRiUjrp4LcaPuLY2PzUfqM/w9N23quVwhKt5Qm8= +modernc.org/opt v0.1.4/go.mod h1:03fq9lsNfvkYSfxrfUhZCWPk1lm4cq4N+Bh//bEtgns= +modernc.org/sortutil v1.2.1 h1:+xyoGf15mM3NMlPDnFqrteY07klSFxLElE2PVuWIJ7w= +modernc.org/sortutil v1.2.1/go.mod h1:7ZI3a3REbai7gzCLcotuw9AC4VZVpYMjDzETGsSMqJE= +modernc.org/sqlite v1.38.2 h1:Aclu7+tgjgcQVShZqim41Bbw9Cho0y/7WzYptXqkEek= +modernc.org/sqlite v1.38.2/go.mod h1:cPTJYSlgg3Sfg046yBShXENNtPrWrDX8bsbAQBzgQ5E= +modernc.org/strutil v1.2.1 h1:UneZBkQA+DX2Rp35KcM69cSsNES9ly8mQWD71HKlOA0= +modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A= +modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= +modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= diff --git a/internal/analysis/analysis.pb.go b/internal/analysis/analysis.pb.go new file mode 100644 index 0000000000..e039cd6162 --- /dev/null +++ b/internal/analysis/analysis.pb.go @@ -0,0 +1,546 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc (unknown) +// source: analysis/analysis.proto + +package analysis + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Identifier struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Catalog string `protobuf:"bytes,1,opt,name=catalog,proto3" json:"catalog,omitempty"` + Schema string `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *Identifier) Reset() { + *x = Identifier{} + if protoimpl.UnsafeEnabled { + mi := &file_analysis_analysis_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Identifier) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Identifier) ProtoMessage() {} + +func (x *Identifier) ProtoReflect() protoreflect.Message { + mi := &file_analysis_analysis_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Identifier.ProtoReflect.Descriptor instead. +func (*Identifier) Descriptor() ([]byte, []int) { + return file_analysis_analysis_proto_rawDescGZIP(), []int{0} +} + +func (x *Identifier) GetCatalog() string { + if x != nil { + return x.Catalog + } + return "" +} + +func (x *Identifier) GetSchema() string { + if x != nil { + return x.Schema + } + return "" +} + +func (x *Identifier) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type Column struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + OriginalName string `protobuf:"bytes,2,opt,name=original_name,json=originalName,proto3" json:"original_name,omitempty"` + DataType string `protobuf:"bytes,3,opt,name=data_type,json=dataType,proto3" json:"data_type,omitempty"` + NotNull bool `protobuf:"varint,4,opt,name=not_null,json=notNull,proto3" json:"not_null,omitempty"` + Unsigned bool `protobuf:"varint,5,opt,name=unsigned,proto3" json:"unsigned,omitempty"` + IsArray bool `protobuf:"varint,6,opt,name=is_array,json=isArray,proto3" json:"is_array,omitempty"` + ArrayDims int32 `protobuf:"varint,7,opt,name=array_dims,json=arrayDims,proto3" json:"array_dims,omitempty"` + Comment string `protobuf:"bytes,8,opt,name=comment,proto3" json:"comment,omitempty"` + Length int32 `protobuf:"varint,9,opt,name=length,proto3" json:"length,omitempty"` // *int + IsNamedParam bool `protobuf:"varint,10,opt,name=is_named_param,json=isNamedParam,proto3" json:"is_named_param,omitempty"` + IsFuncCall bool `protobuf:"varint,11,opt,name=is_func_call,json=isFuncCall,proto3" json:"is_func_call,omitempty"` + Scope string `protobuf:"bytes,12,opt,name=scope,proto3" json:"scope,omitempty"` + Table *Identifier `protobuf:"bytes,13,opt,name=table,proto3" json:"table,omitempty"` + TableAlias string `protobuf:"bytes,14,opt,name=table_alias,json=tableAlias,proto3" json:"table_alias,omitempty"` + Type *Identifier `protobuf:"bytes,15,opt,name=type,proto3" json:"type,omitempty"` + EmbedTable *Identifier `protobuf:"bytes,16,opt,name=embed_table,json=embedTable,proto3" json:"embed_table,omitempty"` + IsSqlcSlice bool `protobuf:"varint,17,opt,name=is_sqlc_slice,json=isSqlcSlice,proto3" json:"is_sqlc_slice,omitempty"` +} + +func (x *Column) Reset() { + *x = Column{} + if protoimpl.UnsafeEnabled { + mi := &file_analysis_analysis_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Column) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Column) ProtoMessage() {} + +func (x *Column) ProtoReflect() protoreflect.Message { + mi := &file_analysis_analysis_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Column.ProtoReflect.Descriptor instead. +func (*Column) Descriptor() ([]byte, []int) { + return file_analysis_analysis_proto_rawDescGZIP(), []int{1} +} + +func (x *Column) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Column) GetOriginalName() string { + if x != nil { + return x.OriginalName + } + return "" +} + +func (x *Column) GetDataType() string { + if x != nil { + return x.DataType + } + return "" +} + +func (x *Column) GetNotNull() bool { + if x != nil { + return x.NotNull + } + return false +} + +func (x *Column) GetUnsigned() bool { + if x != nil { + return x.Unsigned + } + return false +} + +func (x *Column) GetIsArray() bool { + if x != nil { + return x.IsArray + } + return false +} + +func (x *Column) GetArrayDims() int32 { + if x != nil { + return x.ArrayDims + } + return 0 +} + +func (x *Column) GetComment() string { + if x != nil { + return x.Comment + } + return "" +} + +func (x *Column) GetLength() int32 { + if x != nil { + return x.Length + } + return 0 +} + +func (x *Column) GetIsNamedParam() bool { + if x != nil { + return x.IsNamedParam + } + return false +} + +func (x *Column) GetIsFuncCall() bool { + if x != nil { + return x.IsFuncCall + } + return false +} + +func (x *Column) GetScope() string { + if x != nil { + return x.Scope + } + return "" +} + +func (x *Column) GetTable() *Identifier { + if x != nil { + return x.Table + } + return nil +} + +func (x *Column) GetTableAlias() string { + if x != nil { + return x.TableAlias + } + return "" +} + +func (x *Column) GetType() *Identifier { + if x != nil { + return x.Type + } + return nil +} + +func (x *Column) GetEmbedTable() *Identifier { + if x != nil { + return x.EmbedTable + } + return nil +} + +func (x *Column) GetIsSqlcSlice() bool { + if x != nil { + return x.IsSqlcSlice + } + return false +} + +type Parameter struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Number int32 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"` + Column *Column `protobuf:"bytes,2,opt,name=column,proto3" json:"column,omitempty"` +} + +func (x *Parameter) Reset() { + *x = Parameter{} + if protoimpl.UnsafeEnabled { + mi := &file_analysis_analysis_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Parameter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Parameter) ProtoMessage() {} + +func (x *Parameter) ProtoReflect() protoreflect.Message { + mi := &file_analysis_analysis_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Parameter.ProtoReflect.Descriptor instead. +func (*Parameter) Descriptor() ([]byte, []int) { + return file_analysis_analysis_proto_rawDescGZIP(), []int{2} +} + +func (x *Parameter) GetNumber() int32 { + if x != nil { + return x.Number + } + return 0 +} + +func (x *Parameter) GetColumn() *Column { + if x != nil { + return x.Column + } + return nil +} + +type Analysis struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Columns []*Column `protobuf:"bytes,1,rep,name=columns,proto3" json:"columns,omitempty"` + Params []*Parameter `protobuf:"bytes,2,rep,name=params,proto3" json:"params,omitempty"` +} + +func (x *Analysis) Reset() { + *x = Analysis{} + if protoimpl.UnsafeEnabled { + mi := &file_analysis_analysis_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Analysis) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Analysis) ProtoMessage() {} + +func (x *Analysis) ProtoReflect() protoreflect.Message { + mi := &file_analysis_analysis_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Analysis.ProtoReflect.Descriptor instead. +func (*Analysis) Descriptor() ([]byte, []int) { + return file_analysis_analysis_proto_rawDescGZIP(), []int{3} +} + +func (x *Analysis) GetColumns() []*Column { + if x != nil { + return x.Columns + } + return nil +} + +func (x *Analysis) GetParams() []*Parameter { + if x != nil { + return x.Params + } + return nil +} + +var File_analysis_analysis_proto protoreflect.FileDescriptor + +var file_analysis_analysis_proto_rawDesc = []byte{ + 0x0a, 0x17, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x2f, 0x61, 0x6e, 0x61, 0x6c, 0x79, + 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x61, 0x6e, 0x61, 0x6c, 0x79, + 0x73, 0x69, 0x73, 0x22, 0x52, 0x0a, 0x0a, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, + 0x72, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x73, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, + 0x65, 0x6d, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xb1, 0x04, 0x0a, 0x06, 0x43, 0x6f, 0x6c, 0x75, + 0x6d, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, + 0x61, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6f, + 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x64, + 0x61, 0x74, 0x61, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x64, 0x61, 0x74, 0x61, 0x54, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x6f, 0x74, 0x5f, + 0x6e, 0x75, 0x6c, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x6e, 0x6f, 0x74, 0x4e, + 0x75, 0x6c, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x12, + 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x61, 0x72, 0x72, 0x61, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x07, 0x69, 0x73, 0x41, 0x72, 0x72, 0x61, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x72, + 0x72, 0x61, 0x79, 0x5f, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, + 0x61, 0x72, 0x72, 0x61, 0x79, 0x44, 0x69, 0x6d, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, + 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x09, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x24, 0x0a, 0x0e, 0x69, + 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x0c, 0x69, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x12, 0x20, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x66, 0x75, 0x6e, 0x63, 0x5f, 0x63, 0x61, 0x6c, + 0x6c, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x46, 0x75, 0x6e, 0x63, 0x43, + 0x61, 0x6c, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x0c, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x74, 0x61, 0x62, + 0x6c, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, + 0x73, 0x69, 0x73, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x05, + 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, + 0x6c, 0x69, 0x61, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x61, 0x62, 0x6c, + 0x65, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x28, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0f, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x2e, + 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x12, 0x35, 0x0a, 0x0b, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, + 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, + 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x0a, 0x65, 0x6d, 0x62, + 0x65, 0x64, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x69, 0x73, 0x5f, 0x73, 0x71, + 0x6c, 0x63, 0x5f, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, + 0x69, 0x73, 0x53, 0x71, 0x6c, 0x63, 0x53, 0x6c, 0x69, 0x63, 0x65, 0x22, 0x4d, 0x0a, 0x09, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x12, 0x28, 0x0a, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x10, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x2e, 0x43, 0x6f, 0x6c, 0x75, + 0x6d, 0x6e, 0x52, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x22, 0x63, 0x0a, 0x08, 0x41, 0x6e, + 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x12, 0x2a, 0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, + 0x69, 0x73, 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, + 0x6e, 0x73, 0x12, 0x2b, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x2e, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, + 0x89, 0x01, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, + 0x42, 0x0d, 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x71, + 0x6c, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x73, 0x71, 0x6c, 0x63, 0x2f, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0xa2, 0x02, 0x03, + 0x41, 0x58, 0x58, 0xaa, 0x02, 0x08, 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0xca, 0x02, + 0x08, 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0xe2, 0x02, 0x14, 0x41, 0x6e, 0x61, 0x6c, + 0x79, 0x73, 0x69, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0xea, 0x02, 0x08, 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_analysis_analysis_proto_rawDescOnce sync.Once + file_analysis_analysis_proto_rawDescData = file_analysis_analysis_proto_rawDesc +) + +func file_analysis_analysis_proto_rawDescGZIP() []byte { + file_analysis_analysis_proto_rawDescOnce.Do(func() { + file_analysis_analysis_proto_rawDescData = protoimpl.X.CompressGZIP(file_analysis_analysis_proto_rawDescData) + }) + return file_analysis_analysis_proto_rawDescData +} + +var file_analysis_analysis_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_analysis_analysis_proto_goTypes = []interface{}{ + (*Identifier)(nil), // 0: analysis.Identifier + (*Column)(nil), // 1: analysis.Column + (*Parameter)(nil), // 2: analysis.Parameter + (*Analysis)(nil), // 3: analysis.Analysis +} +var file_analysis_analysis_proto_depIdxs = []int32{ + 0, // 0: analysis.Column.table:type_name -> analysis.Identifier + 0, // 1: analysis.Column.type:type_name -> analysis.Identifier + 0, // 2: analysis.Column.embed_table:type_name -> analysis.Identifier + 1, // 3: analysis.Parameter.column:type_name -> analysis.Column + 1, // 4: analysis.Analysis.columns:type_name -> analysis.Column + 2, // 5: analysis.Analysis.params:type_name -> analysis.Parameter + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_analysis_analysis_proto_init() } +func file_analysis_analysis_proto_init() { + if File_analysis_analysis_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_analysis_analysis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Identifier); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_analysis_analysis_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Column); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_analysis_analysis_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Parameter); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_analysis_analysis_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Analysis); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_analysis_analysis_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_analysis_analysis_proto_goTypes, + DependencyIndexes: file_analysis_analysis_proto_depIdxs, + MessageInfos: file_analysis_analysis_proto_msgTypes, + }.Build() + File_analysis_analysis_proto = out.File + file_analysis_analysis_proto_rawDesc = nil + file_analysis_analysis_proto_goTypes = nil + file_analysis_analysis_proto_depIdxs = nil +} diff --git a/internal/analysis/analysis_vtproto.pb.go b/internal/analysis/analysis_vtproto.pb.go new file mode 100644 index 0000000000..7aacb8635b --- /dev/null +++ b/internal/analysis/analysis_vtproto.pb.go @@ -0,0 +1,2078 @@ +// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. +// protoc-gen-go-vtproto version: v0.4.0 +// source: analysis/analysis.proto + +package analysis + +import ( + fmt "fmt" + proto "google.golang.org/protobuf/proto" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + bits "math/bits" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +func (m *Identifier) CloneVT() *Identifier { + if m == nil { + return (*Identifier)(nil) + } + r := &Identifier{ + Catalog: m.Catalog, + Schema: m.Schema, + Name: m.Name, + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Identifier) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *Column) CloneVT() *Column { + if m == nil { + return (*Column)(nil) + } + r := &Column{ + Name: m.Name, + OriginalName: m.OriginalName, + DataType: m.DataType, + NotNull: m.NotNull, + Unsigned: m.Unsigned, + IsArray: m.IsArray, + ArrayDims: m.ArrayDims, + Comment: m.Comment, + Length: m.Length, + IsNamedParam: m.IsNamedParam, + IsFuncCall: m.IsFuncCall, + Scope: m.Scope, + Table: m.Table.CloneVT(), + TableAlias: m.TableAlias, + Type: m.Type.CloneVT(), + EmbedTable: m.EmbedTable.CloneVT(), + IsSqlcSlice: m.IsSqlcSlice, + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Column) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *Parameter) CloneVT() *Parameter { + if m == nil { + return (*Parameter)(nil) + } + r := &Parameter{ + Number: m.Number, + Column: m.Column.CloneVT(), + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Parameter) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *Analysis) CloneVT() *Analysis { + if m == nil { + return (*Analysis)(nil) + } + r := &Analysis{} + if rhs := m.Columns; rhs != nil { + tmpContainer := make([]*Column, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v.CloneVT() + } + r.Columns = tmpContainer + } + if rhs := m.Params; rhs != nil { + tmpContainer := make([]*Parameter, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v.CloneVT() + } + r.Params = tmpContainer + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Analysis) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (this *Identifier) EqualVT(that *Identifier) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Catalog != that.Catalog { + return false + } + if this.Schema != that.Schema { + return false + } + if this.Name != that.Name { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Identifier) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*Identifier) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *Column) EqualVT(that *Column) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Name != that.Name { + return false + } + if this.OriginalName != that.OriginalName { + return false + } + if this.DataType != that.DataType { + return false + } + if this.NotNull != that.NotNull { + return false + } + if this.Unsigned != that.Unsigned { + return false + } + if this.IsArray != that.IsArray { + return false + } + if this.ArrayDims != that.ArrayDims { + return false + } + if this.Comment != that.Comment { + return false + } + if this.Length != that.Length { + return false + } + if this.IsNamedParam != that.IsNamedParam { + return false + } + if this.IsFuncCall != that.IsFuncCall { + return false + } + if this.Scope != that.Scope { + return false + } + if !this.Table.EqualVT(that.Table) { + return false + } + if this.TableAlias != that.TableAlias { + return false + } + if !this.Type.EqualVT(that.Type) { + return false + } + if !this.EmbedTable.EqualVT(that.EmbedTable) { + return false + } + if this.IsSqlcSlice != that.IsSqlcSlice { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Column) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*Column) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *Parameter) EqualVT(that *Parameter) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Number != that.Number { + return false + } + if !this.Column.EqualVT(that.Column) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Parameter) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*Parameter) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *Analysis) EqualVT(that *Analysis) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if len(this.Columns) != len(that.Columns) { + return false + } + for i, vx := range this.Columns { + vy := that.Columns[i] + if p, q := vx, vy; p != q { + if p == nil { + p = &Column{} + } + if q == nil { + q = &Column{} + } + if !p.EqualVT(q) { + return false + } + } + } + if len(this.Params) != len(that.Params) { + return false + } + for i, vx := range this.Params { + vy := that.Params[i] + if p, q := vx, vy; p != q { + if p == nil { + p = &Parameter{} + } + if q == nil { + q = &Parameter{} + } + if !p.EqualVT(q) { + return false + } + } + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Analysis) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*Analysis) + if !ok { + return false + } + return this.EqualVT(that) +} +func (m *Identifier) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Identifier) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Identifier) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarint(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x1a + } + if len(m.Schema) > 0 { + i -= len(m.Schema) + copy(dAtA[i:], m.Schema) + i = encodeVarint(dAtA, i, uint64(len(m.Schema))) + i-- + dAtA[i] = 0x12 + } + if len(m.Catalog) > 0 { + i -= len(m.Catalog) + copy(dAtA[i:], m.Catalog) + i = encodeVarint(dAtA, i, uint64(len(m.Catalog))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Column) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Column) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Column) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.IsSqlcSlice { + i-- + if m.IsSqlcSlice { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x88 + } + if m.EmbedTable != nil { + size, err := m.EmbedTable.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x82 + } + if m.Type != nil { + size, err := m.Type.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x7a + } + if len(m.TableAlias) > 0 { + i -= len(m.TableAlias) + copy(dAtA[i:], m.TableAlias) + i = encodeVarint(dAtA, i, uint64(len(m.TableAlias))) + i-- + dAtA[i] = 0x72 + } + if m.Table != nil { + size, err := m.Table.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x6a + } + if len(m.Scope) > 0 { + i -= len(m.Scope) + copy(dAtA[i:], m.Scope) + i = encodeVarint(dAtA, i, uint64(len(m.Scope))) + i-- + dAtA[i] = 0x62 + } + if m.IsFuncCall { + i-- + if m.IsFuncCall { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x58 + } + if m.IsNamedParam { + i-- + if m.IsNamedParam { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x50 + } + if m.Length != 0 { + i = encodeVarint(dAtA, i, uint64(m.Length)) + i-- + dAtA[i] = 0x48 + } + if len(m.Comment) > 0 { + i -= len(m.Comment) + copy(dAtA[i:], m.Comment) + i = encodeVarint(dAtA, i, uint64(len(m.Comment))) + i-- + dAtA[i] = 0x42 + } + if m.ArrayDims != 0 { + i = encodeVarint(dAtA, i, uint64(m.ArrayDims)) + i-- + dAtA[i] = 0x38 + } + if m.IsArray { + i-- + if m.IsArray { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + if m.Unsigned { + i-- + if m.Unsigned { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if m.NotNull { + i-- + if m.NotNull { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if len(m.DataType) > 0 { + i -= len(m.DataType) + copy(dAtA[i:], m.DataType) + i = encodeVarint(dAtA, i, uint64(len(m.DataType))) + i-- + dAtA[i] = 0x1a + } + if len(m.OriginalName) > 0 { + i -= len(m.OriginalName) + copy(dAtA[i:], m.OriginalName) + i = encodeVarint(dAtA, i, uint64(len(m.OriginalName))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarint(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Parameter) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Parameter) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Parameter) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Column != nil { + size, err := m.Column.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + if m.Number != 0 { + i = encodeVarint(dAtA, i, uint64(m.Number)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Analysis) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Analysis) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Analysis) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Params) > 0 { + for iNdEx := len(m.Params) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Params[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + } + if len(m.Columns) > 0 { + for iNdEx := len(m.Columns) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Columns[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarint(dAtA []byte, offset int, v uint64) int { + offset -= sov(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Identifier) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Identifier) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *Identifier) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarint(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x1a + } + if len(m.Schema) > 0 { + i -= len(m.Schema) + copy(dAtA[i:], m.Schema) + i = encodeVarint(dAtA, i, uint64(len(m.Schema))) + i-- + dAtA[i] = 0x12 + } + if len(m.Catalog) > 0 { + i -= len(m.Catalog) + copy(dAtA[i:], m.Catalog) + i = encodeVarint(dAtA, i, uint64(len(m.Catalog))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Column) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Column) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *Column) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.IsSqlcSlice { + i-- + if m.IsSqlcSlice { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x88 + } + if m.EmbedTable != nil { + size, err := m.EmbedTable.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x82 + } + if m.Type != nil { + size, err := m.Type.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x7a + } + if len(m.TableAlias) > 0 { + i -= len(m.TableAlias) + copy(dAtA[i:], m.TableAlias) + i = encodeVarint(dAtA, i, uint64(len(m.TableAlias))) + i-- + dAtA[i] = 0x72 + } + if m.Table != nil { + size, err := m.Table.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x6a + } + if len(m.Scope) > 0 { + i -= len(m.Scope) + copy(dAtA[i:], m.Scope) + i = encodeVarint(dAtA, i, uint64(len(m.Scope))) + i-- + dAtA[i] = 0x62 + } + if m.IsFuncCall { + i-- + if m.IsFuncCall { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x58 + } + if m.IsNamedParam { + i-- + if m.IsNamedParam { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x50 + } + if m.Length != 0 { + i = encodeVarint(dAtA, i, uint64(m.Length)) + i-- + dAtA[i] = 0x48 + } + if len(m.Comment) > 0 { + i -= len(m.Comment) + copy(dAtA[i:], m.Comment) + i = encodeVarint(dAtA, i, uint64(len(m.Comment))) + i-- + dAtA[i] = 0x42 + } + if m.ArrayDims != 0 { + i = encodeVarint(dAtA, i, uint64(m.ArrayDims)) + i-- + dAtA[i] = 0x38 + } + if m.IsArray { + i-- + if m.IsArray { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + if m.Unsigned { + i-- + if m.Unsigned { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if m.NotNull { + i-- + if m.NotNull { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if len(m.DataType) > 0 { + i -= len(m.DataType) + copy(dAtA[i:], m.DataType) + i = encodeVarint(dAtA, i, uint64(len(m.DataType))) + i-- + dAtA[i] = 0x1a + } + if len(m.OriginalName) > 0 { + i -= len(m.OriginalName) + copy(dAtA[i:], m.OriginalName) + i = encodeVarint(dAtA, i, uint64(len(m.OriginalName))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarint(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Parameter) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Parameter) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *Parameter) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Column != nil { + size, err := m.Column.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + if m.Number != 0 { + i = encodeVarint(dAtA, i, uint64(m.Number)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Analysis) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Analysis) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *Analysis) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Params) > 0 { + for iNdEx := len(m.Params) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Params[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + } + if len(m.Columns) > 0 { + for iNdEx := len(m.Columns) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Columns[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *Identifier) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Catalog) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + l = len(m.Schema) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *Column) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + l = len(m.OriginalName) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + l = len(m.DataType) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.NotNull { + n += 2 + } + if m.Unsigned { + n += 2 + } + if m.IsArray { + n += 2 + } + if m.ArrayDims != 0 { + n += 1 + sov(uint64(m.ArrayDims)) + } + l = len(m.Comment) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.Length != 0 { + n += 1 + sov(uint64(m.Length)) + } + if m.IsNamedParam { + n += 2 + } + if m.IsFuncCall { + n += 2 + } + l = len(m.Scope) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.Table != nil { + l = m.Table.SizeVT() + n += 1 + l + sov(uint64(l)) + } + l = len(m.TableAlias) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.Type != nil { + l = m.Type.SizeVT() + n += 1 + l + sov(uint64(l)) + } + if m.EmbedTable != nil { + l = m.EmbedTable.SizeVT() + n += 2 + l + sov(uint64(l)) + } + if m.IsSqlcSlice { + n += 3 + } + n += len(m.unknownFields) + return n +} + +func (m *Parameter) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Number != 0 { + n += 1 + sov(uint64(m.Number)) + } + if m.Column != nil { + l = m.Column.SizeVT() + n += 1 + l + sov(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *Analysis) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Columns) > 0 { + for _, e := range m.Columns { + l = e.SizeVT() + n += 1 + l + sov(uint64(l)) + } + } + if len(m.Params) > 0 { + for _, e := range m.Params { + l = e.SizeVT() + n += 1 + l + sov(uint64(l)) + } + } + n += len(m.unknownFields) + return n +} + +func sov(x uint64) (n int) { + return (bits.Len64(x|1) + 6) / 7 +} +func soz(x uint64) (n int) { + return sov(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Identifier) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Identifier: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Identifier: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Catalog", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Catalog = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Schema", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Schema = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Column) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Column: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Column: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OriginalName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OriginalName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DataType", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DataType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NotNull", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.NotNull = bool(v != 0) + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Unsigned", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Unsigned = bool(v != 0) + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsArray", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsArray = bool(v != 0) + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ArrayDims", wireType) + } + m.ArrayDims = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ArrayDims |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Comment", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Comment = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Length", wireType) + } + m.Length = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Length |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsNamedParam", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsNamedParam = bool(v != 0) + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsFuncCall", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsFuncCall = bool(v != 0) + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Scope", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Scope = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Table", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Table == nil { + m.Table = &Identifier{} + } + if err := m.Table.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TableAlias", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TableAlias = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 15: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Type == nil { + m.Type = &Identifier{} + } + if err := m.Type.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 16: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EmbedTable", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.EmbedTable == nil { + m.EmbedTable = &Identifier{} + } + if err := m.EmbedTable.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 17: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsSqlcSlice", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsSqlcSlice = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Parameter) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Parameter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Parameter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Number", wireType) + } + m.Number = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Number |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Column", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Column == nil { + m.Column = &Column{} + } + if err := m.Column.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Analysis) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Analysis: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Analysis: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Columns", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Columns = append(m.Columns, &Column{}) + if err := m.Columns[len(m.Columns)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Params = append(m.Params, &Parameter{}) + if err := m.Params[len(m.Params)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func skip(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLength + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroup + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLength + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLength = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflow = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") +) diff --git a/internal/analyzer/analyzer.go b/internal/analyzer/analyzer.go new file mode 100644 index 0000000000..3d7e3a0287 --- /dev/null +++ b/internal/analyzer/analyzer.go @@ -0,0 +1,116 @@ +package analyzer + +import ( + "context" + "encoding/json" + "fmt" + "hash/fnv" + "log/slog" + "os" + "path/filepath" + + "google.golang.org/protobuf/proto" + + "github.com/sqlc-dev/sqlc/internal/analysis" + "github.com/sqlc-dev/sqlc/internal/cache" + "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/info" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/named" +) + +type CachedAnalyzer struct { + a Analyzer + config config.Config + configBytes []byte + db config.Database +} + +func Cached(a Analyzer, c config.Config, db config.Database) *CachedAnalyzer { + return &CachedAnalyzer{ + a: a, + config: c, + db: db, + } +} + +// Create a new error here + +func (c *CachedAnalyzer) Analyze(ctx context.Context, n ast.Node, q string, schema []string, np *named.ParamSet) (*analysis.Analysis, error) { + result, rerun, err := c.analyze(ctx, n, q, schema, np) + if rerun { + if err != nil { + slog.Warn("first analysis failed with error", "err", err) + } + return c.a.Analyze(ctx, n, q, schema, np) + } + return result, err +} + +func (c *CachedAnalyzer) analyze(ctx context.Context, n ast.Node, q string, schema []string, np *named.ParamSet) (*analysis.Analysis, bool, error) { + // Only cache queries for managed databases. We can't be certain the + // database is in an unchanged state otherwise + if !c.db.Managed { + return nil, true, nil + } + + dir, err := cache.AnalysisDir() + if err != nil { + return nil, true, err + } + + if c.configBytes == nil { + c.configBytes, err = json.Marshal(c.config) + if err != nil { + return nil, true, err + } + } + + // Calculate cache key + h := fnv.New64() + h.Write([]byte(info.Version)) + h.Write(c.configBytes) + for _, m := range schema { + h.Write([]byte(m)) + } + h.Write([]byte(q)) + + key := fmt.Sprintf("%x", h.Sum(nil)) + path := filepath.Join(dir, key) + if _, err := os.Stat(path); err == nil { + contents, err := os.ReadFile(path) + if err != nil { + return nil, true, err + } + var a analysis.Analysis + if err := proto.Unmarshal(contents, &a); err != nil { + return nil, true, err + } + return &a, false, nil + } + + result, err := c.a.Analyze(ctx, n, q, schema, np) + + if err == nil { + contents, err := proto.Marshal(result) + if err != nil { + slog.Warn("unable to marshal analysis", "err", err) + return result, false, nil + } + if err := os.WriteFile(path, contents, 0644); err != nil { + slog.Warn("saving analysis to disk failed", "err", err) + return result, false, nil + } + } + + return result, false, err +} + +func (c *CachedAnalyzer) Close(ctx context.Context) error { + return c.a.Close(ctx) +} + +type Analyzer interface { + Analyze(context.Context, ast.Node, string, []string, *named.ParamSet) (*analysis.Analysis, error) + Close(context.Context) error +} diff --git a/internal/bundler/multipart.go b/internal/bundler/multipart.go index 1336c1a559..b1d1925fde 100644 --- a/internal/bundler/multipart.go +++ b/internal/bundler/multipart.go @@ -4,52 +4,37 @@ import ( "os" "path/filepath" - "github.com/sqlc-dev/sqlc/internal/config" pb "github.com/sqlc-dev/sqlc/internal/quickdb/v1" "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" ) -func readInputs(file string, conf *config.Config) ([]*pb.File, error) { - refs := map[string]struct{}{} - refs[filepath.Base(file)] = struct{}{} - - for _, pkg := range conf.SQL { - for _, paths := range []config.Paths{pkg.Schema, pkg.Queries} { - files, err := sqlpath.Glob(paths) - if err != nil { - return nil, err - } - for _, file := range files { - refs[file] = struct{}{} - } - } +func readFiles(dir string, paths []string) ([]*pb.File, error) { + files, err := sqlpath.Glob(paths) + if err != nil { + return nil, err } - - var files []*pb.File - for file, _ := range refs { - contents, err := os.ReadFile(file) + var out []*pb.File + for _, file := range files { + f, err := readFile(dir, file) if err != nil { return nil, err } - files = append(files, &pb.File{ - Name: file, - Contents: contents, - }) + out = append(out, f) } - return files, nil + return out, nil } -func readOutputs(dir string, output map[string]string) ([]*pb.File, error) { - var files []*pb.File - for filename, contents := range output { - rel, err := filepath.Rel(dir, filename) - if err != nil { - return nil, err - } - files = append(files, &pb.File{ - Name: rel, - Contents: []byte(contents), - }) +func readFile(dir string, path string) (*pb.File, error) { + rel, err := filepath.Rel(dir, path) + if err != nil { + return nil, err + } + blob, err := os.ReadFile(path) + if err != nil { + return nil, err } - return files, nil + return &pb.File{ + Name: rel, + Contents: blob, + }, nil } diff --git a/internal/bundler/upload.go b/internal/bundler/upload.go index 1152925e02..49e3b44a4c 100644 --- a/internal/bundler/upload.go +++ b/internal/bundler/upload.go @@ -2,28 +2,50 @@ package bundler import ( "context" + "errors" "fmt" + "log/slog" "os" + "strings" - "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/proto" "github.com/sqlc-dev/sqlc/internal/config" "github.com/sqlc-dev/sqlc/internal/info" + "github.com/sqlc-dev/sqlc/internal/plugin" "github.com/sqlc-dev/sqlc/internal/quickdb" pb "github.com/sqlc-dev/sqlc/internal/quickdb/v1" ) +var ErrNoProject = errors.New(`project uploads require a cloud project + +If you don't have a project, you can create one from the sqlc Cloud +dashboard at https://dashboard.sqlc.dev/. If you have a project, ensure +you've set its id as the value of the "project" field within the "cloud" +section of your sqlc configuration. The id will look similar to +"01HA8TWGMYPHK0V2GGMB3R2TP9".`) +var ErrNoAuthToken = errors.New(`project uploads require an auth token + +If you don't have an auth token, you can create one from the sqlc Cloud +dashboard at https://dashboard.sqlc.dev/. If you have an auth token, ensure +you've set it as the value of the SQLC_AUTH_TOKEN environment variable.`) + type Uploader struct { - token string configPath string config *config.Config dir string client pb.QuickClient } +type QuerySetArchive struct { + Name string + Queries []string + Schema []string + Request *plugin.GenerateRequest +} + func NewUploader(configPath, dir string, conf *config.Config) *Uploader { return &Uploader{ - token: os.Getenv("SQLC_AUTH_TOKEN"), configPath: configPath, config: conf, dir: dir, @@ -32,10 +54,10 @@ func NewUploader(configPath, dir string, conf *config.Config) *Uploader { func (up *Uploader) Validate() error { if up.config.Cloud.Project == "" { - return fmt.Errorf("cloud.project is not set") + return ErrNoProject } - if up.token == "" { - return fmt.Errorf("SQLC_AUTH_TOKEN environment variable is not set") + if up.config.Cloud.AuthToken == "" { + return ErrNoAuthToken } if up.client == nil { client, err := quickdb.NewClientFromConfig(up.config.Cloud) @@ -47,36 +69,91 @@ func (up *Uploader) Validate() error { return nil } -func (up *Uploader) buildRequest(ctx context.Context, result map[string]string) (*pb.UploadArchiveRequest, error) { - ins, err := readInputs(up.configPath, up.config) - if err != nil { - return nil, err +var envvars = []string{ + "GITHUB_REPOSITORY", + "GITHUB_REF", + "GITHUB_REF_NAME", + "GITHUB_REF_TYPE", + "GITHUB_SHA", +} + +func annotate() map[string]string { + labels := map[string]string{} + for _, ev := range envvars { + key := strings.ReplaceAll(strings.ToLower(ev), "_", ".") + labels[key] = os.Getenv(ev) } - outs, err := readOutputs(up.dir, result) + return labels +} + +func BuildRequest(ctx context.Context, dir, configPath string, results []*QuerySetArchive, tags []string) (*pb.UploadArchiveRequest, error) { + conf, err := readFile(dir, configPath) if err != nil { return nil, err } - return &pb.UploadArchiveRequest{ + res := &pb.UploadArchiveRequest{ SqlcVersion: info.Version, - Inputs: ins, - Outputs: outs, - }, nil + Config: conf, + Tags: tags, + Annotations: annotate(), + } + for i, result := range results { + schema, err := readFiles(dir, result.Schema) + if err != nil { + return nil, err + } + queries, err := readFiles(dir, result.Queries) + if err != nil { + return nil, err + } + name := result.Name + if name == "" { + name = fmt.Sprintf("queryset_%d", i) + } + genreq, err := proto.Marshal(result.Request) + if err != nil { + return nil, err + } + res.QuerySets = append(res.QuerySets, &pb.QuerySet{ + Name: name, + Schema: schema, + Queries: queries, + CodegenRequest: &pb.File{ + Name: "codegen_request.pb", + Contents: genreq, + }, + }) + } + return res, nil +} + +func (up *Uploader) buildRequest(ctx context.Context, results []*QuerySetArchive, tags []string) (*pb.UploadArchiveRequest, error) { + return BuildRequest(ctx, up.dir, up.configPath, results, tags) } -func (up *Uploader) DumpRequestOut(ctx context.Context, result map[string]string) error { - req, err := up.buildRequest(ctx, result) +func (up *Uploader) DumpRequestOut(ctx context.Context, result []*QuerySetArchive) error { + req, err := up.buildRequest(ctx, result, []string{}) if err != nil { return err } - fmt.Println(protojson.Format(req)) + slog.Info("config", "file", req.Config.Name, "bytes", len(req.Config.Contents)) + for _, qs := range req.QuerySets { + slog.Info("codegen_request", "queryset", qs.Name, "file", "codegen_request.pb") + for _, file := range qs.Schema { + slog.Info("schema", "queryset", qs.Name, "file", file.Name, "bytes", len(file.Contents)) + } + for _, file := range qs.Queries { + slog.Info("query", "queryset", qs.Name, "file", file.Name, "bytes", len(file.Contents)) + } + } return nil } -func (up *Uploader) Upload(ctx context.Context, result map[string]string) error { +func (up *Uploader) Upload(ctx context.Context, result []*QuerySetArchive, tags []string) error { if err := up.Validate(); err != nil { return err } - req, err := up.buildRequest(ctx, result) + req, err := up.buildRequest(ctx, result, tags) if err != nil { return err } diff --git a/internal/cache/cache.go b/internal/cache/cache.go new file mode 100644 index 0000000000..a6978034a7 --- /dev/null +++ b/internal/cache/cache.go @@ -0,0 +1,47 @@ +package cache + +import ( + "fmt" + "os" + "path/filepath" +) + +// The cache directory defaults to os.UserCacheDir(). This location can be +// overridden by the SQLCCACHE environment variable. +// +// Currently the cache stores two types of data: plugins and query analysis +func Dir() (string, error) { + cache := os.Getenv("SQLCCACHE") + if cache != "" { + return cache, nil + } + cacheHome, err := os.UserCacheDir() + if err != nil { + return "", err + } + return filepath.Join(cacheHome, "sqlc"), nil +} + +func PluginsDir() (string, error) { + cacheRoot, err := Dir() + if err != nil { + return "", err + } + dir := filepath.Join(cacheRoot, "plugins") + if err := os.MkdirAll(dir, 0755); err != nil && !os.IsExist(err) { + return "", fmt.Errorf("failed to create %s directory: %w", dir, err) + } + return dir, nil +} + +func AnalysisDir() (string, error) { + cacheRoot, err := Dir() + if err != nil { + return "", err + } + dir := filepath.Join(cacheRoot, "query_analysis") + if err := os.MkdirAll(dir, 0755); err != nil && !os.IsExist(err) { + return "", fmt.Errorf("failed to create %s directory: %w", dir, err) + } + return dir, nil +} diff --git a/internal/cmd/cmd.go b/internal/cmd/cmd.go index 4b542d2f42..93fd6bbeaa 100644 --- a/internal/cmd/cmd.go +++ b/internal/cmd/cmd.go @@ -25,7 +25,8 @@ import ( ) func init() { - uploadCmd.Flags().BoolP("dry-run", "", false, "dump upload request (default: false)") + createDBCmd.Flags().StringP("queryset", "", "", "name of the queryset to use") + pushCmd.Flags().BoolP("dry-run", "", false, "dump push request (default: false)") initCmd.Flags().BoolP("v1", "", false, "generate v1 config yaml file") initCmd.Flags().BoolP("v2", "", true, "generate v2 config yaml file") initCmd.MarkFlagsMutuallyExclusive("v1", "v2") @@ -35,17 +36,17 @@ func init() { func Do(args []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) int { rootCmd := &cobra.Command{Use: "sqlc", SilenceUsage: true} rootCmd.PersistentFlags().StringP("file", "f", "", "specify an alternate config file (default: sqlc.yaml)") - rootCmd.PersistentFlags().BoolP("experimental", "x", false, "DEPRECATED: enable experimental features (default: false)") rootCmd.PersistentFlags().Bool("no-remote", false, "disable remote execution (default: false)") rootCmd.PersistentFlags().Bool("remote", false, "enable remote execution (default: false)") - rootCmd.PersistentFlags().Bool("no-database", false, "disable database connections (default: false)") rootCmd.AddCommand(checkCmd) + rootCmd.AddCommand(createDBCmd) rootCmd.AddCommand(diffCmd) rootCmd.AddCommand(genCmd) rootCmd.AddCommand(initCmd) rootCmd.AddCommand(versionCmd) - rootCmd.AddCommand(uploadCmd) + rootCmd.AddCommand(verifyCmd) + rootCmd.AddCommand(pushCmd) rootCmd.AddCommand(NewCmdVet()) rootCmd.SetArgs(args) @@ -135,24 +136,21 @@ var initCmd = &cobra.Command{ } type Env struct { - DryRun bool - Debug opts.Debug - Remote bool - NoRemote bool - NoDatabase bool + DryRun bool + Debug opts.Debug + Remote bool + NoRemote bool } func ParseEnv(c *cobra.Command) Env { dr := c.Flag("dry-run") r := c.Flag("remote") nr := c.Flag("no-remote") - nodb := c.Flag("no-database") return Env{ - DryRun: dr != nil && dr.Changed, - Debug: opts.DebugFromEnv(), - Remote: r != nil && nr.Value.String() == "true", - NoRemote: nr != nil && nr.Value.String() == "true", - NoDatabase: nodb != nil && nodb.Value.String() == "true", + DryRun: dr != nil && dr.Changed, + Debug: opts.DebugFromEnv(), + Remote: r != nil && r.Value.String() == "true", + NoRemote: nr != nil && nr.Value.String() == "true", } } @@ -192,12 +190,15 @@ func getConfigPath(stderr io.Writer, f *pflag.Flag) (string, string) { var genCmd = &cobra.Command{ Use: "generate", - Short: "Generate Go code from SQL", + Short: "Generate source code from SQL", RunE: func(cmd *cobra.Command, args []string) error { defer trace.StartRegion(cmd.Context(), "generate").End() stderr := cmd.ErrOrStderr() dir, name := getConfigPath(stderr, cmd.Flag("file")) - output, err := Generate(cmd.Context(), ParseEnv(cmd), dir, name, stderr) + output, err := Generate(cmd.Context(), dir, name, &Options{ + Env: ParseEnv(cmd), + Stderr: stderr, + }) if err != nil { os.Exit(1) } @@ -213,20 +214,6 @@ var genCmd = &cobra.Command{ }, } -var uploadCmd = &cobra.Command{ - Use: "upload", - Short: "Upload the schema, queries, and configuration for this project", - RunE: func(cmd *cobra.Command, args []string) error { - stderr := cmd.ErrOrStderr() - dir, name := getConfigPath(stderr, cmd.Flag("file")) - if err := createPkg(cmd.Context(), ParseEnv(cmd), dir, name, stderr); err != nil { - fmt.Fprintf(stderr, "error uploading: %s\n", err) - os.Exit(1) - } - return nil - }, -} - var checkCmd = &cobra.Command{ Use: "compile", Short: "Statically check SQL for syntax and type errors", @@ -234,7 +221,11 @@ var checkCmd = &cobra.Command{ defer trace.StartRegion(cmd.Context(), "compile").End() stderr := cmd.ErrOrStderr() dir, name := getConfigPath(stderr, cmd.Flag("file")) - if _, err := Generate(cmd.Context(), ParseEnv(cmd), dir, name, stderr); err != nil { + _, err := Generate(cmd.Context(), dir, name, &Options{ + Env: ParseEnv(cmd), + Stderr: stderr, + }) + if err != nil { os.Exit(1) } return nil @@ -277,7 +268,11 @@ var diffCmd = &cobra.Command{ defer trace.StartRegion(cmd.Context(), "diff").End() stderr := cmd.ErrOrStderr() dir, name := getConfigPath(stderr, cmd.Flag("file")) - if err := Diff(cmd.Context(), ParseEnv(cmd), dir, name, stderr); err != nil { + opts := &Options{ + Env: ParseEnv(cmd), + Stderr: stderr, + } + if err := Diff(cmd.Context(), dir, name, opts); err != nil { os.Exit(1) } return nil diff --git a/internal/cmd/createdb.go b/internal/cmd/createdb.go new file mode 100644 index 0000000000..02b3031352 --- /dev/null +++ b/internal/cmd/createdb.go @@ -0,0 +1,103 @@ +package cmd + +import ( + "context" + "fmt" + "os" + "runtime/trace" + "time" + + "github.com/spf13/cobra" + "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/dbmanager" + "github.com/sqlc-dev/sqlc/internal/migrations" + "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" +) + +var createDBCmd = &cobra.Command{ + Use: "createdb", + Short: "Create an ephemeral database", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + defer trace.StartRegion(cmd.Context(), "createdb").End() + stderr := cmd.ErrOrStderr() + dir, filename := getConfigPath(stderr, cmd.Flag("file")) + querySetName, err := cmd.Flags().GetString("queryset") + if err != nil { + return err + } + err = CreateDB(cmd.Context(), dir, filename, querySetName, &Options{ + Env: ParseEnv(cmd), + Stderr: stderr, + }) + if err != nil { + fmt.Fprintln(stderr, err.Error()) + os.Exit(1) + } + return nil + }, +} + +func CreateDB(ctx context.Context, dir, filename, querySetName string, o *Options) error { + _, conf, err := o.ReadConfig(dir, filename) + if err != nil { + return err + } + // Find the first queryset with a managed database + var queryset *config.SQL + var count int + for _, sql := range conf.SQL { + sql := sql + if querySetName != "" && sql.Name != querySetName { + continue + } + if sql.Database != nil && sql.Database.Managed { + queryset = &sql + count += 1 + } + } + if queryset == nil && querySetName != "" { + return fmt.Errorf("no queryset found with name %q", querySetName) + } + if queryset == nil { + return fmt.Errorf("no querysets configured to use a managed database") + } + if count > 1 { + return fmt.Errorf("multiple querysets configured to use managed databases") + } + + switch queryset.Engine { + case config.EngineMySQL: + // pass + case config.EnginePostgreSQL: + // pass + default: + return fmt.Errorf("createdb does not support the %s engine", queryset.Engine) + } + + var ddl []string + files, err := sqlpath.Glob(queryset.Schema) + if err != nil { + return err + } + for _, schema := range files { + contents, err := os.ReadFile(schema) + if err != nil { + return fmt.Errorf("read file: %w", err) + } + ddl = append(ddl, migrations.RemoveRollbackStatements(string(contents))) + } + + now := time.Now().UTC().UnixNano() + client := dbmanager.NewClient(conf.Servers) + resp, err := client.CreateDatabase(ctx, &dbmanager.CreateDatabaseRequest{ + Engine: string(queryset.Engine), + Migrations: ddl, + Prefix: fmt.Sprintf("sqlc_createdb_%d", now), + }) + if err != nil { + return fmt.Errorf("managed: create database: %w", err) + } + fmt.Println(resp.Uri) + return nil +} diff --git a/internal/cmd/diff.go b/internal/cmd/diff.go index aa1ddc8788..8998971a37 100644 --- a/internal/cmd/diff.go +++ b/internal/cmd/diff.go @@ -4,7 +4,6 @@ import ( "context" "errors" "fmt" - "io" "os" "runtime/trace" "sort" @@ -13,8 +12,9 @@ import ( "github.com/cubicdaiya/gonp" ) -func Diff(ctx context.Context, e Env, dir, name string, stderr io.Writer) error { - output, err := Generate(ctx, e, dir, name, stderr) +func Diff(ctx context.Context, dir, name string, opts *Options) error { + stderr := opts.Stderr + output, err := Generate(ctx, dir, name, opts) if err != nil { return err } diff --git a/internal/cmd/generate.go b/internal/cmd/generate.go index 589295e74d..00e8871c7e 100644 --- a/internal/cmd/generate.go +++ b/internal/cmd/generate.go @@ -1,22 +1,22 @@ package cmd import ( - "bytes" "context" + "encoding/json" "errors" "fmt" "io" "os" "path/filepath" - "runtime" "runtime/trace" + "strings" "sync" - "golang.org/x/sync/errgroup" + "google.golang.org/grpc" "google.golang.org/grpc/status" "github.com/sqlc-dev/sqlc/internal/codegen/golang" - "github.com/sqlc-dev/sqlc/internal/codegen/json" + genjson "github.com/sqlc-dev/sqlc/internal/codegen/json" "github.com/sqlc-dev/sqlc/internal/compiler" "github.com/sqlc-dev/sqlc/internal/config" "github.com/sqlc-dev/sqlc/internal/config/convert" @@ -55,13 +55,6 @@ func printFileErr(stderr io.Writer, dir string, fileErr *multierr.FileError) { fmt.Fprintf(stderr, "%s:%d:%d: %s\n", filename, fileErr.Line, fileErr.Column, fileErr.Err) } -type outPair struct { - Gen config.SQLGen - Plugin *config.Codegen - - config.SQL -} - func findPlugin(conf config.Config, name string) (*config.Plugin, error) { for _, plug := range conf.Plugins { if plug.Name == name { @@ -76,8 +69,9 @@ func readConfig(stderr io.Writer, dir, filename string) (string, *config.Config, if filename != "" { configPath = filepath.Join(dir, filename) } else { - var yamlMissing, jsonMissing bool + var yamlMissing, jsonMissing, ymlMissing bool yamlPath := filepath.Join(dir, "sqlc.yaml") + ymlPath := filepath.Join(dir, "sqlc.yml") jsonPath := filepath.Join(dir, "sqlc.json") if _, err := os.Stat(yamlPath); os.IsNotExist(err) { @@ -87,18 +81,27 @@ func readConfig(stderr io.Writer, dir, filename string) (string, *config.Config, jsonMissing = true } - if yamlMissing && jsonMissing { - fmt.Fprintln(stderr, "error parsing configuration files. sqlc.yaml or sqlc.json: file does not exist") + if _, err := os.Stat(ymlPath); os.IsNotExist(err) { + ymlMissing = true + } + + if yamlMissing && ymlMissing && jsonMissing { + fmt.Fprintln(stderr, "error parsing configuration files. sqlc.(yaml|yml) or sqlc.json: file does not exist") return "", nil, errors.New("config file missing") } - if !yamlMissing && !jsonMissing { - fmt.Fprintln(stderr, "error: both sqlc.json and sqlc.yaml files present") - return "", nil, errors.New("sqlc.json and sqlc.yaml present") + if (!yamlMissing || !ymlMissing) && !jsonMissing { + fmt.Fprintln(stderr, "error: both sqlc.json and sqlc.(yaml|yml) files present") + return "", nil, errors.New("sqlc.json and sqlc.(yaml|yml) present") } - configPath = yamlPath - if yamlMissing { + if jsonMissing { + if yamlMissing { + configPath = ymlPath + } else { + configPath = yamlPath + } + } else { configPath = jsonPath } } @@ -128,8 +131,11 @@ func readConfig(stderr io.Writer, dir, filename string) (string, *config.Config, return configPath, &conf, nil } -func Generate(ctx context.Context, e Env, dir, filename string, stderr io.Writer) (map[string]string, error) { - configPath, conf, err := readConfig(stderr, dir, filename) +func Generate(ctx context.Context, dir, filename string, o *Options) (map[string]string, error) { + e := o.Env + stderr := o.Stderr + + configPath, conf, err := o.ReadConfig(dir, filename) if err != nil { return nil, err } @@ -145,126 +151,83 @@ func Generate(ctx context.Context, e Env, dir, filename string, stderr io.Writer return nil, err } + // Comment on why these two methods exist if conf.Cloud.Project != "" && e.Remote && !e.NoRemote { return remoteGenerate(ctx, configPath, conf, dir, stderr) } - output := map[string]string{} - errored := false + g := &generator{ + dir: dir, + output: map[string]string{}, + } - var pairs []outPair + if err := processQuerySets(ctx, g, conf, dir, o); err != nil { + return nil, err + } + + return g.output, nil +} + +type generator struct { + m sync.Mutex + dir string + output map[string]string +} + +func (g *generator) Pairs(ctx context.Context, conf *config.Config) []OutputPair { + var pairs []OutputPair for _, sql := range conf.SQL { if sql.Gen.Go != nil { - pairs = append(pairs, outPair{ + pairs = append(pairs, OutputPair{ SQL: sql, Gen: config.SQLGen{Go: sql.Gen.Go}, }) } if sql.Gen.JSON != nil { - pairs = append(pairs, outPair{ + pairs = append(pairs, OutputPair{ SQL: sql, Gen: config.SQLGen{JSON: sql.Gen.JSON}, }) } - for i, _ := range sql.Codegen { - pairs = append(pairs, outPair{ + for i := range sql.Codegen { + pairs = append(pairs, OutputPair{ SQL: sql, Plugin: &sql.Codegen[i], }) } } + return pairs +} - var m sync.Mutex - grp, gctx := errgroup.WithContext(ctx) - grp.SetLimit(runtime.GOMAXPROCS(0)) - - stderrs := make([]bytes.Buffer, len(pairs)) - - for i, pair := range pairs { - sql := pair - errout := &stderrs[i] - - grp.Go(func() error { - combo := config.Combine(*conf, sql.SQL) - if sql.Plugin != nil { - combo.Codegen = *sql.Plugin - } - - // TODO: This feels like a hack that will bite us later - joined := make([]string, 0, len(sql.Schema)) - for _, s := range sql.Schema { - joined = append(joined, filepath.Join(dir, s)) - } - sql.Schema = joined - - joined = make([]string, 0, len(sql.Queries)) - for _, q := range sql.Queries { - joined = append(joined, filepath.Join(dir, q)) - } - sql.Queries = joined - - var name, lang string - parseOpts := opts.Parser{ - Debug: debug.Debug, - } - - switch { - case sql.Gen.Go != nil: - name = combo.Go.Package - lang = "golang" - - case sql.Plugin != nil: - lang = fmt.Sprintf("process:%s", sql.Plugin.Plugin) - name = sql.Plugin.Plugin - } - - packageRegion := trace.StartRegion(gctx, "package") - trace.Logf(gctx, "", "name=%s dir=%s plugin=%s", name, dir, lang) - - result, failed := parse(gctx, name, dir, sql.SQL, combo, parseOpts, errout) - if failed { - packageRegion.End() - errored = true - return nil - } - - out, resp, err := codegen(gctx, combo, sql, result) - if err != nil { - fmt.Fprintf(errout, "# package %s\n", name) - fmt.Fprintf(errout, "error generating code: %s\n", err) - errored = true - packageRegion.End() - return nil - } - - files := map[string]string{} - for _, file := range resp.Files { - files[file.Name] = string(file.Contents) - } - - m.Lock() - for n, source := range files { - filename := filepath.Join(dir, out, n) - output[filename] = source - } - m.Unlock() - - packageRegion.End() - return nil - }) +func (g *generator) ProcessResult(ctx context.Context, combo config.CombinedSettings, sql OutputPair, result *compiler.Result) error { + out, resp, err := codegen(ctx, combo, sql, result) + if err != nil { + return err } - if err := grp.Wait(); err != nil { - return nil, err + files := map[string]string{} + for _, file := range resp.Files { + files[file.Name] = string(file.Contents) } - if errored { - for i, _ := range stderrs { - if _, err := io.Copy(stderr, &stderrs[i]); err != nil { - return nil, err - } + g.m.Lock() + + // out is specified by the user, not a plugin + absout := filepath.Join(g.dir, out) + + for n, source := range files { + filename := filepath.Join(g.dir, out, n) + // filepath.Join calls filepath.Clean which should remove all "..", but + // double check to make sure + if strings.Contains(filename, "..") { + return fmt.Errorf("invalid file output path: %s", filename) } - return nil, fmt.Errorf("errored") + // The output file must be contained inside the output directory + if !strings.HasPrefix(filename, absout) { + return fmt.Errorf("invalid file output path: %s", filename) + } + g.output[filename] = source } - return output, nil + g.m.Unlock() + return nil } func remoteGenerate(ctx context.Context, configPath string, conf *config.Config, dir string, stderr io.Writer) (map[string]string, error) { @@ -332,7 +295,16 @@ func remoteGenerate(ctx context.Context, configPath string, conf *config.Config, func parse(ctx context.Context, name, dir string, sql config.SQL, combo config.CombinedSettings, parserOpts opts.Parser, stderr io.Writer) (*compiler.Result, bool) { defer trace.StartRegion(ctx, "parse").End() - c := compiler.NewCompiler(sql, combo) + c, err := compiler.NewCompiler(sql, combo) + defer func() { + if c != nil { + c.Close(ctx) + } + }() + if err != nil { + fmt.Fprintf(stderr, "error creating compiler: %s\n", err) + return nil, true + } if err := c.ParseCatalog(sql.Schema); err != nil { fmt.Fprintf(stderr, "# package %s\n", name) if parserErr, ok := err.(*multierr.Error); ok { @@ -361,20 +333,12 @@ func parse(ctx context.Context, name, dir string, sql config.SQL, combo config.C return c.Result(), false } -func codegen(ctx context.Context, combo config.CombinedSettings, sql outPair, result *compiler.Result) (string, *plugin.CodeGenResponse, error) { +func codegen(ctx context.Context, combo config.CombinedSettings, sql OutputPair, result *compiler.Result) (string, *plugin.GenerateResponse, error) { defer trace.StartRegion(ctx, "codegen").End() req := codeGenRequest(result, combo) - var handler ext.Handler + var handler grpc.ClientConnInterface var out string switch { - case sql.Gen.Go != nil: - out = combo.Go.Out - handler = ext.HandleFunc(golang.Generate) - - case sql.Gen.JSON != nil: - out = combo.JSON.Out - handler = ext.HandleFunc(json.Generate) - case sql.Plugin != nil: out = sql.Plugin.Out plug, err := findPlugin(combo.Global, sql.Plugin.Plugin) @@ -385,8 +349,9 @@ func codegen(ctx context.Context, combo config.CombinedSettings, sql outPair, re switch { case plug.Process != nil: handler = &process.Runner{ - Cmd: plug.Process.Cmd, - Env: plug.Env, + Cmd: plug.Process.Cmd, + Env: plug.Env, + Format: plug.Process.Format, } case plug.WASM != nil: handler = &wasm.Runner{ @@ -400,13 +365,49 @@ func codegen(ctx context.Context, combo config.CombinedSettings, sql outPair, re opts, err := convert.YAMLtoJSON(sql.Plugin.Options) if err != nil { - return "", nil, fmt.Errorf("invalid plugin options") + return "", nil, fmt.Errorf("invalid plugin options: %w", err) + } + req.PluginOptions = opts + + global, found := combo.Global.Options[plug.Name] + if found { + opts, err := convert.YAMLtoJSON(global) + if err != nil { + return "", nil, fmt.Errorf("invalid global options: %w", err) + } + req.GlobalOptions = opts + } + + case sql.Gen.Go != nil: + out = combo.Go.Out + handler = ext.HandleFunc(golang.Generate) + opts, err := json.Marshal(sql.Gen.Go) + if err != nil { + return "", nil, fmt.Errorf("opts marshal failed: %w", err) + } + req.PluginOptions = opts + + if combo.Global.Overrides.Go != nil { + opts, err := json.Marshal(combo.Global.Overrides.Go) + if err != nil { + return "", nil, fmt.Errorf("opts marshal failed: %w", err) + } + req.GlobalOptions = opts + } + + case sql.Gen.JSON != nil: + out = combo.JSON.Out + handler = ext.HandleFunc(genjson.Generate) + opts, err := json.Marshal(sql.Gen.JSON) + if err != nil { + return "", nil, fmt.Errorf("opts marshal failed: %w", err) } req.PluginOptions = opts default: return "", nil, fmt.Errorf("missing language backend") } - resp, err := handler.Generate(ctx, req) + client := plugin.NewCodegenServiceClient(handler) + resp, err := client.Generate(ctx, req) return out, resp, err } diff --git a/internal/cmd/options.go b/internal/cmd/options.go new file mode 100644 index 0000000000..02d3614f4e --- /dev/null +++ b/internal/cmd/options.go @@ -0,0 +1,29 @@ +package cmd + +import ( + "io" + + "github.com/sqlc-dev/sqlc/internal/config" +) + +type Options struct { + Env Env + Stderr io.Writer + // TODO: Move these to a command-specific struct + Tags []string + Against string + + // Testing only + MutateConfig func(*config.Config) +} + +func (o *Options) ReadConfig(dir, filename string) (string, *config.Config, error) { + path, conf, err := readConfig(o.Stderr, dir, filename) + if err != nil { + return path, conf, err + } + if o.MutateConfig != nil { + o.MutateConfig(conf) + } + return path, conf, nil +} diff --git a/internal/cmd/package.go b/internal/cmd/package.go deleted file mode 100644 index 4b3318d915..0000000000 --- a/internal/cmd/package.go +++ /dev/null @@ -1,29 +0,0 @@ -package cmd - -import ( - "context" - "io" - "os" - - "github.com/sqlc-dev/sqlc/internal/bundler" -) - -func createPkg(ctx context.Context, e Env, dir, filename string, stderr io.Writer) error { - configPath, conf, err := readConfig(stderr, dir, filename) - if err != nil { - return err - } - up := bundler.NewUploader(configPath, dir, conf) - if err := up.Validate(); err != nil { - return err - } - output, err := Generate(ctx, e, dir, filename, stderr) - if err != nil { - os.Exit(1) - } - if e.DryRun { - return up.DumpRequestOut(ctx, output) - } else { - return up.Upload(ctx, output) - } -} diff --git a/internal/cmd/process.go b/internal/cmd/process.go new file mode 100644 index 0000000000..5003d113b8 --- /dev/null +++ b/internal/cmd/process.go @@ -0,0 +1,134 @@ +package cmd + +import ( + "bytes" + "context" + "fmt" + "io" + "path/filepath" + "runtime" + "runtime/trace" + + "golang.org/x/sync/errgroup" + + "github.com/sqlc-dev/sqlc/internal/compiler" + "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/debug" + "github.com/sqlc-dev/sqlc/internal/opts" +) + +type OutputPair struct { + Gen config.SQLGen + Plugin *config.Codegen + + config.SQL +} + +type ResultProcessor interface { + Pairs(context.Context, *config.Config) []OutputPair + ProcessResult(context.Context, config.CombinedSettings, OutputPair, *compiler.Result) error +} + +func Process(ctx context.Context, rp ResultProcessor, dir, filename string, o *Options) error { + e := o.Env + stderr := o.Stderr + + configPath, conf, err := o.ReadConfig(dir, filename) + if err != nil { + return err + } + + base := filepath.Base(configPath) + if err := config.Validate(conf); err != nil { + fmt.Fprintf(stderr, "error validating %s: %s\n", base, err) + return err + } + + if err := e.Validate(conf); err != nil { + fmt.Fprintf(stderr, "error validating %s: %s\n", base, err) + return err + } + + return processQuerySets(ctx, rp, conf, dir, o) +} + +func processQuerySets(ctx context.Context, rp ResultProcessor, conf *config.Config, dir string, o *Options) error { + stderr := o.Stderr + + errored := false + + pairs := rp.Pairs(ctx, conf) + grp, gctx := errgroup.WithContext(ctx) + grp.SetLimit(runtime.GOMAXPROCS(0)) + + stderrs := make([]bytes.Buffer, len(pairs)) + + for i, pair := range pairs { + sql := pair + errout := &stderrs[i] + + grp.Go(func() error { + combo := config.Combine(*conf, sql.SQL) + if sql.Plugin != nil { + combo.Codegen = *sql.Plugin + } + + // TODO: This feels like a hack that will bite us later + joined := make([]string, 0, len(sql.Schema)) + for _, s := range sql.Schema { + joined = append(joined, filepath.Join(dir, s)) + } + sql.Schema = joined + + joined = make([]string, 0, len(sql.Queries)) + for _, q := range sql.Queries { + joined = append(joined, filepath.Join(dir, q)) + } + sql.Queries = joined + + var name, lang string + parseOpts := opts.Parser{ + Debug: debug.Debug, + } + + switch { + case sql.Gen.Go != nil: + name = combo.Go.Package + lang = "golang" + + case sql.Plugin != nil: + lang = fmt.Sprintf("process:%s", sql.Plugin.Plugin) + name = sql.Plugin.Plugin + } + + packageRegion := trace.StartRegion(gctx, "package") + trace.Logf(gctx, "", "name=%s dir=%s plugin=%s", name, dir, lang) + + result, failed := parse(gctx, name, dir, sql.SQL, combo, parseOpts, errout) + if failed { + packageRegion.End() + errored = true + return nil + } + if err := rp.ProcessResult(gctx, combo, sql, result); err != nil { + fmt.Fprintf(errout, "# package %s\n", name) + fmt.Fprintf(errout, "error generating code: %s\n", err) + errored = true + } + packageRegion.End() + return nil + }) + } + if err := grp.Wait(); err != nil { + return err + } + if errored { + for i, _ := range stderrs { + if _, err := io.Copy(stderr, &stderrs[i]); err != nil { + return err + } + } + return fmt.Errorf("errored") + } + return nil +} diff --git a/internal/cmd/push.go b/internal/cmd/push.go new file mode 100644 index 0000000000..19aca6739b --- /dev/null +++ b/internal/cmd/push.go @@ -0,0 +1,92 @@ +package cmd + +import ( + "context" + "fmt" + "os" + "sync" + + "github.com/spf13/cobra" + + "github.com/sqlc-dev/sqlc/internal/bundler" + "github.com/sqlc-dev/sqlc/internal/compiler" + "github.com/sqlc-dev/sqlc/internal/config" +) + +func init() { + pushCmd.Flags().StringSliceP("tag", "t", nil, "tag this push with a value") +} + +var pushCmd = &cobra.Command{ + Use: "push", + Aliases: []string{"upload"}, + Short: "Push the schema, queries, and configuration for this project", + RunE: func(cmd *cobra.Command, args []string) error { + stderr := cmd.ErrOrStderr() + dir, name := getConfigPath(stderr, cmd.Flag("file")) + tags, err := cmd.Flags().GetStringSlice("tag") + if err != nil { + return err + } + opts := &Options{ + Env: ParseEnv(cmd), + Stderr: stderr, + Tags: tags, + } + if err := Push(cmd.Context(), dir, name, opts); err != nil { + fmt.Fprintf(stderr, "error pushing: %s\n", err) + os.Exit(1) + } + return nil + }, +} + +type pusher struct { + m sync.Mutex + results []*bundler.QuerySetArchive +} + +func (g *pusher) Pairs(ctx context.Context, conf *config.Config) []OutputPair { + var pairs []OutputPair + for _, sql := range conf.SQL { + pairs = append(pairs, OutputPair{ + SQL: sql, + }) + } + return pairs +} + +func (g *pusher) ProcessResult(ctx context.Context, combo config.CombinedSettings, sql OutputPair, result *compiler.Result) error { + req := codeGenRequest(result, combo) + g.m.Lock() + g.results = append(g.results, &bundler.QuerySetArchive{ + Name: sql.Name, + Schema: sql.Schema, + Queries: sql.Queries, + Request: req, + }) + g.m.Unlock() + return nil +} + +func Push(ctx context.Context, dir, filename string, opts *Options) error { + e := opts.Env + stderr := opts.Stderr + configPath, conf, err := readConfig(stderr, dir, filename) + if err != nil { + return err + } + up := bundler.NewUploader(configPath, dir, conf) + if err := up.Validate(); err != nil { + return err + } + p := &pusher{} + if err := Process(ctx, p, dir, filename, opts); err != nil { + return err + } + if e.DryRun { + return up.DumpRequestOut(ctx, p.results) + } else { + return up.Upload(ctx, p.results, opts.Tags) + } +} diff --git a/internal/cmd/shim.go b/internal/cmd/shim.go index 040a5aea2f..654500429a 100644 --- a/internal/cmd/shim.go +++ b/internal/cmd/shim.go @@ -1,8 +1,6 @@ package cmd import ( - "strings" - "github.com/sqlc-dev/sqlc/internal/compiler" "github.com/sqlc-dev/sqlc/internal/config" "github.com/sqlc-dev/sqlc/internal/config/convert" @@ -11,128 +9,54 @@ import ( "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) -func pluginOverride(r *compiler.Result, o config.Override) *plugin.Override { - var column string - var table plugin.Identifier - - if o.Column != "" { - colParts := strings.Split(o.Column, ".") - switch len(colParts) { - case 2: - table.Schema = r.Catalog.DefaultSchema - table.Name = colParts[0] - column = colParts[1] - case 3: - table.Schema = colParts[0] - table.Name = colParts[1] - column = colParts[2] - case 4: - table.Catalog = colParts[0] - table.Schema = colParts[1] - table.Name = colParts[2] - column = colParts[3] - } - } - return &plugin.Override{ - CodeType: "", // FIXME - DbType: o.DBType, - Nullable: o.Nullable, - Unsigned: o.Unsigned, - Column: o.Column, - ColumnName: column, - Table: &table, - GoType: pluginGoType(o), - } -} - func pluginSettings(r *compiler.Result, cs config.CombinedSettings) *plugin.Settings { - var over []*plugin.Override - for _, o := range cs.Overrides { - over = append(over, pluginOverride(r, o)) - } return &plugin.Settings{ - Version: cs.Global.Version, - Engine: string(cs.Package.Engine), - Schema: []string(cs.Package.Schema), - Queries: []string(cs.Package.Queries), - Overrides: over, - Rename: cs.Rename, - Codegen: pluginCodegen(cs.Codegen), - Go: pluginGoCode(cs.Go), - Json: pluginJSONCode(cs.JSON), + Version: cs.Global.Version, + Engine: string(cs.Package.Engine), + Schema: []string(cs.Package.Schema), + Queries: []string(cs.Package.Queries), + Codegen: pluginCodegen(cs, cs.Codegen), } } -func pluginCodegen(s config.Codegen) *plugin.Codegen { +func pluginCodegen(cs config.CombinedSettings, s config.Codegen) *plugin.Codegen { opts, err := convert.YAMLtoJSON(s.Options) if err != nil { panic(err) } - return &plugin.Codegen{ + cg := &plugin.Codegen{ Out: s.Out, Plugin: s.Plugin, Options: opts, } -} - -func pluginGoCode(s config.SQLGo) *plugin.GoCode { - if s.QueryParameterLimit == nil { - s.QueryParameterLimit = new(int32) - *s.QueryParameterLimit = 1 - } - - return &plugin.GoCode{ - EmitInterface: s.EmitInterface, - EmitJsonTags: s.EmitJSONTags, - JsonTagsIdUppercase: s.JsonTagsIDUppercase, - EmitDbTags: s.EmitDBTags, - EmitPreparedQueries: s.EmitPreparedQueries, - EmitExactTableNames: s.EmitExactTableNames, - EmitEmptySlices: s.EmitEmptySlices, - EmitExportedQueries: s.EmitExportedQueries, - EmitResultStructPointers: s.EmitResultStructPointers, - EmitParamsStructPointers: s.EmitParamsStructPointers, - EmitMethodsWithDbArgument: s.EmitMethodsWithDBArgument, - EmitPointersForNullTypes: s.EmitPointersForNullTypes, - EmitEnumValidMethod: s.EmitEnumValidMethod, - EmitAllEnumValues: s.EmitAllEnumValues, - JsonTagsCaseStyle: s.JSONTagsCaseStyle, - Package: s.Package, - Out: s.Out, - SqlPackage: s.SQLPackage, - SqlDriver: s.SQLDriver, - OutputDbFileName: s.OutputDBFileName, - OutputBatchFileName: s.OutputBatchFileName, - OutputModelsFileName: s.OutputModelsFileName, - OutputQuerierFileName: s.OutputQuerierFileName, - OutputCopyfromFileName: s.OutputCopyFromFileName, - OutputFilesSuffix: s.OutputFilesSuffix, - InflectionExcludeTableNames: s.InflectionExcludeTableNames, - QueryParameterLimit: s.QueryParameterLimit, - OmitUnusedStructs: s.OmitUnusedStructs, + for _, p := range cs.Global.Plugins { + if p.Name == s.Plugin { + cg.Env = p.Env + cg.Process = pluginProcess(p) + cg.Wasm = pluginWASM(p) + return cg + } } + return cg } -func pluginGoType(o config.Override) *plugin.ParsedGoType { - // Note that there is a slight mismatch between this and the - // proto api. The GoType on the override is the unparsed type, - // which could be a qualified path or an object, as per - // https://docs.sqlc.dev/en/v1.18.0/reference/config.html#type-overriding - return &plugin.ParsedGoType{ - ImportPath: o.GoImportPath, - Package: o.GoPackage, - TypeName: o.GoTypeName, - BasicType: o.GoBasicType, - StructTags: o.GoStructTags, +func pluginProcess(p config.Plugin) *plugin.Codegen_Process { + if p.Process != nil { + return &plugin.Codegen_Process{ + Cmd: p.Process.Cmd, + } } + return nil } -func pluginJSONCode(s config.SQLJSON) *plugin.JSONCode { - return &plugin.JSONCode{ - Out: s.Out, - Indent: s.Indent, - Filename: s.Filename, +func pluginWASM(p config.Plugin) *plugin.Codegen_WASM { + if p.WASM != nil { + return &plugin.Codegen_WASM{ + Url: p.WASM.URL, + Sha256: p.WASM.SHA256, + } } + return nil } func pluginCatalog(c *catalog.Catalog) *plugin.Catalog { @@ -229,13 +153,13 @@ func pluginQueries(r *compiler.Result) []*plugin.Query { } } out = append(out, &plugin.Query{ - Name: q.Name, - Cmd: q.Cmd, + Name: q.Metadata.Name, + Cmd: q.Metadata.Cmd, Text: q.SQL, - Comments: q.Comments, + Comments: q.Metadata.Comments, Columns: columns, Params: params, - Filename: q.Filename, + Filename: q.Metadata.Filename, InsertIntoTable: iit, }) } @@ -299,8 +223,8 @@ func pluginQueryParam(p compiler.Parameter) *plugin.Parameter { } } -func codeGenRequest(r *compiler.Result, settings config.CombinedSettings) *plugin.CodeGenRequest { - return &plugin.CodeGenRequest{ +func codeGenRequest(r *compiler.Result, settings config.CombinedSettings) *plugin.GenerateRequest { + return &plugin.GenerateRequest{ Settings: pluginSettings(r, settings), Catalog: pluginCatalog(r.Catalog), Queries: pluginQueries(r), diff --git a/internal/cmd/verify.go b/internal/cmd/verify.go new file mode 100644 index 0000000000..a52c218bff --- /dev/null +++ b/internal/cmd/verify.go @@ -0,0 +1,156 @@ +package cmd + +import ( + "context" + "database/sql" + "errors" + "fmt" + "log/slog" + "os" + + _ "github.com/jackc/pgx/v5/stdlib" + "github.com/spf13/cobra" + "google.golang.org/protobuf/proto" + + "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/dbmanager" + "github.com/sqlc-dev/sqlc/internal/migrations" + "github.com/sqlc-dev/sqlc/internal/plugin" + "github.com/sqlc-dev/sqlc/internal/quickdb" + pb "github.com/sqlc-dev/sqlc/internal/quickdb/v1" + "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" +) + +func init() { + verifyCmd.Flags().String("against", "", "compare against this tag") +} + +var verifyCmd = &cobra.Command{ + Use: "verify", + Short: "Verify schema, queries, and configuration for this project", + RunE: func(cmd *cobra.Command, args []string) error { + stderr := cmd.ErrOrStderr() + dir, name := getConfigPath(stderr, cmd.Flag("file")) + against, err := cmd.Flags().GetString("against") + if err != nil { + return err + } + opts := &Options{ + Env: ParseEnv(cmd), + Stderr: stderr, + Against: against, + } + if err := Verify(cmd.Context(), dir, name, opts); err != nil { + fmt.Fprintf(stderr, "Error verifying queries: %s\n", err) + os.Exit(1) + } + return nil + }, +} + +func Verify(ctx context.Context, dir, filename string, opts *Options) error { + stderr := opts.Stderr + _, conf, err := readConfig(stderr, dir, filename) + if err != nil { + return err + } + + client, err := quickdb.NewClientFromConfig(conf.Cloud) + if err != nil { + return fmt.Errorf("client init failed: %w", err) + } + + manager := dbmanager.NewClient(conf.Servers) + + // Get query sets from a previous archive by tag. If no tag is provided, get + // the latest query sets. + previous, err := client.GetQuerySets(ctx, &pb.GetQuerySetsRequest{ + Tag: opts.Against, + }) + if err != nil { + return err + } + + // Create a mapping of name to query set + existing := map[string]config.SQL{} + for _, qs := range conf.SQL { + existing[qs.Name] = qs + } + + var verr error + for _, qs := range previous.QuerySets { + // TODO: Create a function for this so that we can return early on errors + + check := func() error { + if qs.Name == "" { + return fmt.Errorf("unnamed query set") + } + + current, found := existing[qs.Name] + if !found { + return fmt.Errorf("unknown query set: %s", qs.Name) + } + + // Read the schema files into memory, removing rollback statements + var ddl []string + files, err := sqlpath.Glob(current.Schema) + if err != nil { + return err + } + for _, schema := range files { + contents, err := os.ReadFile(schema) + if err != nil { + return fmt.Errorf("read file: %w", err) + } + ddl = append(ddl, migrations.RemoveRollbackStatements(string(contents))) + } + + var codegen plugin.GenerateRequest + if err := proto.Unmarshal(qs.CodegenRequest.Contents, &codegen); err != nil { + return err + } + + // Create (or re-use) a database to verify against + resp, err := manager.CreateDatabase(ctx, &dbmanager.CreateDatabaseRequest{ + Engine: string(current.Engine), + Migrations: ddl, + }) + if err != nil { + return err + } + + db, err := sql.Open("pgx", resp.Uri) + if err != nil { + return err + } + defer db.Close() + + var qerr error + for _, query := range codegen.Queries { + stmt, err := db.PrepareContext(ctx, query.Text) + if err != nil { + fmt.Fprintf(stderr, "Failed to prepare the following query:\n") + fmt.Fprintf(stderr, "%s\n", query.Text) + fmt.Fprintf(stderr, "Error was: %s\n", err) + qerr = err + continue + } + if err := stmt.Close(); err != nil { + slog.Error("stmt.Close failed", "err", err) + } + } + + return qerr + } + + if err := check(); err != nil { + verr = errors.New("errored") + fmt.Fprintf(stderr, "FAIL\t%s\n", qs.Name) + fmt.Fprintf(stderr, " ERROR\t%s\n", err) + } else { + fmt.Fprintf(stderr, "ok\t%s\n", qs.Name) + } + } + + return verr +} diff --git a/internal/cmd/vet.go b/internal/cmd/vet.go index 48fbc2a411..8a7f8077db 100644 --- a/internal/cmd/vet.go +++ b/internal/cmd/vet.go @@ -6,11 +6,13 @@ import ( "encoding/json" "errors" "fmt" + "github.com/sqlc-dev/sqlc/internal/constants" "io" "log" "os" "path/filepath" "runtime/trace" + "slices" "strings" "time" @@ -18,16 +20,16 @@ import ( "github.com/google/cel-go/cel" "github.com/google/cel-go/ext" "github.com/jackc/pgx/v5" - _ "github.com/mattn/go-sqlite3" "github.com/spf13/cobra" "google.golang.org/protobuf/encoding/protojson" "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/dbmanager" "github.com/sqlc-dev/sqlc/internal/debug" + "github.com/sqlc-dev/sqlc/internal/migrations" "github.com/sqlc-dev/sqlc/internal/opts" "github.com/sqlc-dev/sqlc/internal/plugin" "github.com/sqlc-dev/sqlc/internal/quickdb" - pb "github.com/sqlc-dev/sqlc/internal/quickdb/v1" "github.com/sqlc-dev/sqlc/internal/shfmt" "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" "github.com/sqlc-dev/sqlc/internal/vet" @@ -37,9 +39,6 @@ var ErrFailedChecks = errors.New("failed checks") var pjson = protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} -const RuleDbPrepare = "sqlc/db-prepare" -const QueryFlagSqlcVetDisable = "@sqlc-vet-disable" - func NewCmdVet() *cobra.Command { return &cobra.Command{ Use: "vet", @@ -47,8 +46,12 @@ func NewCmdVet() *cobra.Command { RunE: func(cmd *cobra.Command, args []string) error { defer trace.StartRegion(cmd.Context(), "vet").End() stderr := cmd.ErrOrStderr() + opts := &Options{ + Env: ParseEnv(cmd), + Stderr: stderr, + } dir, name := getConfigPath(stderr, cmd.Flag("file")) - if err := Vet(cmd.Context(), ParseEnv(cmd), dir, name, stderr); err != nil { + if err := Vet(cmd.Context(), dir, name, opts); err != nil { if !errors.Is(err, ErrFailedChecks) { fmt.Fprintf(stderr, "%s\n", err) } @@ -59,7 +62,9 @@ func NewCmdVet() *cobra.Command { } } -func Vet(ctx context.Context, e Env, dir, filename string, stderr io.Writer) error { +func Vet(ctx context.Context, dir, filename string, opts *Options) error { + e := opts.Env + stderr := opts.Stderr configPath, conf, err := readConfig(stderr, dir, filename) if err != nil { return err @@ -103,7 +108,7 @@ func Vet(ctx context.Context, e Env, dir, filename string, stderr io.Writer) err } rules := map[string]rule{ - RuleDbPrepare: {NeedsPrepare: true}, + constants.QueryRuleDbPrepare: {NeedsPrepare: true}, } for _, c := range conf.Rules { @@ -137,13 +142,13 @@ func Vet(ctx context.Context, e Env, dir, filename string, stderr io.Writer) err } c := checker{ - Rules: rules, - Conf: conf, - Dir: dir, - Env: env, - Envmap: map[string]string{}, - Stderr: stderr, - NoDatabase: e.NoDatabase, + Rules: rules, + Conf: conf, + Dir: dir, + Env: env, + Stderr: stderr, + OnlyManagedDB: e.Debug.OnlyManagedDatabases, + Replacer: shfmt.NewReplacer(nil), } errored := false for _, sql := range conf.SQL { @@ -327,7 +332,9 @@ type dbPreparer struct { func (p *dbPreparer) Prepare(ctx context.Context, name, query string) error { s, err := p.db.PrepareContext(ctx, query) - s.Close() + if s != nil { + s.Close() + } return err } @@ -372,14 +379,14 @@ type rule struct { } type checker struct { - Rules map[string]rule - Conf *config.Config - Dir string - Env *cel.Env - Envmap map[string]string - Stderr io.Writer - NoDatabase bool - Client pb.QuickClient + Rules map[string]rule + Conf *config.Config + Dir string + Env *cel.Env + Stderr io.Writer + OnlyManagedDB bool + Client dbmanager.Client + Replacer *shfmt.Replacer } func (c *checker) fetchDatabaseUri(ctx context.Context, s config.SQL) (string, func() error, error) { @@ -394,60 +401,51 @@ func (c *checker) fetchDatabaseUri(ctx context.Context, s config.SQL) (string, f uri, err := c.DSN(s.Database.URI) return uri, cleanup, err } - if s.Engine != config.EnginePostgreSQL { - return "", cleanup, fmt.Errorf("managed: only PostgreSQL currently") - } if c.Client == nil { // FIXME: Eventual race condition - client, err := quickdb.NewClientFromConfig(c.Conf.Cloud) - if err != nil { - return "", cleanup, fmt.Errorf("managed: client: %w", err) - } + client := dbmanager.NewClient(c.Conf.Servers) c.Client = client } - var migrations []string + var ddl []string files, err := sqlpath.Glob(s.Schema) if err != nil { return "", cleanup, err } - for _, query := range files { - contents, err := os.ReadFile(query) + for _, schema := range files { + contents, err := os.ReadFile(schema) if err != nil { return "", cleanup, fmt.Errorf("read file: %w", err) } - migrations = append(migrations, string(contents)) + ddl = append(ddl, migrations.RemoveRollbackStatements(string(contents))) } - resp, err := c.Client.CreateEphemeralDatabase(ctx, &pb.CreateEphemeralDatabaseRequest{ - Engine: "postgresql", - Region: quickdb.GetClosestRegion(), - Migrations: migrations, + resp, err := c.Client.CreateDatabase(ctx, &dbmanager.CreateDatabaseRequest{ + Engine: string(s.Engine), + Migrations: ddl, }) if err != nil { return "", cleanup, fmt.Errorf("managed: create database: %w", err) } - cleanup = func() error { - _, err := c.Client.DropEphemeralDatabase(ctx, &pb.DropEphemeralDatabaseRequest{ - DatabaseId: resp.DatabaseId, - }) - return err + var uri string + switch s.Engine { + case config.EngineMySQL: + dburi, err := quickdb.MySQLReformatURI(resp.Uri) + if err != nil { + return "", cleanup, fmt.Errorf("reformat uri: %w", err) + } + uri = dburi + default: + uri = resp.Uri } - return resp.Uri, cleanup, nil + return uri, cleanup, nil } func (c *checker) DSN(dsn string) (string, error) { - // Populate the environment variable map if it is empty - if len(c.Envmap) == 0 { - for _, e := range os.Environ() { - k, v, _ := strings.Cut(e, "=") - c.Envmap[k] = v - } - } - return shfmt.Replace(dsn, c.Envmap), nil + return c.Replacer.Replace(dsn), nil } func (c *checker) checkSQL(ctx context.Context, s config.SQL) error { @@ -480,8 +478,8 @@ func (c *checker) checkSQL(ctx context.Context, s config.SQL) error { var prep preparer var expl explainer if s.Database != nil { // TODO only set up a database connection if a rule evaluation requires it - if c.NoDatabase { - return fmt.Errorf("database: connections disabled via command line flag") + if s.Database.URI != "" && c.OnlyManagedDB { + return fmt.Errorf("database: connections disabled via SQLCDEBUG=databases=managed") } dburl, cleanup, err := c.fetchDatabaseUri(ctx, s) if err != nil { @@ -518,7 +516,7 @@ func (c *checker) checkSQL(ctx context.Context, s config.SQL) error { prep = &dbPreparer{db} expl = &mysqlExplainer{db} case config.EngineSQLite: - db, err := sql.Open("sqlite3", dburl) + db, err := sql.Open("sqlite", dburl) if err != nil { return fmt.Errorf("database: connection error: %s", err) } @@ -539,11 +537,23 @@ func (c *checker) checkSQL(ctx context.Context, s config.SQL) error { req := codeGenRequest(result, combo) cfg := vetConfig(req) for i, query := range req.Queries { - if result.Queries[i].Flags[QueryFlagSqlcVetDisable] { - if debug.Active { - log.Printf("Skipping vet rules for query: %s\n", query.Name) + md := result.Queries[i].Metadata + if md.Flags[constants.QueryFlagSqlcVetDisable] { + // If the vet disable flag is specified without any rules listed, all rules are ignored. + if len(md.RuleSkiplist) == 0 { + if debug.Active { + log.Printf("Skipping all vet rules for query: %s\n", query.Name) + } + continue + } + + // Rules which are listed to be disabled but not declared in the config file are rejected. + for r := range md.RuleSkiplist { + if !slices.Contains(s.Rules, r) { + fmt.Fprintf(c.Stderr, "%s: %s: rule-check error: rule %q does not exist in the config file\n", query.Filename, query.Name, r) + errored = true + } } - continue } evalMap := map[string]any{ @@ -552,81 +562,88 @@ func (c *checker) checkSQL(ctx context.Context, s config.SQL) error { } for _, name := range s.Rules { - rule, ok := c.Rules[name] - if !ok { - return fmt.Errorf("type-check error: a rule with the name '%s' does not exist", name) - } - - if rule.NeedsPrepare { - if prep == nil { - fmt.Fprintf(c.Stderr, "%s: %s: %s: error preparing query: database connection required\n", query.Filename, query.Name, name) - errored = true - continue + if _, skip := md.RuleSkiplist[name]; skip { + if debug.Active { + log.Printf("Skipping vet rule %q for query: %s\n", name, query.Name) } - prepName := fmt.Sprintf("sqlc_vet_%d_%d", time.Now().Unix(), i) - if err := prep.Prepare(ctx, prepName, query.Text); err != nil { - fmt.Fprintf(c.Stderr, "%s: %s: %s: error preparing query: %s\n", query.Filename, query.Name, name, err) - errored = true - continue + } else { + rule, ok := c.Rules[name] + if !ok { + return fmt.Errorf("type-check error: a rule with the name '%s' does not exist", name) } - } - - // short-circuit for "sqlc/db-prepare" rule which doesn't have a CEL program - if rule.Program == nil { - continue - } - // Get explain output for this query if we need it - _, pgsqlOK := evalMap["postgresql"] - _, mysqlOK := evalMap["mysql"] - if rule.NeedsExplain && !(pgsqlOK || mysqlOK) { - if expl == nil { - fmt.Fprintf(c.Stderr, "%s: %s: %s: error explaining query: database connection required\n", query.Filename, query.Name, name) - errored = true - continue + if rule.NeedsPrepare { + if prep == nil { + fmt.Fprintf(c.Stderr, "%s: %s: %s: error preparing query: database connection required\n", query.Filename, query.Name, name) + errored = true + continue + } + prepName := fmt.Sprintf("sqlc_vet_%d_%d", time.Now().Unix(), i) + if err := prep.Prepare(ctx, prepName, query.Text); err != nil { + fmt.Fprintf(c.Stderr, "%s: %s: %s: error preparing query: %s\n", query.Filename, query.Name, name, err) + errored = true + continue + } } - engineOutput, err := expl.Explain(ctx, query.Text, query.Params...) - if err != nil { - fmt.Fprintf(c.Stderr, "%s: %s: %s: error explaining query: %s\n", query.Filename, query.Name, name, err) - errored = true + + // short-circuit for "sqlc/db-prepare" rule which doesn't have a CEL program + if rule.Program == nil { continue } - evalMap["postgresql"] = engineOutput.PostgreSQL - evalMap["mysql"] = engineOutput.MySQL - } + // Get explain output for this query if we need it + _, pgsqlOK := evalMap["postgresql"] + _, mysqlOK := evalMap["mysql"] + if rule.NeedsExplain && !(pgsqlOK || mysqlOK) { + if expl == nil { + fmt.Fprintf(c.Stderr, "%s: %s: %s: error explaining query: database connection required\n", query.Filename, query.Name, name) + errored = true + continue + } + engineOutput, err := expl.Explain(ctx, query.Text, query.Params...) + if err != nil { + fmt.Fprintf(c.Stderr, "%s: %s: %s: error explaining query: %s\n", query.Filename, query.Name, name, err) + errored = true + continue + } + + evalMap["postgresql"] = engineOutput.PostgreSQL + evalMap["mysql"] = engineOutput.MySQL + } - if debug.Debug.DumpVetEnv { - fmt.Printf("vars for rule '%s' evaluating against query '%s':\n", name, query.Name) - debug.DumpAsJSON(evalMap) - } + if debug.Debug.DumpVetEnv { + fmt.Printf("vars for rule '%s' evaluating against query '%s':\n", name, query.Name) + debug.DumpAsJSON(evalMap) + } - out, _, err := (*rule.Program).Eval(evalMap) - if err != nil { - return err - } - tripped, ok := out.Value().(bool) - if !ok { - return fmt.Errorf("expression returned non-bool value: %v", out.Value()) - } - if tripped { - // TODO: Get line numbers in the output - if rule.Message == "" { - fmt.Fprintf(c.Stderr, "%s: %s: %s\n", query.Filename, query.Name, name) - } else { - fmt.Fprintf(c.Stderr, "%s: %s: %s: %s\n", query.Filename, query.Name, name, rule.Message) + out, _, err := (*rule.Program).Eval(evalMap) + if err != nil { + return err + } + tripped, ok := out.Value().(bool) + if !ok { + return fmt.Errorf("expression returned non-bool value: %v", out.Value()) + } + if tripped { + // TODO: Get line numbers in the output + if rule.Message == "" { + fmt.Fprintf(c.Stderr, "%s: %s: %s\n", query.Filename, query.Name, name) + } else { + fmt.Fprintf(c.Stderr, "%s: %s: %s: %s\n", query.Filename, query.Name, name, rule.Message) + } + errored = true } - errored = true } } } + if errored { return ErrFailedChecks } return nil } -func vetConfig(req *plugin.CodeGenRequest) *vet.Config { +func vetConfig(req *plugin.GenerateRequest) *vet.Config { return &vet.Config{ Version: req.Settings.Version, Engine: req.Settings.Engine, diff --git a/internal/cmd/vet_modernc.go b/internal/cmd/vet_modernc.go new file mode 100644 index 0000000000..74313007af --- /dev/null +++ b/internal/cmd/vet_modernc.go @@ -0,0 +1,7 @@ +//go:build !wasm + +package cmd + +import ( + _ "modernc.org/sqlite" +) diff --git a/internal/codegen/golang/driver.go b/internal/codegen/golang/driver.go index 7ef723b55e..5e3a533dcc 100644 --- a/internal/codegen/golang/driver.go +++ b/internal/codegen/golang/driver.go @@ -1,46 +1,14 @@ package golang -type SQLDriver string +import "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" -const ( - SQLPackagePGXV4 string = "pgx/v4" - SQLPackagePGXV5 string = "pgx/v5" - SQLPackageStandard string = "database/sql" -) - -const ( - SQLDriverPGXV4 SQLDriver = "github.com/jackc/pgx/v4" - SQLDriverPGXV5 = "github.com/jackc/pgx/v5" - SQLDriverLibPQ = "github.com/lib/pq" - SQLDriverGoSQLDriverMySQL = "github.com/go-sql-driver/mysql" -) - -func parseDriver(sqlPackage string) SQLDriver { +func parseDriver(sqlPackage string) opts.SQLDriver { switch sqlPackage { - case SQLPackagePGXV4: - return SQLDriverPGXV4 - case SQLPackagePGXV5: - return SQLDriverPGXV5 - default: - return SQLDriverLibPQ - } -} - -func (d SQLDriver) IsPGX() bool { - return d == SQLDriverPGXV4 || d == SQLDriverPGXV5 -} - -func (d SQLDriver) IsGoSQLDriverMySQL() bool { - return d == SQLDriverGoSQLDriverMySQL -} - -func (d SQLDriver) Package() string { - switch d { - case SQLDriverPGXV4: - return SQLPackagePGXV4 - case SQLDriverPGXV5: - return SQLPackagePGXV5 + case opts.SQLPackagePGXV4: + return opts.SQLDriverPGXV4 + case opts.SQLPackagePGXV5: + return opts.SQLDriverPGXV5 default: - return SQLPackageStandard + return opts.SQLDriverLibPQ } } diff --git a/internal/codegen/golang/enum.go b/internal/codegen/golang/enum.go index 75291d3ace..f429551f4b 100644 --- a/internal/codegen/golang/enum.go +++ b/internal/codegen/golang/enum.go @@ -1,12 +1,10 @@ package golang import ( - "regexp" "strings" + "unicode" ) -var IdentPattern = regexp.MustCompile("[^a-zA-Z0-9_]+") - type Constant struct { Name string Type string @@ -29,21 +27,38 @@ func (e Enum) ValidTag() string { return TagsToString(e.ValidTags) } +func enumReplacer(r rune) rune { + if strings.ContainsRune("-/:_", r) { + return '_' + } else if (r >= 'a' && r <= 'z') || + (r >= 'A' && r <= 'Z') || + (r >= '0' && r <= '9') { + return r + } else { + return -1 + } +} + +// EnumReplace removes all non ident symbols (all but letters, numbers and +// underscore) and returns valid ident name for provided name. func EnumReplace(value string) string { - id := strings.Replace(value, "-", "_", -1) - id = strings.Replace(id, ":", "_", -1) - id = strings.Replace(id, "/", "_", -1) - return IdentPattern.ReplaceAllString(id, "") + return strings.Map(enumReplacer, value) } +// EnumValueName removes all non ident symbols (all but letters, numbers and +// underscore) and converts snake case ident to camel case. func EnumValueName(value string) string { - name := "" - id := strings.Replace(value, "-", "_", -1) - id = strings.Replace(id, ":", "_", -1) - id = strings.Replace(id, "/", "_", -1) - id = IdentPattern.ReplaceAllString(id, "") - for _, part := range strings.Split(id, "_") { - name += strings.Title(part) + parts := strings.Split(EnumReplace(value), "_") + for i, part := range parts { + parts[i] = titleFirst(part) } - return name + + return strings.Join(parts, "") +} + +func titleFirst(s string) string { + r := []rune(s) + r[0] = unicode.ToUpper(r[0]) + + return string(r) } diff --git a/internal/codegen/golang/field.go b/internal/codegen/golang/field.go index ae7ba63573..2a63b6d342 100644 --- a/internal/codegen/golang/field.go +++ b/internal/codegen/golang/field.go @@ -6,6 +6,7 @@ import ( "sort" "strings" + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" "github.com/sqlc-dev/sqlc/internal/plugin" ) @@ -40,9 +41,9 @@ func TagsToString(tags map[string]string) string { return strings.Join(tagParts, " ") } -func JSONTagName(name string, settings *plugin.Settings) string { - style := settings.Go.JsonTagsCaseStyle - idUppercase := settings.Go.JsonTagsIdUppercase +func JSONTagName(name string, options *opts.Options) string { + style := options.JsonTagsCaseStyle + idUppercase := options.JsonTagsIdUppercase if style == "" || style == "none" { return name } else { diff --git a/internal/codegen/golang/gen.go b/internal/codegen/golang/gen.go index b0bb3308b3..7df56a0a41 100644 --- a/internal/codegen/golang/gen.go +++ b/internal/codegen/golang/gen.go @@ -10,6 +10,7 @@ import ( "strings" "text/template" + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" "github.com/sqlc-dev/sqlc/internal/codegen/sdk" "github.com/sqlc-dev/sqlc/internal/metadata" "github.com/sqlc-dev/sqlc/internal/plugin" @@ -18,7 +19,7 @@ import ( type tmplCtx struct { Q string Package string - SQLDriver SQLDriver + SQLDriver opts.SQLDriver Enums []Enum Structs []Struct GoQueries []Query @@ -38,6 +39,9 @@ type tmplCtx struct { EmitAllEnumValues bool UsesCopyFrom bool UsesBatch bool + OmitSqlcVersion bool + BuildTags string + WrapErrors bool } func (t *tmplCtx) OutputQuery(sourceName string) bool { @@ -95,65 +99,110 @@ func (t *tmplCtx) codegenQueryRetval(q Query) (string, error) { case ":execrows", ":execlastid": return "result, err :=", nil case ":execresult": + if t.WrapErrors { + return "result, err :=", nil + } return "return", nil default: return "", fmt.Errorf("unhandled q.Cmd case %q", q.Cmd) } } -func Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) { - enums := buildEnums(req) - structs := buildStructs(req) - queries, err := buildQueries(req, structs) +func Generate(ctx context.Context, req *plugin.GenerateRequest) (*plugin.GenerateResponse, error) { + options, err := opts.Parse(req) if err != nil { return nil, err } - if req.Settings.Go.OmitUnusedStructs { + if err := opts.ValidateOpts(options); err != nil { + return nil, err + } + + enums := buildEnums(req, options) + structs := buildStructs(req, options) + queries, err := buildQueries(req, options, structs) + if err != nil { + return nil, err + } + + if options.OmitUnusedStructs { enums, structs = filterUnusedStructs(enums, structs, queries) } - return generate(req, enums, structs, queries) + if err := validate(options, enums, structs, queries); err != nil { + return nil, err + } + + return generate(req, options, enums, structs, queries) } -func generate(req *plugin.CodeGenRequest, enums []Enum, structs []Struct, queries []Query) (*plugin.CodeGenResponse, error) { +func validate(options *opts.Options, enums []Enum, structs []Struct, queries []Query) error { + enumNames := make(map[string]struct{}) + for _, enum := range enums { + enumNames[enum.Name] = struct{}{} + enumNames["Null"+enum.Name] = struct{}{} + } + structNames := make(map[string]struct{}) + for _, struckt := range structs { + if _, ok := enumNames[struckt.Name]; ok { + return fmt.Errorf("struct name conflicts with enum name: %s", struckt.Name) + } + structNames[struckt.Name] = struct{}{} + } + if !options.EmitExportedQueries { + return nil + } + for _, query := range queries { + if _, ok := enumNames[query.ConstantName]; ok { + return fmt.Errorf("query constant name conflicts with enum name: %s", query.ConstantName) + } + if _, ok := structNames[query.ConstantName]; ok { + return fmt.Errorf("query constant name conflicts with struct name: %s", query.ConstantName) + } + } + return nil +} + +func generate(req *plugin.GenerateRequest, options *opts.Options, enums []Enum, structs []Struct, queries []Query) (*plugin.GenerateResponse, error) { i := &importer{ - Settings: req.Settings, - Queries: queries, - Enums: enums, - Structs: structs, + Options: options, + Queries: queries, + Enums: enums, + Structs: structs, } - golang := req.Settings.Go tctx := tmplCtx{ - EmitInterface: golang.EmitInterface, - EmitJSONTags: golang.EmitJsonTags, - JsonTagsIDUppercase: golang.JsonTagsIdUppercase, - EmitDBTags: golang.EmitDbTags, - EmitPreparedQueries: golang.EmitPreparedQueries, - EmitEmptySlices: golang.EmitEmptySlices, - EmitMethodsWithDBArgument: golang.EmitMethodsWithDbArgument, - EmitEnumValidMethod: golang.EmitEnumValidMethod, - EmitAllEnumValues: golang.EmitAllEnumValues, + EmitInterface: options.EmitInterface, + EmitJSONTags: options.EmitJsonTags, + JsonTagsIDUppercase: options.JsonTagsIdUppercase, + EmitDBTags: options.EmitDbTags, + EmitPreparedQueries: options.EmitPreparedQueries, + EmitEmptySlices: options.EmitEmptySlices, + EmitMethodsWithDBArgument: options.EmitMethodsWithDbArgument, + EmitEnumValidMethod: options.EmitEnumValidMethod, + EmitAllEnumValues: options.EmitAllEnumValues, UsesCopyFrom: usesCopyFrom(queries), UsesBatch: usesBatch(queries), - SQLDriver: parseDriver(golang.SqlPackage), + SQLDriver: parseDriver(options.SqlPackage), Q: "`", - Package: golang.Package, + Package: options.Package, Enums: enums, Structs: structs, SqlcVersion: req.SqlcVersion, + BuildTags: options.BuildTags, + OmitSqlcVersion: options.OmitSqlcVersion, + WrapErrors: options.WrapErrors, } - if tctx.UsesCopyFrom && !tctx.SQLDriver.IsPGX() && golang.SqlDriver != SQLDriverGoSQLDriverMySQL { + if tctx.UsesCopyFrom && !tctx.SQLDriver.IsPGX() && options.SqlDriver != opts.SQLDriverGoSQLDriverMySQL { return nil, errors.New(":copyfrom is only supported by pgx and github.com/go-sql-driver/mysql") } - if tctx.UsesCopyFrom && golang.SqlDriver == SQLDriverGoSQLDriverMySQL { + if tctx.UsesCopyFrom && options.SqlDriver == opts.SQLDriverGoSQLDriverMySQL { if err := checkNoTimesForMySQLCopyFrom(queries); err != nil { return nil, err } - tctx.SQLDriver = SQLDriverGoSQLDriverMySQL + tctx.SQLDriver = opts.SQLDriverGoSQLDriverMySQL } if tctx.UsesBatch && !tctx.SQLDriver.IsPGX() { @@ -165,6 +214,7 @@ func generate(req *plugin.CodeGenRequest, enums []Enum, structs []Struct, querie "comment": sdk.DoubleSlashComment, "escape": sdk.EscapeBacktick, "imports": i.Imports, + "hasImports": i.HasImports, "hasPrefix": strings.HasPrefix, // These methods are Go specific, they do not belong in the codegen package @@ -206,8 +256,8 @@ func generate(req *plugin.CodeGenRequest, enums []Enum, structs []Struct, querie return fmt.Errorf("source error: %w", err) } - if templateName == "queryFile" && golang.OutputFilesSuffix != "" { - name += golang.OutputFilesSuffix + if templateName == "queryFile" && options.OutputFilesSuffix != "" { + name += options.OutputFilesSuffix } if !strings.HasSuffix(name, ".go") { @@ -218,25 +268,25 @@ func generate(req *plugin.CodeGenRequest, enums []Enum, structs []Struct, querie } dbFileName := "db.go" - if golang.OutputDbFileName != "" { - dbFileName = golang.OutputDbFileName + if options.OutputDbFileName != "" { + dbFileName = options.OutputDbFileName } modelsFileName := "models.go" - if golang.OutputModelsFileName != "" { - modelsFileName = golang.OutputModelsFileName + if options.OutputModelsFileName != "" { + modelsFileName = options.OutputModelsFileName } querierFileName := "querier.go" - if golang.OutputQuerierFileName != "" { - querierFileName = golang.OutputQuerierFileName + if options.OutputQuerierFileName != "" { + querierFileName = options.OutputQuerierFileName } copyfromFileName := "copyfrom.go" - if golang.OutputCopyfromFileName != "" { - copyfromFileName = golang.OutputCopyfromFileName + if options.OutputCopyfromFileName != "" { + copyfromFileName = options.OutputCopyfromFileName } batchFileName := "batch.go" - if golang.OutputBatchFileName != "" { - batchFileName = golang.OutputBatchFileName + if options.OutputBatchFileName != "" { + batchFileName = options.OutputBatchFileName } if err := execute(dbFileName, "dbFile"); err != nil { @@ -245,7 +295,7 @@ func generate(req *plugin.CodeGenRequest, enums []Enum, structs []Struct, querie if err := execute(modelsFileName, "modelsFile"); err != nil { return nil, err } - if golang.EmitInterface { + if options.EmitInterface { if err := execute(querierFileName, "interfaceFile"); err != nil { return nil, err } @@ -271,7 +321,7 @@ func generate(req *plugin.CodeGenRequest, enums []Enum, structs []Struct, querie return nil, err } } - resp := plugin.CodeGenResponse{} + resp := plugin.GenerateResponse{} for filename, code := range output { resp.Files = append(resp.Files, &plugin.File{ @@ -333,7 +383,10 @@ func filterUnusedStructs(enums []Enum, structs []Struct, queries []Query) ([]Enu keepTypes[query.Ret.Type()] = struct{}{} if query.Ret.IsStruct() { for _, field := range query.Ret.Struct.Fields { - keepTypes[field.Type] = struct{}{} + keepTypes[strings.TrimPrefix(field.Type, "[]")] = struct{}{} + for _, embedField := range field.EmbedFields { + keepTypes[embedField.Type] = struct{}{} + } } } } diff --git a/internal/codegen/golang/go_type.go b/internal/codegen/golang/go_type.go index d6ba1ce69b..c4aac84dd6 100644 --- a/internal/codegen/golang/go_type.go +++ b/internal/codegen/golang/go_type.go @@ -3,16 +3,24 @@ package golang import ( "strings" + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" "github.com/sqlc-dev/sqlc/internal/codegen/sdk" "github.com/sqlc-dev/sqlc/internal/plugin" ) -func addExtraGoStructTags(tags map[string]string, req *plugin.CodeGenRequest, col *plugin.Column) { - for _, oride := range req.Settings.Overrides { +func addExtraGoStructTags(tags map[string]string, req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column) { + for _, override := range options.Overrides { + oride := override.ShimOverride if oride.GoType.StructTags == nil { continue } - if !sdk.Matches(oride, col.Table, req.Catalog.DefaultSchema) { + if override.MatchesColumn(col) { + for k, v := range oride.GoType.StructTags { + tags[k] = v + } + continue + } + if !override.Matches(col.Table, req.Catalog.DefaultSchema) { // Different table. continue } @@ -31,9 +39,11 @@ func addExtraGoStructTags(tags map[string]string, req *plugin.CodeGenRequest, co } } -func goType(req *plugin.CodeGenRequest, col *plugin.Column) string { +func goType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column) string { // Check if the column's type has been overridden - for _, oride := range req.Settings.Overrides { + for _, override := range options.Overrides { + oride := override.ShimOverride + if oride.GoType.TypeName == "" { continue } @@ -41,7 +51,7 @@ func goType(req *plugin.CodeGenRequest, col *plugin.Column) string { if col.OriginalName != "" { cname = col.OriginalName } - sameTable := sdk.Matches(oride, col.Table, req.Catalog.DefaultSchema) + sameTable := override.Matches(col.Table, req.Catalog.DefaultSchema) if oride.Column != "" && sdk.MatchString(oride.ColumnName, cname) && sameTable { if col.IsSqlcSlice { return "[]" + oride.GoType.TypeName @@ -49,7 +59,7 @@ func goType(req *plugin.CodeGenRequest, col *plugin.Column) string { return oride.GoType.TypeName } } - typ := goInnerType(req, col) + typ := goInnerType(req, options, col) if col.IsSqlcSlice { return "[]" + typ } @@ -59,16 +69,14 @@ func goType(req *plugin.CodeGenRequest, col *plugin.Column) string { return typ } -func goInnerType(req *plugin.CodeGenRequest, col *plugin.Column) string { - columnType := sdk.DataType(col.Type) - notNull := col.NotNull || col.IsArray - +func goInnerType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column) string { // package overrides have a higher precedence - for _, oride := range req.Settings.Overrides { + for _, override := range options.Overrides { + oride := override.ShimOverride if oride.GoType.TypeName == "" { continue } - if oride.DbType != "" && oride.DbType == columnType && oride.Nullable != notNull && oride.Unsigned == col.Unsigned { + if override.MatchesColumn(col) { return oride.GoType.TypeName } } @@ -76,11 +84,11 @@ func goInnerType(req *plugin.CodeGenRequest, col *plugin.Column) string { // TODO: Extend the engine interface to handle types switch req.Settings.Engine { case "mysql": - return mysqlType(req, col) + return mysqlType(req, options, col) case "postgresql": - return postgresType(req, col) + return postgresType(req, options, col) case "sqlite": - return sqliteType(req, col) + return sqliteType(req, options, col) default: return "interface{}" } diff --git a/internal/codegen/golang/imports.go b/internal/codegen/golang/imports.go index 31612fca2b..ccca4f603c 100644 --- a/internal/codegen/golang/imports.go +++ b/internal/codegen/golang/imports.go @@ -5,8 +5,8 @@ import ( "sort" "strings" + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" "github.com/sqlc-dev/sqlc/internal/metadata" - "github.com/sqlc-dev/sqlc/internal/plugin" ) type fileImports struct { @@ -58,10 +58,10 @@ func mergeImports(imps ...fileImports) [][]ImportSpec { } type importer struct { - Settings *plugin.Settings - Queries []Query - Enums []Enum - Structs []Struct + Options *opts.Options + Queries []Query + Enums []Enum + Structs []Struct } func (i *importer) usesType(typ string) bool { @@ -75,26 +75,31 @@ func (i *importer) usesType(typ string) bool { return false } +func (i *importer) HasImports(filename string) bool { + imports := i.Imports(filename) + return len(imports[0]) != 0 || len(imports[1]) != 0 +} + func (i *importer) Imports(filename string) [][]ImportSpec { dbFileName := "db.go" - if i.Settings.Go.OutputDbFileName != "" { - dbFileName = i.Settings.Go.OutputDbFileName + if i.Options.OutputDbFileName != "" { + dbFileName = i.Options.OutputDbFileName } modelsFileName := "models.go" - if i.Settings.Go.OutputModelsFileName != "" { - modelsFileName = i.Settings.Go.OutputModelsFileName + if i.Options.OutputModelsFileName != "" { + modelsFileName = i.Options.OutputModelsFileName } querierFileName := "querier.go" - if i.Settings.Go.OutputQuerierFileName != "" { - querierFileName = i.Settings.Go.OutputQuerierFileName + if i.Options.OutputQuerierFileName != "" { + querierFileName = i.Options.OutputQuerierFileName } copyfromFileName := "copyfrom.go" - if i.Settings.Go.OutputCopyfromFileName != "" { - copyfromFileName = i.Settings.Go.OutputCopyfromFileName + if i.Options.OutputCopyfromFileName != "" { + copyfromFileName = i.Options.OutputCopyfromFileName } batchFileName := "batch.go" - if i.Settings.Go.OutputBatchFileName != "" { - batchFileName = i.Settings.Go.OutputBatchFileName + if i.Options.OutputBatchFileName != "" { + batchFileName = i.Options.OutputBatchFileName } switch filename { @@ -119,17 +124,17 @@ func (i *importer) dbImports() fileImports { {Path: "context"}, } - sqlpkg := parseDriver(i.Settings.Go.SqlPackage) + sqlpkg := parseDriver(i.Options.SqlPackage) switch sqlpkg { - case SQLDriverPGXV4: + case opts.SQLDriverPGXV4: pkg = append(pkg, ImportSpec{Path: "github.com/jackc/pgconn"}) pkg = append(pkg, ImportSpec{Path: "github.com/jackc/pgx/v4"}) - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: pkg = append(pkg, ImportSpec{Path: "github.com/jackc/pgx/v5/pgconn"}) pkg = append(pkg, ImportSpec{Path: "github.com/jackc/pgx/v5"}) default: std = append(std, ImportSpec{Path: "database/sql"}) - if i.Settings.Go.EmitPreparedQueries { + if i.Options.EmitPreparedQueries { std = append(std, ImportSpec{Path: "fmt"}) } } @@ -155,7 +160,7 @@ var pqtypeTypes = map[string]struct{}{ "pqtype.NullRawMessage": {}, } -func buildImports(settings *plugin.Settings, queries []Query, uses func(string) bool) (map[string]struct{}, map[ImportSpec]struct{}) { +func buildImports(options *opts.Options, queries []Query, uses func(string) bool) (map[string]struct{}, map[ImportSpec]struct{}) { pkg := make(map[ImportSpec]struct{}) std := make(map[string]struct{}) @@ -163,13 +168,13 @@ func buildImports(settings *plugin.Settings, queries []Query, uses func(string) std["database/sql"] = struct{}{} } - sqlpkg := parseDriver(settings.Go.SqlPackage) + sqlpkg := parseDriver(options.SqlPackage) for _, q := range queries { if q.Cmd == metadata.CmdExecResult { switch sqlpkg { - case SQLDriverPGXV4: + case opts.SQLDriverPGXV4: pkg[ImportSpec{Path: "github.com/jackc/pgconn"}] = struct{}{} - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: pkg[ImportSpec{Path: "github.com/jackc/pgx/v5/pgconn"}] = struct{}{} default: std["database/sql"] = struct{}{} @@ -184,7 +189,7 @@ func buildImports(settings *plugin.Settings, queries []Query, uses func(string) } if uses("pgtype.") { - if sqlpkg == SQLDriverPGXV5 { + if sqlpkg == opts.SQLDriverPGXV5 { pkg[ImportSpec{Path: "github.com/jackc/pgx/v5/pgtype"}] = struct{}{} } else { pkg[ImportSpec{Path: "github.com/jackc/pgtype"}] = struct{}{} @@ -199,7 +204,8 @@ func buildImports(settings *plugin.Settings, queries []Query, uses func(string) } overrideTypes := map[string]string{} - for _, o := range settings.Overrides { + for _, override := range options.Overrides { + o := override.ShimOverride if o.GoType.BasicType || o.GoType.TypeName == "" { continue } @@ -218,9 +224,15 @@ func buildImports(settings *plugin.Settings, queries []Query, uses func(string) if uses("uuid.NullUUID") && !overrideNullUUID { pkg[ImportSpec{Path: "github.com/google/uuid"}] = struct{}{} } + _, overrideVector := overrideTypes["pgvector.Vector"] + if uses("pgvector.Vector") && !overrideVector { + pkg[ImportSpec{Path: "github.com/pgvector/pgvector-go"}] = struct{}{} + } // Custom imports - for _, o := range settings.Overrides { + for _, override := range options.Overrides { + o := override.ShimOverride + if o.GoType.BasicType || o.GoType.TypeName == "" { continue } @@ -235,7 +247,7 @@ func buildImports(settings *plugin.Settings, queries []Query, uses func(string) } func (i *importer) interfaceImports() fileImports { - std, pkg := buildImports(i.Settings, i.Queries, func(name string) bool { + std, pkg := buildImports(i.Options, i.Queries, func(name string) bool { for _, q := range i.Queries { if q.hasRetType() { if usesBatch([]Query{q}) { @@ -260,7 +272,7 @@ func (i *importer) interfaceImports() fileImports { } func (i *importer) modelImports() fileImports { - std, pkg := buildImports(i.Settings, nil, i.usesType) + std, pkg := buildImports(i.Options, nil, i.usesType) if len(i.Enums) > 0 { std["fmt"] = struct{}{} @@ -299,7 +311,7 @@ func (i *importer) queryImports(filename string) fileImports { } } - std, pkg := buildImports(i.Settings, gq, func(name string) bool { + std, pkg := buildImports(i.Options, gq, func(name string) bool { for _, q := range gq { if q.hasRetType() { if q.Ret.EmitStruct() { @@ -382,14 +394,18 @@ func (i *importer) queryImports(filename string) fileImports { std["context"] = struct{}{} } - sqlpkg := parseDriver(i.Settings.Go.SqlPackage) - if sqlcSliceScan() { + sqlpkg := parseDriver(i.Options.SqlPackage) + if sqlcSliceScan() && !sqlpkg.IsPGX() { std["strings"] = struct{}{} } if sliceScan() && !sqlpkg.IsPGX() { pkg[ImportSpec{Path: "github.com/lib/pq"}] = struct{}{} } + if i.Options.WrapErrors { + std["fmt"] = struct{}{} + } + return sortedImports(std, pkg) } @@ -400,7 +416,7 @@ func (i *importer) copyfromImports() fileImports { copyFromQueries = append(copyFromQueries, q) } } - std, pkg := buildImports(i.Settings, copyFromQueries, func(name string) bool { + std, pkg := buildImports(i.Options, copyFromQueries, func(name string) bool { for _, q := range copyFromQueries { if q.hasRetType() { if strings.HasPrefix(q.Ret.Type(), name) { @@ -417,7 +433,7 @@ func (i *importer) copyfromImports() fileImports { }) std["context"] = struct{}{} - if i.Settings.Go.SqlDriver == SQLDriverGoSQLDriverMySQL { + if i.Options.SqlDriver == opts.SQLDriverGoSQLDriverMySQL { std["io"] = struct{}{} std["fmt"] = struct{}{} std["sync/atomic"] = struct{}{} @@ -435,7 +451,7 @@ func (i *importer) batchImports() fileImports { batchQueries = append(batchQueries, q) } } - std, pkg := buildImports(i.Settings, batchQueries, func(name string) bool { + std, pkg := buildImports(i.Options, batchQueries, func(name string) bool { for _, q := range batchQueries { if q.hasRetType() { if q.Ret.EmitStruct() { @@ -467,11 +483,11 @@ func (i *importer) batchImports() fileImports { std["context"] = struct{}{} std["errors"] = struct{}{} - sqlpkg := parseDriver(i.Settings.Go.SqlPackage) + sqlpkg := parseDriver(i.Options.SqlPackage) switch sqlpkg { - case SQLDriverPGXV4: + case opts.SQLDriverPGXV4: pkg[ImportSpec{Path: "github.com/jackc/pgx/v4"}] = struct{}{} - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: pkg[ImportSpec{Path: "github.com/jackc/pgx/v5"}] = struct{}{} } diff --git a/internal/codegen/golang/mysql_type.go b/internal/codegen/golang/mysql_type.go index c89d8ff3c7..b8e8aa43c7 100644 --- a/internal/codegen/golang/mysql_type.go +++ b/internal/codegen/golang/mysql_type.go @@ -3,12 +3,13 @@ package golang import ( "log" + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" "github.com/sqlc-dev/sqlc/internal/codegen/sdk" "github.com/sqlc-dev/sqlc/internal/debug" "github.com/sqlc-dev/sqlc/internal/plugin" ) -func mysqlType(req *plugin.CodeGenRequest, col *plugin.Column) string { +func mysqlType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column) string { columnType := sdk.DataType(col.Type) notNull := col.NotNull || col.IsArray unsigned := col.Unsigned @@ -30,14 +31,31 @@ func mysqlType(req *plugin.CodeGenRequest, col *plugin.Column) string { } else { if notNull { if unsigned { - return "uint32" + return "uint8" } - return "int32" + return "int8" } - return "sql.NullInt32" + // The database/sql package does not have a sql.NullInt8 type, so we + // use the smallest type they have which is NullInt16 + return "sql.NullInt16" } - case "int", "integer", "smallint", "mediumint", "year": + case "year": + if notNull { + return "int16" + } + return "sql.NullInt16" + + case "smallint": + if notNull { + if unsigned { + return "uint16" + } + return "int16" + } + return "sql.NullInt16" + + case "int", "integer", "mediumint": if notNull { if unsigned { return "uint32" @@ -101,14 +119,14 @@ func mysqlType(req *plugin.CodeGenRequest, col *plugin.Column) string { if enum.Name == columnType { if notNull { if schema.Name == req.Catalog.DefaultSchema { - return StructName(enum.Name, req.Settings) + return StructName(enum.Name, options) } - return StructName(schema.Name+"_"+enum.Name, req.Settings) + return StructName(schema.Name+"_"+enum.Name, options) } else { if schema.Name == req.Catalog.DefaultSchema { - return "Null" + StructName(enum.Name, req.Settings) + return "Null" + StructName(enum.Name, options) } - return "Null" + StructName(schema.Name+"_"+enum.Name, req.Settings) + return "Null" + StructName(schema.Name+"_"+enum.Name, options) } } } diff --git a/internal/codegen/golang/opts/enum.go b/internal/codegen/golang/opts/enum.go new file mode 100644 index 0000000000..40457d040a --- /dev/null +++ b/internal/codegen/golang/opts/enum.go @@ -0,0 +1,64 @@ +package opts + +import "fmt" + +type SQLDriver string + +const ( + SQLPackagePGXV4 string = "pgx/v4" + SQLPackagePGXV5 string = "pgx/v5" + SQLPackageStandard string = "database/sql" +) + +var validPackages = map[string]struct{}{ + string(SQLPackagePGXV4): {}, + string(SQLPackagePGXV5): {}, + string(SQLPackageStandard): {}, +} + +func validatePackage(sqlPackage string) error { + if _, found := validPackages[sqlPackage]; !found { + return fmt.Errorf("unknown SQL package: %s", sqlPackage) + } + return nil +} + +const ( + SQLDriverPGXV4 SQLDriver = "github.com/jackc/pgx/v4" + SQLDriverPGXV5 = "github.com/jackc/pgx/v5" + SQLDriverLibPQ = "github.com/lib/pq" + SQLDriverGoSQLDriverMySQL = "github.com/go-sql-driver/mysql" +) + +var validDrivers = map[string]struct{}{ + string(SQLDriverPGXV4): {}, + string(SQLDriverPGXV5): {}, + string(SQLDriverLibPQ): {}, + string(SQLDriverGoSQLDriverMySQL): {}, +} + +func validateDriver(sqlDriver string) error { + if _, found := validDrivers[sqlDriver]; !found { + return fmt.Errorf("unknown SQL driver: %s", sqlDriver) + } + return nil +} + +func (d SQLDriver) IsPGX() bool { + return d == SQLDriverPGXV4 || d == SQLDriverPGXV5 +} + +func (d SQLDriver) IsGoSQLDriverMySQL() bool { + return d == SQLDriverGoSQLDriverMySQL +} + +func (d SQLDriver) Package() string { + switch d { + case SQLDriverPGXV4: + return SQLPackagePGXV4 + case SQLDriverPGXV5: + return SQLPackagePGXV5 + default: + return SQLPackageStandard + } +} diff --git a/internal/config/go_type.go b/internal/codegen/golang/opts/go_type.go similarity index 93% rename from internal/config/go_type.go rename to internal/codegen/golang/opts/go_type.go index 14765e5f32..5dcb3e8af0 100644 --- a/internal/config/go_type.go +++ b/internal/codegen/golang/opts/go_type.go @@ -1,4 +1,4 @@ -package config +package opts import ( "encoding/json" @@ -16,8 +16,8 @@ type GoType struct { Name string `json:"type" yaml:"type"` Pointer bool `json:"pointer" yaml:"pointer"` Slice bool `json:"slice" yaml:"slice"` - Spec string - BuiltIn bool + Spec string `json:"-"` + BuiltIn bool `json:"-"` } type ParsedGoType struct { @@ -28,6 +28,14 @@ type ParsedGoType struct { StructTag string } +func (o *GoType) MarshalJSON() ([]byte, error) { + if o.Spec != "" { + return json.Marshal(o.Spec) + } + type alias GoType + return json.Marshal(alias(*o)) +} + func (o *GoType) UnmarshalJSON(data []byte) error { var spec string if err := json.Unmarshal(data, &spec); err == nil { @@ -77,7 +85,7 @@ func generatePackageID(importPath string) (string, bool) { } // validate GoType -func (gt GoType) Parse() (*ParsedGoType, error) { +func (gt GoType) parse() (*ParsedGoType, error) { var o ParsedGoType if gt.Spec == "" { @@ -171,7 +179,7 @@ type GoStructTag string // empty string {} // `a:"b"` {"a": "b"} // `a:"b" x:"y,z"` {"a": "b", "x": "y,z"} -func (s GoStructTag) Parse() (map[string]string, error) { +func (s GoStructTag) parse() (map[string]string, error) { m := make(map[string]string) tags, err := structtag.Parse(string(s)) if err != nil { diff --git a/internal/codegen/golang/opts/options.go b/internal/codegen/golang/opts/options.go new file mode 100644 index 0000000000..0d5d51c2dd --- /dev/null +++ b/internal/codegen/golang/opts/options.go @@ -0,0 +1,156 @@ +package opts + +import ( + "encoding/json" + "fmt" + "maps" + "path/filepath" + + "github.com/sqlc-dev/sqlc/internal/plugin" +) + +type Options struct { + EmitInterface bool `json:"emit_interface" yaml:"emit_interface"` + EmitJsonTags bool `json:"emit_json_tags" yaml:"emit_json_tags"` + JsonTagsIdUppercase bool `json:"json_tags_id_uppercase" yaml:"json_tags_id_uppercase"` + EmitDbTags bool `json:"emit_db_tags" yaml:"emit_db_tags"` + EmitPreparedQueries bool `json:"emit_prepared_queries" yaml:"emit_prepared_queries"` + EmitExactTableNames bool `json:"emit_exact_table_names,omitempty" yaml:"emit_exact_table_names"` + EmitEmptySlices bool `json:"emit_empty_slices,omitempty" yaml:"emit_empty_slices"` + EmitExportedQueries bool `json:"emit_exported_queries" yaml:"emit_exported_queries"` + EmitResultStructPointers bool `json:"emit_result_struct_pointers" yaml:"emit_result_struct_pointers"` + EmitParamsStructPointers bool `json:"emit_params_struct_pointers" yaml:"emit_params_struct_pointers"` + EmitMethodsWithDbArgument bool `json:"emit_methods_with_db_argument,omitempty" yaml:"emit_methods_with_db_argument"` + EmitPointersForNullTypes bool `json:"emit_pointers_for_null_types" yaml:"emit_pointers_for_null_types"` + EmitEnumValidMethod bool `json:"emit_enum_valid_method,omitempty" yaml:"emit_enum_valid_method"` + EmitAllEnumValues bool `json:"emit_all_enum_values,omitempty" yaml:"emit_all_enum_values"` + EmitSqlAsComment bool `json:"emit_sql_as_comment,omitempty" yaml:"emit_sql_as_comment"` + JsonTagsCaseStyle string `json:"json_tags_case_style,omitempty" yaml:"json_tags_case_style"` + Package string `json:"package" yaml:"package"` + Out string `json:"out" yaml:"out"` + Overrides []Override `json:"overrides,omitempty" yaml:"overrides"` + Rename map[string]string `json:"rename,omitempty" yaml:"rename"` + SqlPackage string `json:"sql_package" yaml:"sql_package"` + SqlDriver string `json:"sql_driver" yaml:"sql_driver"` + OutputBatchFileName string `json:"output_batch_file_name,omitempty" yaml:"output_batch_file_name"` + OutputDbFileName string `json:"output_db_file_name,omitempty" yaml:"output_db_file_name"` + OutputModelsFileName string `json:"output_models_file_name,omitempty" yaml:"output_models_file_name"` + OutputQuerierFileName string `json:"output_querier_file_name,omitempty" yaml:"output_querier_file_name"` + OutputCopyfromFileName string `json:"output_copyfrom_file_name,omitempty" yaml:"output_copyfrom_file_name"` + OutputFilesSuffix string `json:"output_files_suffix,omitempty" yaml:"output_files_suffix"` + InflectionExcludeTableNames []string `json:"inflection_exclude_table_names,omitempty" yaml:"inflection_exclude_table_names"` + WrapErrors bool `json:"wrap_errors,omitempty" yaml:"wrap_errors"` + QueryParameterLimit *int32 `json:"query_parameter_limit,omitempty" yaml:"query_parameter_limit"` + OmitSqlcVersion bool `json:"omit_sqlc_version,omitempty" yaml:"omit_sqlc_version"` + OmitUnusedStructs bool `json:"omit_unused_structs,omitempty" yaml:"omit_unused_structs"` + BuildTags string `json:"build_tags,omitempty" yaml:"build_tags"` + Initialisms *[]string `json:"initialisms,omitempty" yaml:"initialisms"` + + InitialismsMap map[string]struct{} `json:"-" yaml:"-"` +} + +type GlobalOptions struct { + Overrides []Override `json:"overrides,omitempty" yaml:"overrides"` + Rename map[string]string `json:"rename,omitempty" yaml:"rename"` +} + +func Parse(req *plugin.GenerateRequest) (*Options, error) { + options, err := parseOpts(req) + if err != nil { + return nil, err + } + global, err := parseGlobalOpts(req) + if err != nil { + return nil, err + } + if len(global.Overrides) > 0 { + options.Overrides = append(global.Overrides, options.Overrides...) + } + if len(global.Rename) > 0 { + if options.Rename == nil { + options.Rename = map[string]string{} + } + maps.Copy(options.Rename, global.Rename) + } + return options, nil +} + +func parseOpts(req *plugin.GenerateRequest) (*Options, error) { + var options Options + if len(req.PluginOptions) == 0 { + return &options, nil + } + if err := json.Unmarshal(req.PluginOptions, &options); err != nil { + return nil, fmt.Errorf("unmarshalling plugin options: %w", err) + } + + if options.Package == "" { + if options.Out != "" { + options.Package = filepath.Base(options.Out) + } else { + return nil, fmt.Errorf("invalid options: missing package name") + } + } + + for i := range options.Overrides { + if err := options.Overrides[i].parse(req); err != nil { + return nil, err + } + } + + if options.SqlPackage != "" { + if err := validatePackage(options.SqlPackage); err != nil { + return nil, fmt.Errorf("invalid options: %s", err) + } + } + + if options.SqlDriver != "" { + if err := validateDriver(options.SqlDriver); err != nil { + return nil, fmt.Errorf("invalid options: %s", err) + } + } + + if options.QueryParameterLimit == nil { + options.QueryParameterLimit = new(int32) + *options.QueryParameterLimit = 1 + } + + if options.Initialisms == nil { + options.Initialisms = new([]string) + *options.Initialisms = []string{"id"} + } + + options.InitialismsMap = map[string]struct{}{} + for _, initial := range *options.Initialisms { + options.InitialismsMap[initial] = struct{}{} + } + + return &options, nil +} + +func parseGlobalOpts(req *plugin.GenerateRequest) (*GlobalOptions, error) { + var options GlobalOptions + if len(req.GlobalOptions) == 0 { + return &options, nil + } + if err := json.Unmarshal(req.GlobalOptions, &options); err != nil { + return nil, fmt.Errorf("unmarshalling global options: %w", err) + } + for i := range options.Overrides { + if err := options.Overrides[i].parse(req); err != nil { + return nil, err + } + } + return &options, nil +} + +func ValidateOpts(opts *Options) error { + if opts.EmitMethodsWithDbArgument && opts.EmitPreparedQueries { + return fmt.Errorf("invalid options: emit_methods_with_db_argument and emit_prepared_queries options are mutually exclusive") + } + if *opts.QueryParameterLimit < 0 { + return fmt.Errorf("invalid options: query parameter limit must not be negative") + } + + return nil +} diff --git a/internal/config/override.go b/internal/codegen/golang/opts/override.go similarity index 76% rename from internal/config/override.go rename to internal/codegen/golang/opts/override.go index f2337a79de..6916c0c7f3 100644 --- a/internal/config/override.go +++ b/internal/codegen/golang/opts/override.go @@ -1,12 +1,13 @@ -package config +package opts import ( "fmt" "os" "strings" + "github.com/sqlc-dev/sqlc/internal/codegen/sdk" "github.com/sqlc-dev/sqlc/internal/pattern" - "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/plugin" ) type Override struct { @@ -22,7 +23,7 @@ type Override struct { Deprecated_PostgresType string `json:"postgres_type" yaml:"postgres_type"` // for global overrides only when two different engines are in use - Engine Engine `json:"engine,omitempty" yaml:"engine"` + Engine string `json:"engine,omitempty" yaml:"engine"` // True if the GoType should override if the matching type is nullable Nullable bool `json:"nullable" yaml:"nullable"` @@ -36,54 +37,53 @@ type Override struct { // fully qualified name of the column, e.g. `accounts.id` Column string `json:"column" yaml:"column"` - ColumnName *pattern.Match - TableCatalog *pattern.Match - TableSchema *pattern.Match - TableRel *pattern.Match - GoImportPath string - GoPackage string - GoTypeName string - GoBasicType bool + ColumnName *pattern.Match `json:"-"` + TableCatalog *pattern.Match `json:"-"` + TableSchema *pattern.Match `json:"-"` + TableRel *pattern.Match `json:"-"` + GoImportPath string `json:"-"` + GoPackage string `json:"-"` + GoTypeName string `json:"-"` + GoBasicType bool `json:"-"` // Parsed form of GoStructTag, e.g. {"validate:", "required"} - GoStructTags map[string]string + GoStructTags map[string]string `json:"-"` + ShimOverride *ShimOverride `json:"-"` } -func (o *Override) Matches(n *ast.TableName, defaultSchema string) bool { +func (o *Override) Matches(n *plugin.Identifier, defaultSchema string) bool { if n == nil { return false } - schema := n.Schema if n.Schema == "" { schema = defaultSchema } - if o.TableCatalog != nil && !o.TableCatalog.MatchString(n.Catalog) { return false } - if o.TableSchema == nil && schema != "" { return false } - if o.TableSchema != nil && !o.TableSchema.MatchString(schema) { return false } - if o.TableRel == nil && n.Name != "" { return false } - if o.TableRel != nil && !o.TableRel.MatchString(n.Name) { return false } - return true } -func (o *Override) Parse() (err error) { +func (o *Override) MatchesColumn(col *plugin.Column) bool { + columnType := sdk.DataType(col.Type) + notNull := col.NotNull || col.IsArray + return o.DBType != "" && o.DBType == columnType && o.Nullable != notNull && o.Unsigned == col.Unsigned +} +func (o *Override) parse(req *plugin.GenerateRequest) (err error) { // validate deprecated postgres_type field if o.Deprecated_PostgresType != "" { fmt.Fprintf(os.Stderr, "WARNING: \"postgres_type\" is deprecated. Instead, use \"db_type\" to specify a type override.\n") @@ -99,6 +99,11 @@ func (o *Override) Parse() (err error) { o.Nullable = true } + schema := "public" + if req != nil && req.Catalog != nil { + schema = req.Catalog.DefaultSchema + } + // validate option combinations switch { case o.Column != "" && o.DBType != "": @@ -118,7 +123,7 @@ func (o *Override) Parse() (err error) { if o.TableRel, err = pattern.MatchCompile(colParts[0]); err != nil { return err } - if o.TableSchema, err = pattern.MatchCompile("public"); err != nil { + if o.TableSchema, err = pattern.MatchCompile(schema); err != nil { return err } case 3: @@ -150,7 +155,7 @@ func (o *Override) Parse() (err error) { } // validate GoType - parsed, err := o.GoType.Parse() + parsed, err := o.GoType.parse() if err != nil { return err } @@ -160,11 +165,12 @@ func (o *Override) Parse() (err error) { o.GoBasicType = parsed.BasicType // validate GoStructTag - tags, err := o.GoStructTag.Parse() + tags, err := o.GoStructTag.parse() if err != nil { return err } o.GoStructTags = tags + o.ShimOverride = shimOverride(req, o) return nil } diff --git a/internal/codegen/golang/opts/override_test.go b/internal/codegen/golang/opts/override_test.go new file mode 100644 index 0000000000..8405666f36 --- /dev/null +++ b/internal/codegen/golang/opts/override_test.go @@ -0,0 +1,117 @@ +package opts + +import ( + "testing" + + "github.com/google/go-cmp/cmp" +) + +func TestTypeOverrides(t *testing.T) { + for _, test := range []struct { + override Override + pkg string + typeName string + basic bool + }{ + { + Override{ + DBType: "uuid", + GoType: GoType{Spec: "github.com/segmentio/ksuid.KSUID"}, + }, + "github.com/segmentio/ksuid", + "ksuid.KSUID", + false, + }, + // TODO: Add test for struct pointers + // + // { + // Override{ + // DBType: "uuid", + // GoType: "github.com/segmentio/*ksuid.KSUID", + // }, + // "github.com/segmentio/ksuid", + // "*ksuid.KSUID", + // false, + // }, + { + Override{ + DBType: "citext", + GoType: GoType{Spec: "string"}, + }, + "", + "string", + true, + }, + { + Override{ + DBType: "timestamp", + GoType: GoType{Spec: "time.Time"}, + }, + "time", + "time.Time", + false, + }, + } { + tt := test + t.Run(tt.override.GoType.Spec, func(t *testing.T) { + if err := tt.override.parse(nil); err != nil { + t.Fatalf("override parsing failed; %s", err) + } + if diff := cmp.Diff(tt.pkg, tt.override.GoImportPath); diff != "" { + t.Errorf("package mismatch;\n%s", diff) + } + if diff := cmp.Diff(tt.typeName, tt.override.GoTypeName); diff != "" { + t.Errorf("type name mismatch;\n%s", diff) + } + if diff := cmp.Diff(tt.basic, tt.override.GoBasicType); diff != "" { + t.Errorf("basic mismatch;\n%s", diff) + } + }) + } + for _, test := range []struct { + override Override + err string + }{ + { + Override{ + DBType: "uuid", + GoType: GoType{Spec: "Pointer"}, + }, + "Package override `go_type` specifier \"Pointer\" is not a Go basic type e.g. 'string'", + }, + { + Override{ + DBType: "uuid", + GoType: GoType{Spec: "untyped rune"}, + }, + "Package override `go_type` specifier \"untyped rune\" is not a Go basic type e.g. 'string'", + }, + } { + tt := test + t.Run(tt.override.GoType.Spec, func(t *testing.T) { + err := tt.override.parse(nil) + if err == nil { + t.Fatalf("expected parse to fail; got nil") + } + if diff := cmp.Diff(tt.err, err.Error()); diff != "" { + t.Errorf("error mismatch;\n%s", diff) + } + }) + } +} + +func FuzzOverride(f *testing.F) { + for _, spec := range []string{ + "string", + "github.com/gofrs/uuid.UUID", + "github.com/segmentio/ksuid.KSUID", + } { + f.Add(spec) + } + f.Fuzz(func(t *testing.T, s string) { + o := Override{ + GoType: GoType{Spec: s}, + } + o.parse(nil) + }) +} diff --git a/internal/codegen/golang/opts/shim.go b/internal/codegen/golang/opts/shim.go new file mode 100644 index 0000000000..7912e17664 --- /dev/null +++ b/internal/codegen/golang/opts/shim.go @@ -0,0 +1,77 @@ +package opts + +import ( + "strings" + + "github.com/sqlc-dev/sqlc/internal/plugin" +) + +// The ShimOverride struct exists to bridge the gap between the Override struct +// and the previous Override struct defined in codegen.proto. Eventually these +// shim structs should be removed in favor of using the existing Override and +// GoType structs, but it's easier to provide these shim structs to not change +// the existing, working code. +type ShimOverride struct { + DbType string + Nullable bool + Column string + Table *plugin.Identifier + ColumnName string + Unsigned bool + GoType *ShimGoType +} + +func shimOverride(req *plugin.GenerateRequest, o *Override) *ShimOverride { + var column string + var table plugin.Identifier + + if o.Column != "" { + colParts := strings.Split(o.Column, ".") + switch len(colParts) { + case 2: + table.Schema = req.Catalog.DefaultSchema + table.Name = colParts[0] + column = colParts[1] + case 3: + table.Schema = colParts[0] + table.Name = colParts[1] + column = colParts[2] + case 4: + table.Catalog = colParts[0] + table.Schema = colParts[1] + table.Name = colParts[2] + column = colParts[3] + } + } + return &ShimOverride{ + DbType: o.DBType, + Nullable: o.Nullable, + Unsigned: o.Unsigned, + Column: o.Column, + ColumnName: column, + Table: &table, + GoType: shimGoType(o), + } +} + +type ShimGoType struct { + ImportPath string + Package string + TypeName string + BasicType bool + StructTags map[string]string +} + +func shimGoType(o *Override) *ShimGoType { + // Note that there is a slight mismatch between this and the + // proto api. The GoType on the override is the unparsed type, + // which could be a qualified path or an object, as per + // https://docs.sqlc.dev/en/v1.18.0/reference/config.html#type-overriding + return &ShimGoType{ + ImportPath: o.GoImportPath, + Package: o.GoPackage, + TypeName: o.GoTypeName, + BasicType: o.GoBasicType, + StructTags: o.GoStructTags, + } +} diff --git a/internal/codegen/golang/postgresql_type.go b/internal/codegen/golang/postgresql_type.go index b9444cebee..398d01e2e8 100644 --- a/internal/codegen/golang/postgresql_type.go +++ b/internal/codegen/golang/postgresql_type.go @@ -5,6 +5,7 @@ import ( "log" "strings" + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" "github.com/sqlc-dev/sqlc/internal/codegen/sdk" "github.com/sqlc-dev/sqlc/internal/debug" "github.com/sqlc-dev/sqlc/internal/plugin" @@ -33,11 +34,11 @@ func parseIdentifierString(name string) (*plugin.Identifier, error) { } } -func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { +func postgresType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column) string { columnType := sdk.DataType(col.Type) notNull := col.NotNull || col.IsArray - driver := parseDriver(req.Settings.Go.SqlPackage) - emitPointersForNull := driver.IsPGX() && req.Settings.Go.EmitPointersForNullTypes + driver := parseDriver(options.SqlPackage) + emitPointersForNull := driver.IsPGX() && options.EmitPointersForNullTypes switch columnType { case "serial", "serial4", "pg_catalog.serial4": @@ -47,7 +48,7 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { if emitPointersForNull { return "*int32" } - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Int4" } return "sql.NullInt32" @@ -59,7 +60,7 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { if emitPointersForNull { return "*int64" } - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Int8" } return "sql.NullInt64" @@ -71,7 +72,7 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { if emitPointersForNull { return "*int16" } - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Int2" } return "sql.NullInt16" @@ -83,7 +84,7 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { if emitPointersForNull { return "*int32" } - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Int4" } return "sql.NullInt32" @@ -95,7 +96,7 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { if emitPointersForNull { return "*int64" } - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Int8" } return "sql.NullInt64" @@ -107,7 +108,7 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { if emitPointersForNull { return "*int16" } - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Int2" } return "sql.NullInt16" @@ -119,7 +120,7 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { if emitPointersForNull { return "*float64" } - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Float8" } return "sql.NullFloat64" @@ -131,7 +132,7 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { if emitPointersForNull { return "*float32" } - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Float4" } return "sql.NullFloat64" // TODO: Change to sql.NullFloat32 after updating the go.mod file @@ -159,18 +160,18 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { if emitPointersForNull { return "*bool" } - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Bool" } return "sql.NullBool" - case "json": + case "json", "pg_catalog.json": switch driver { - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "[]byte" - case SQLDriverPGXV4: + case opts.SQLDriverPGXV4: return "pgtype.JSON" - case SQLDriverLibPQ: + case opts.SQLDriverLibPQ: if notNull { return "json.RawMessage" } else { @@ -180,13 +181,13 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { return "interface{}" } - case "jsonb": + case "jsonb", "pg_catalog.jsonb": switch driver { - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "[]byte" - case SQLDriverPGXV4: + case opts.SQLDriverPGXV4: return "pgtype.JSONB" - case SQLDriverLibPQ: + case opts.SQLDriverLibPQ: if notNull { return "json.RawMessage" } else { @@ -200,7 +201,7 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { return "[]byte" case "date": - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Date" } if notNull { @@ -212,7 +213,7 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { return "sql.NullTime" case "pg_catalog.time": - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Time" } if notNull { @@ -232,8 +233,8 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { } return "sql.NullTime" - case "pg_catalog.timestamp": - if driver == SQLDriverPGXV5 { + case "pg_catalog.timestamp", "timestamp": + if driver == opts.SQLDriverPGXV5 { return "pgtype.Timestamp" } if notNull { @@ -245,7 +246,7 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { return "sql.NullTime" case "pg_catalog.timestamptz", "timestamptz": - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Timestamptz" } if notNull { @@ -263,13 +264,13 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { if emitPointersForNull { return "*string" } - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Text" } return "sql.NullString" case "uuid": - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.UUID" } if notNull { @@ -282,14 +283,14 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { case "inet": switch driver { - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: if notNull { return "netip.Addr" } return "*netip.Addr" - case SQLDriverPGXV4: + case opts.SQLDriverPGXV4: return "pgtype.Inet" - case SQLDriverLibPQ: + case opts.SQLDriverLibPQ: return "pqtype.Inet" default: return "interface{}" @@ -297,14 +298,14 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { case "cidr": switch driver { - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: if notNull { return "netip.Prefix" } return "*netip.Prefix" - case SQLDriverPGXV4: + case opts.SQLDriverPGXV4: return "pgtype.CIDR" - case SQLDriverLibPQ: + case opts.SQLDriverLibPQ: return "pqtype.CIDR" default: return "interface{}" @@ -312,11 +313,11 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { case "macaddr", "macaddr8": switch driver { - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "net.HardwareAddr" - case SQLDriverPGXV4: + case opts.SQLDriverPGXV4: return "pgtype.Macaddr" - case SQLDriverLibPQ: + case opts.SQLDriverLibPQ: return "pqtype.Macaddr" default: return "interface{}" @@ -334,13 +335,13 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { if emitPointersForNull { return "*string" } - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Text" } return "sql.NullString" case "interval", "pg_catalog.interval": - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Interval" } if notNull { @@ -353,9 +354,9 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { case "daterange": switch driver { - case SQLDriverPGXV4: + case opts.SQLDriverPGXV4: return "pgtype.Daterange" - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "pgtype.Range[pgtype.Date]" default: return "interface{}" @@ -363,7 +364,7 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { case "datemultirange": switch driver { - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "pgtype.Multirange[pgtype.Range[pgtype.Date]]" default: return "interface{}" @@ -371,9 +372,9 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { case "tsrange": switch driver { - case SQLDriverPGXV4: + case opts.SQLDriverPGXV4: return "pgtype.Tsrange" - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "pgtype.Range[pgtype.Timestamp]" default: return "interface{}" @@ -381,7 +382,7 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { case "tsmultirange": switch driver { - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "pgtype.Multirange[pgtype.Range[pgtype.Timestamp]]" default: return "interface{}" @@ -389,9 +390,9 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { case "tstzrange": switch driver { - case SQLDriverPGXV4: + case opts.SQLDriverPGXV4: return "pgtype.Tstzrange" - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "pgtype.Range[pgtype.Timestamptz]" default: return "interface{}" @@ -399,7 +400,7 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { case "tstzmultirange": switch driver { - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "pgtype.Multirange[pgtype.Range[pgtype.Timestamptz]]" default: return "interface{}" @@ -407,9 +408,9 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { case "numrange": switch driver { - case SQLDriverPGXV4: + case opts.SQLDriverPGXV4: return "pgtype.Numrange" - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "pgtype.Range[pgtype.Numeric]" default: return "interface{}" @@ -417,7 +418,7 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { case "nummultirange": switch driver { - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "pgtype.Multirange[pgtype.Range[pgtype.Numeric]]" default: return "interface{}" @@ -425,9 +426,9 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { case "int4range": switch driver { - case SQLDriverPGXV4: + case opts.SQLDriverPGXV4: return "pgtype.Int4range" - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "pgtype.Range[pgtype.Int4]" default: return "interface{}" @@ -435,7 +436,7 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { case "int4multirange": switch driver { - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "pgtype.Multirange[pgtype.Range[pgtype.Int4]]" default: return "interface{}" @@ -443,9 +444,9 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { case "int8range": switch driver { - case SQLDriverPGXV4: + case opts.SQLDriverPGXV4: return "pgtype.Int8range" - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "pgtype.Range[pgtype.Int8]" default: return "interface{}" @@ -453,7 +454,7 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { case "int8multirange": switch driver { - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "pgtype.Multirange[pgtype.Range[pgtype.Int8]]" default: return "interface{}" @@ -466,26 +467,26 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { return "interface{}" case "bit", "varbit", "pg_catalog.bit", "pg_catalog.varbit": - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Bits" } - if driver == SQLDriverPGXV4 { + if driver == opts.SQLDriverPGXV4 { return "pgtype.Varbit" } case "cid": - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Uint32" } - if driver == SQLDriverPGXV4 { + if driver == opts.SQLDriverPGXV4 { return "pgtype.CID" } case "oid": - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Uint32" } - if driver == SQLDriverPGXV4 { + if driver == opts.SQLDriverPGXV4 { return "pgtype.OID" } @@ -495,10 +496,10 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { } case "xid": - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Uint32" } - if driver == SQLDriverPGXV4 { + if driver == opts.SQLDriverPGXV4 { return "pgtype.XID" } @@ -537,6 +538,15 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { return "pgtype.Polygon" } + case "vector": + if driver == opts.SQLDriverPGXV5 { + if emitPointersForNull { + return "*pgvector.Vector" + } else { + return "pgvector.Vector" + } + } + case "void": // A void value can only be scanned into an empty interface. return "interface{}" @@ -563,14 +573,14 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { if rel.Name == enum.Name && rel.Schema == schema.Name { if notNull { if schema.Name == req.Catalog.DefaultSchema { - return StructName(enum.Name, req.Settings) + return StructName(enum.Name, options) } - return StructName(schema.Name+"_"+enum.Name, req.Settings) + return StructName(schema.Name+"_"+enum.Name, options) } else { if schema.Name == req.Catalog.DefaultSchema { - return "Null" + StructName(enum.Name, req.Settings) + return "Null" + StructName(enum.Name, options) } - return "Null" + StructName(schema.Name+"_"+enum.Name, req.Settings) + return "Null" + StructName(schema.Name+"_"+enum.Name, options) } } } diff --git a/internal/codegen/golang/query.go b/internal/codegen/golang/query.go index 434a909468..3b4fb2fa1a 100644 --- a/internal/codegen/golang/query.go +++ b/internal/codegen/golang/query.go @@ -4,6 +4,7 @@ import ( "fmt" "strings" + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" "github.com/sqlc-dev/sqlc/internal/metadata" "github.com/sqlc-dev/sqlc/internal/plugin" ) @@ -15,7 +16,7 @@ type QueryValue struct { DBName string // The name of the field in the database. Only set if Struct==nil. Struct *Struct Typ string - SQLDriver SQLDriver + SQLDriver opts.SQLDriver // Column is kept so late in the generation process around to differentiate // between mysql slices and pg arrays @@ -61,7 +62,7 @@ func (v QueryValue) Pairs() []Argument { var out []Argument for _, f := range v.Struct.Fields { out = append(out, Argument{ - Name: toLowerCase(f.Name), + Name: escape(toLowerCase(f.Name)), Type: f.Type, }) } @@ -69,7 +70,7 @@ func (v QueryValue) Pairs() []Argument { } return []Argument{ { - Name: v.Name, + Name: escape(v.Name), Type: v.DefineType(), }, } @@ -102,9 +103,9 @@ func (v *QueryValue) DefineType() string { func (v *QueryValue) ReturnName() string { if v.IsPointer() { - return "&" + v.Name + return "&" + escape(v.Name) } - return v.Name + return escape(v.Name) } func (v QueryValue) UniqueFields() []Field { @@ -129,16 +130,16 @@ func (v QueryValue) Params() string { var out []string if v.Struct == nil { if !v.Column.IsSqlcSlice && strings.HasPrefix(v.Typ, "[]") && v.Typ != "[]byte" && !v.SQLDriver.IsPGX() { - out = append(out, "pq.Array("+v.Name+")") + out = append(out, "pq.Array("+escape(v.Name)+")") } else { - out = append(out, v.Name) + out = append(out, escape(v.Name)) } } else { for _, f := range v.Struct.Fields { if !f.HasSqlcSlice() && strings.HasPrefix(f.Type, "[]") && f.Type != "[]byte" && !v.SQLDriver.IsPGX() { - out = append(out, "pq.Array("+v.VariableForField(f)+")") + out = append(out, "pq.Array("+escape(v.VariableForField(f))+")") } else { - out = append(out, v.VariableForField(f)) + out = append(out, escape(v.VariableForField(f))) } } } @@ -166,7 +167,11 @@ func (v QueryValue) ColumnNamesAsGoSlice() string { } escapedNames := make([]string, len(v.Struct.Fields)) for i, f := range v.Struct.Fields { - escapedNames[i] = fmt.Sprintf("%q", f.DBName) + if f.Column != nil && f.Column.OriginalName != "" { + escapedNames[i] = fmt.Sprintf("%q", f.Column.OriginalName) + } else { + escapedNames[i] = fmt.Sprintf("%q", f.DBName) + } } return "[]string{" + strings.Join(escapedNames, ", ") + "}" } diff --git a/internal/codegen/golang/reserved.go b/internal/codegen/golang/reserved.go new file mode 100644 index 0000000000..0461c4a2de --- /dev/null +++ b/internal/codegen/golang/reserved.go @@ -0,0 +1,67 @@ +package golang + +func escape(s string) string { + if IsReserved(s) { + return s + "_" + } + return s +} + +func IsReserved(s string) bool { + switch s { + case "break": + return true + case "default": + return true + case "func": + return true + case "interface": + return true + case "select": + return true + case "case": + return true + case "defer": + return true + case "go": + return true + case "map": + return true + case "struct": + return true + case "chan": + return true + case "else": + return true + case "goto": + return true + case "package": + return true + case "switch": + return true + case "const": + return true + case "fallthrough": + return true + case "if": + return true + case "range": + return true + case "type": + return true + case "continue": + return true + case "for": + return true + case "import": + return true + case "return": + return true + case "var": + return true + case "q": + return true + default: + return false + } +} diff --git a/internal/codegen/golang/result.go b/internal/codegen/golang/result.go index 8e1c2714f7..515d0a654f 100644 --- a/internal/codegen/golang/result.go +++ b/internal/codegen/golang/result.go @@ -1,17 +1,19 @@ package golang import ( + "bufio" "fmt" "sort" "strings" + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" "github.com/sqlc-dev/sqlc/internal/codegen/sdk" "github.com/sqlc-dev/sqlc/internal/inflection" "github.com/sqlc-dev/sqlc/internal/metadata" "github.com/sqlc-dev/sqlc/internal/plugin" ) -func buildEnums(req *plugin.CodeGenRequest) []Enum { +func buildEnums(req *plugin.GenerateRequest, options *opts.Options) []Enum { var enums []Enum for _, schema := range req.Catalog.Schemas { if schema.Name == "pg_catalog" || schema.Name == "information_schema" { @@ -26,14 +28,14 @@ func buildEnums(req *plugin.CodeGenRequest) []Enum { } e := Enum{ - Name: StructName(enumName, req.Settings), + Name: StructName(enumName, options), Comment: enum.Comment, NameTags: map[string]string{}, ValidTags: map[string]string{}, } - if req.Settings.Go.EmitJsonTags { - e.NameTags["json"] = JSONTagName(enumName, req.Settings) - e.ValidTags["json"] = JSONTagName("valid", req.Settings) + if options.EmitJsonTags { + e.NameTags["json"] = JSONTagName(enumName, options) + e.ValidTags["json"] = JSONTagName("valid", options) } seen := make(map[string]struct{}, len(enum.Vals)) @@ -43,7 +45,7 @@ func buildEnums(req *plugin.CodeGenRequest) []Enum { value = fmt.Sprintf("value_%d", i) } e.Constants = append(e.Constants, Constant{ - Name: StructName(enumName+"_"+value, req.Settings), + Name: StructName(enumName+"_"+value, options), Value: v, Type: e.Name, }) @@ -58,7 +60,7 @@ func buildEnums(req *plugin.CodeGenRequest) []Enum { return enums } -func buildStructs(req *plugin.CodeGenRequest) []Struct { +func buildStructs(req *plugin.GenerateRequest, options *opts.Options) []Struct { var structs []Struct for _, schema := range req.Catalog.Schemas { if schema.Name == "pg_catalog" || schema.Name == "information_schema" { @@ -72,29 +74,29 @@ func buildStructs(req *plugin.CodeGenRequest) []Struct { tableName = schema.Name + "_" + table.Rel.Name } structName := tableName - if !req.Settings.Go.EmitExactTableNames { + if !options.EmitExactTableNames { structName = inflection.Singular(inflection.SingularParams{ Name: structName, - Exclusions: req.Settings.Go.InflectionExcludeTableNames, + Exclusions: options.InflectionExcludeTableNames, }) } s := Struct{ Table: &plugin.Identifier{Schema: schema.Name, Name: table.Rel.Name}, - Name: StructName(structName, req.Settings), + Name: StructName(structName, options), Comment: table.Comment, } for _, column := range table.Columns { tags := map[string]string{} - if req.Settings.Go.EmitDbTags { + if options.EmitDbTags { tags["db"] = column.Name } - if req.Settings.Go.EmitJsonTags { - tags["json"] = JSONTagName(column.Name, req.Settings) + if options.EmitJsonTags { + tags["json"] = JSONTagName(column.Name, options) } - addExtraGoStructTags(tags, req, column) + addExtraGoStructTags(tags, req, options, column) s.Fields = append(s.Fields, Field{ - Name: StructName(column.Name, req.Settings), - Type: goType(req, column), + Name: StructName(column.Name, options), + Type: goType(req, options, column), Tags: tags, Comment: column.Comment, }) @@ -181,7 +183,7 @@ func argName(name string) string { return out } -func buildQueries(req *plugin.CodeGenRequest, structs []Struct) ([]Query, error) { +func buildQueries(req *plugin.GenerateRequest, options *opts.Options, structs []Struct) ([]Query, error) { qs := make([]Query, 0, len(req.Queries)) for _, query := range req.Queries { if query.Name == "" { @@ -192,12 +194,28 @@ func buildQueries(req *plugin.CodeGenRequest, structs []Struct) ([]Query, error) } var constantName string - if req.Settings.Go.EmitExportedQueries { + if options.EmitExportedQueries { constantName = sdk.Title(query.Name) } else { constantName = sdk.LowerTitle(query.Name) } + comments := query.Comments + if options.EmitSqlAsComment { + if len(comments) == 0 { + comments = append(comments, query.Name) + } + comments = append(comments, " ") + scanner := bufio.NewScanner(strings.NewReader(query.Text)) + for scanner.Scan() { + line := scanner.Text() + comments = append(comments, " "+line) + } + if err := scanner.Err(); err != nil { + return nil, err + } + } + gq := Query{ Cmd: query.Cmd, ConstantName: constantName, @@ -205,19 +223,19 @@ func buildQueries(req *plugin.CodeGenRequest, structs []Struct) ([]Query, error) MethodName: query.Name, SourceName: query.Filename, SQL: query.Text, - Comments: query.Comments, + Comments: comments, Table: query.InsertIntoTable, } - sqlpkg := parseDriver(req.Settings.Go.SqlPackage) + sqlpkg := parseDriver(options.SqlPackage) - qpl := int(*req.Settings.Go.QueryParameterLimit) + qpl := int(*options.QueryParameterLimit) if len(query.Params) == 1 && qpl != 0 { p := query.Params[0] gq.Arg = QueryValue{ - Name: paramName(p), + Name: escape(paramName(p)), DBName: p.Column.GetName(), - Typ: goType(req, p.Column), + Typ: goType(req, options, p.Column), SQLDriver: sqlpkg, Column: p.Column, } @@ -229,7 +247,7 @@ func buildQueries(req *plugin.CodeGenRequest, structs []Struct) ([]Query, error) Column: p.Column, }) } - s, err := columnsToStruct(req, gq.MethodName+"Params", cols, false) + s, err := columnsToStruct(req, options, gq.MethodName+"Params", cols, false) if err != nil { return nil, err } @@ -238,10 +256,12 @@ func buildQueries(req *plugin.CodeGenRequest, structs []Struct) ([]Query, error) Name: "arg", Struct: s, SQLDriver: sqlpkg, - EmitPointer: req.Settings.Go.EmitParamsStructPointers, + EmitPointer: options.EmitParamsStructPointers, } - if len(query.Params) <= qpl { + // if query params is 2, and query params limit is 4 AND this is a copyfrom, we still want to emit the query's model + // otherwise we end up with a copyfrom using a struct without the struct definition + if len(query.Params) <= qpl && query.Cmd != ":copyfrom" { gq.Arg.Emit = false } } @@ -249,13 +269,11 @@ func buildQueries(req *plugin.CodeGenRequest, structs []Struct) ([]Query, error) if len(query.Columns) == 1 && query.Columns[0].EmbedTable == nil { c := query.Columns[0] name := columnName(c, 0) - if c.IsFuncCall { - name = strings.Replace(name, "$", "_", -1) - } + name = strings.Replace(name, "$", "_", -1) gq.Ret = QueryValue{ - Name: name, + Name: escape(name), DBName: name, - Typ: goType(req, c), + Typ: goType(req, options, c), SQLDriver: sqlpkg, } } else if putOutColumns(query) { @@ -269,8 +287,8 @@ func buildQueries(req *plugin.CodeGenRequest, structs []Struct) ([]Query, error) same := true for i, f := range s.Fields { c := query.Columns[i] - sameName := f.Name == StructName(columnName(c, i), req.Settings) - sameType := f.Type == goType(req, c) + sameName := f.Name == StructName(columnName(c, i), options) + sameType := f.Type == goType(req, options, c) sameTable := sdk.SameTableName(c.Table, s.Table, req.Catalog.DefaultSchema) if !sameName || !sameType || !sameTable { same = false @@ -292,7 +310,7 @@ func buildQueries(req *plugin.CodeGenRequest, structs []Struct) ([]Query, error) }) } var err error - gs, err = columnsToStruct(req, gq.MethodName+"Row", columns, true) + gs, err = columnsToStruct(req, options, gq.MethodName+"Row", columns, true) if err != nil { return nil, err } @@ -303,7 +321,7 @@ func buildQueries(req *plugin.CodeGenRequest, structs []Struct) ([]Query, error) Name: "i", Struct: gs, SQLDriver: sqlpkg, - EmitPointer: req.Settings.Go.EmitResultStructPointers, + EmitPointer: options.EmitResultStructPointers, } } @@ -313,16 +331,16 @@ func buildQueries(req *plugin.CodeGenRequest, structs []Struct) ([]Query, error) return qs, nil } +var cmdReturnsData = map[string]struct{}{ + metadata.CmdBatchMany: {}, + metadata.CmdBatchOne: {}, + metadata.CmdMany: {}, + metadata.CmdOne: {}, +} + func putOutColumns(query *plugin.Query) bool { - if len(query.Columns) > 0 { - return true - } - for _, allowed := range []string{metadata.CmdMany, metadata.CmdOne, metadata.CmdBatchMany} { - if query.Cmd == allowed { - return true - } - } - return false + _, found := cmdReturnsData[query.Cmd] + return found } // It's possible that this method will generate duplicate JSON tag values @@ -333,7 +351,7 @@ func putOutColumns(query *plugin.Query) bool { // JSON tags: count, count_2, count_2 // // This is unlikely to happen, so don't fix it yet -func columnsToStruct(req *plugin.CodeGenRequest, name string, columns []goColumn, useID bool) (*Struct, error) { +func columnsToStruct(req *plugin.GenerateRequest, options *opts.Options, name string, columns []goColumn, useID bool) (*Struct, error) { gs := Struct{ Name: name, } @@ -349,7 +367,7 @@ func columnsToStruct(req *plugin.CodeGenRequest, name string, columns []goColumn tagName = SetCaseStyle(colName, "snake") } - fieldName := StructName(colName, req.Settings) + fieldName := StructName(colName, options) baseFieldName := fieldName // Track suffixes by the ID of the column, so that columns referring to the same numbered parameter can be // reused. @@ -365,13 +383,13 @@ func columnsToStruct(req *plugin.CodeGenRequest, name string, columns []goColumn fieldName = fmt.Sprintf("%s_%d", fieldName, suffix) } tags := map[string]string{} - if req.Settings.Go.EmitDbTags { + if options.EmitDbTags { tags["db"] = tagName } - if req.Settings.Go.EmitJsonTags { - tags["json"] = JSONTagName(tagName, req.Settings) + if options.EmitJsonTags { + tags["json"] = JSONTagName(tagName, options) } - addExtraGoStructTags(tags, req, c.Column) + addExtraGoStructTags(tags, req, options, c.Column) f := Field{ Name: fieldName, DBName: colName, @@ -379,7 +397,7 @@ func columnsToStruct(req *plugin.CodeGenRequest, name string, columns []goColumn Column: c.Column, } if c.embed == nil { - f.Type = goType(req, c.Column) + f.Type = goType(req, options, c.Column) } else { f.Type = c.embed.modelType f.EmbedFields = c.embed.fields diff --git a/internal/codegen/golang/result_test.go b/internal/codegen/golang/result_test.go index 4156b848e2..0c58525ec3 100644 --- a/internal/codegen/golang/result_test.go +++ b/internal/codegen/golang/result_test.go @@ -50,7 +50,7 @@ func TestPutOutColumns_ForZeroColumns(t *testing.T) { }, { cmd: metadata.CmdBatchOne, - want: false, + want: true, }, } for _, tc := range tests { diff --git a/internal/codegen/golang/sqlite_type.go b/internal/codegen/golang/sqlite_type.go index 2581197fd5..8a22aaa262 100644 --- a/internal/codegen/golang/sqlite_type.go +++ b/internal/codegen/golang/sqlite_type.go @@ -4,14 +4,16 @@ import ( "log" "strings" + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" "github.com/sqlc-dev/sqlc/internal/codegen/sdk" "github.com/sqlc-dev/sqlc/internal/debug" "github.com/sqlc-dev/sqlc/internal/plugin" ) -func sqliteType(req *plugin.CodeGenRequest, col *plugin.Column) string { +func sqliteType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column) string { dt := strings.ToLower(sdk.DataType(col.Type)) notNull := col.NotNull || col.IsArray + emitPointersForNull := options.EmitPointersForNullTypes switch dt { @@ -19,6 +21,9 @@ func sqliteType(req *plugin.CodeGenRequest, col *plugin.Column) string { if notNull { return "int64" } + if emitPointersForNull { + return "*int64" + } return "sql.NullInt64" case "blob": @@ -28,20 +33,32 @@ func sqliteType(req *plugin.CodeGenRequest, col *plugin.Column) string { if notNull { return "float64" } + if emitPointersForNull { + return "*float64" + } return "sql.NullFloat64" case "boolean", "bool": if notNull { return "bool" } + if emitPointersForNull { + return "*bool" + } return "sql.NullBool" case "date", "datetime", "timestamp": if notNull { return "time.Time" } + if emitPointersForNull { + return "*time.Time" + } return "sql.NullTime" + case "json", "jsonb": + return "json.RawMessage" + case "any": return "interface{}" @@ -60,12 +77,18 @@ func sqliteType(req *plugin.CodeGenRequest, col *plugin.Column) string { if notNull { return "string" } + if emitPointersForNull { + return "*string" + } return "sql.NullString" case strings.HasPrefix(dt, "decimal"), dt == "numeric": if notNull { return "float64" } + if emitPointersForNull { + return "*float64" + } return "sql.NullFloat64" default: diff --git a/internal/codegen/golang/struct.go b/internal/codegen/golang/struct.go index 31904205e1..ed9311800e 100644 --- a/internal/codegen/golang/struct.go +++ b/internal/codegen/golang/struct.go @@ -5,6 +5,7 @@ import ( "unicode" "unicode/utf8" + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" "github.com/sqlc-dev/sqlc/internal/plugin" ) @@ -15,8 +16,8 @@ type Struct struct { Comment string } -func StructName(name string, settings *plugin.Settings) string { - if rename := settings.Rename[name]; rename != "" { +func StructName(name string, options *opts.Options) string { + if rename := options.Rename[name]; rename != "" { return rename } out := "" @@ -31,8 +32,8 @@ func StructName(name string, settings *plugin.Settings) string { }, name) for _, p := range strings.Split(name, "_") { - if p == "id" { - out += "ID" + if _, found := options.InitialismsMap[p]; found { + out += strings.ToUpper(p) } else { out += strings.Title(p) } diff --git a/internal/codegen/golang/templates/go-sql-driver-mysql/copyfromCopy.tmpl b/internal/codegen/golang/templates/go-sql-driver-mysql/copyfromCopy.tmpl index 3bdc5d5729..e21475b148 100644 --- a/internal/codegen/golang/templates/go-sql-driver-mysql/copyfromCopy.tmpl +++ b/internal/codegen/golang/templates/go-sql-driver-mysql/copyfromCopy.tmpl @@ -9,11 +9,11 @@ func convertRowsFor{{.MethodName}}(w *io.PipeWriter, {{.Arg.SlicePair}}) { {{- with $arg := .Arg }} {{- range $arg.CopyFromMySQLFields}} {{- if eq .Type "string"}} - e.AppendString({{if eq (len $arg.CopyFromMySQLFields) 1}}row{{else}}row.{{.Name}}{{end}}) -{{- else if eq .Type "[]byte"}} - e.AppendBytes({{if eq (len $arg.CopyFromMySQLFields) 1}}row{{else}}row.{{.Name}}{{end}}) + e.AppendString({{if $arg.Struct}}row.{{.Name}}{{else}}row{{end}}) +{{- else if or (eq .Type "[]byte") (eq .Type "json.RawMessage")}} + e.AppendBytes({{if $arg.Struct}}row.{{.Name}}{{else}}row{{end}}) {{- else}} - e.AppendValue({{if eq (len $arg.CopyFromMySQLFields) 1}}row{{else}}row.{{.Name}}{{end}}) + e.AppendValue({{if $arg.Struct}}row.{{.Name}}{{else}}row{{end}}) {{- end}} {{- end}} {{- end}} diff --git a/internal/codegen/golang/templates/pgx/batchCode.tmpl b/internal/codegen/golang/templates/pgx/batchCode.tmpl index 93cdad48a3..35bd701bd3 100644 --- a/internal/codegen/golang/templates/pgx/batchCode.tmpl +++ b/internal/codegen/golang/templates/pgx/batchCode.tmpl @@ -16,7 +16,7 @@ type {{.MethodName}}BatchResults struct { closed bool } -{{if .Arg.EmitStruct}} +{{if .Arg.Struct}} type {{.Arg.Type}} struct { {{- range .Arg.Struct.Fields}} {{.Name}} {{.Type}} {{if .Tag}}{{$.Q}}{{.Tag}}{{$.Q}}{{end}} {{- end}} diff --git a/internal/codegen/golang/templates/pgx/queryCode.tmpl b/internal/codegen/golang/templates/pgx/queryCode.tmpl index 18de5db2ba..59a88c880a 100644 --- a/internal/codegen/golang/templates/pgx/queryCode.tmpl +++ b/internal/codegen/golang/templates/pgx/queryCode.tmpl @@ -37,6 +37,11 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) ({{.Ret.De var {{.Ret.Name}} {{.Ret.Type}} {{- end}} err := row.Scan({{.Ret.Scan}}) + {{- if $.WrapErrors}} + if err != nil { + err = fmt.Errorf("query {{.MethodName}}: %w", err) + } + {{- end}} return {{.Ret.ReturnName}}, err } {{end}} @@ -52,7 +57,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) ([]{{.Ret. rows, err := q.db.Query(ctx, {{.ConstantName}}, {{.Arg.Params}}) {{- end}} if err != nil { - return nil, err + return nil, {{if $.WrapErrors}}fmt.Errorf("query {{.MethodName}}: %w", err){{else}}err{{end}} } defer rows.Close() {{- if $.EmitEmptySlices}} @@ -63,12 +68,12 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) ([]{{.Ret. for rows.Next() { var {{.Ret.Name}} {{.Ret.Type}} if err := rows.Scan({{.Ret.Scan}}); err != nil { - return nil, err + return nil, {{if $.WrapErrors}}fmt.Errorf("query {{.MethodName}}: %w", err){{else}}err{{end}} } items = append(items, {{.Ret.ReturnName}}) } if err := rows.Err(); err != nil { - return nil, err + return nil, {{if $.WrapErrors}}fmt.Errorf("query {{.MethodName}}: %w", err){{else}}err{{end}} } return items, nil } @@ -84,7 +89,14 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) e func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) error { _, err := q.db.Exec(ctx, {{.ConstantName}}, {{.Arg.Params}}) {{- end}} + {{- if $.WrapErrors }} + if err != nil { + return fmt.Errorf("query {{.MethodName}}: %w", err) + } + return nil + {{- else }} return err + {{- end }} } {{end}} @@ -99,7 +111,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) (int64, er result, err := q.db.Exec(ctx, {{.ConstantName}}, {{.Arg.Params}}) {{- end}} if err != nil { - return 0, err + return 0, {{if $.WrapErrors}}fmt.Errorf("query {{.MethodName}}: %w", err){{else}}err{{end}} } return result.RowsAffected(), nil } @@ -110,11 +122,17 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) (int64, er {{end -}} {{- if $.EmitMethodsWithDBArgument -}} func (q *Queries) {{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) (pgconn.CommandTag, error) { - return db.Exec(ctx, {{.ConstantName}}, {{.Arg.Params}}) + {{queryRetval .}} db.Exec(ctx, {{.ConstantName}}, {{.Arg.Params}}) {{- else -}} func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) (pgconn.CommandTag, error) { - return q.db.Exec(ctx, {{.ConstantName}}, {{.Arg.Params}}) + {{queryRetval .}} q.db.Exec(ctx, {{.ConstantName}}, {{.Arg.Params}}) {{- end}} + {{- if $.WrapErrors}} + if err != nil { + err = fmt.Errorf("query {{.MethodName}}: %w", err) + } + return result, err + {{- end}} } {{end}} diff --git a/internal/codegen/golang/templates/stdlib/queryCode.tmpl b/internal/codegen/golang/templates/stdlib/queryCode.tmpl index cf56000ec6..1e7f4e22a4 100644 --- a/internal/codegen/golang/templates/stdlib/queryCode.tmpl +++ b/internal/codegen/golang/templates/stdlib/queryCode.tmpl @@ -28,6 +28,11 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}} var {{.Ret.Name}} {{.Ret.Type}} {{- end}} err := row.Scan({{.Ret.Scan}}) + {{- if $.WrapErrors}} + if err != nil { + err = fmt.Errorf("query {{.MethodName}}: %w", err) + } + {{- end}} return {{.Ret.ReturnName}}, err } {{end}} @@ -38,7 +43,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}} func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}}) ([]{{.Ret.DefineType}}, error) { {{- template "queryCodeStdExec" . }} if err != nil { - return nil, err + return nil, {{if $.WrapErrors}}fmt.Errorf("query {{.MethodName}}: %w", err){{else}}err{{end}} } defer rows.Close() {{- if $.EmitEmptySlices}} @@ -49,15 +54,15 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}} for rows.Next() { var {{.Ret.Name}} {{.Ret.Type}} if err := rows.Scan({{.Ret.Scan}}); err != nil { - return nil, err + return nil, {{if $.WrapErrors}}fmt.Errorf("query {{.MethodName}}: %w", err){{else}}err{{end}} } items = append(items, {{.Ret.ReturnName}}) } if err := rows.Close(); err != nil { - return nil, err + return nil, {{if $.WrapErrors}}fmt.Errorf("query {{.MethodName}}: %w", err){{else}}err{{end}} } if err := rows.Err(); err != nil { - return nil, err + return nil, {{if $.WrapErrors}}fmt.Errorf("query {{.MethodName}}: %w", err){{else}}err{{end}} } return items, nil } @@ -68,6 +73,11 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}} {{end -}} func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}}) error { {{- template "queryCodeStdExec" . }} + {{- if $.WrapErrors}} + if err != nil { + err = fmt.Errorf("query {{.MethodName}}: %w", err) + } + {{- end}} return err } {{end}} @@ -78,7 +88,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}} func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}}) (int64, error) { {{- template "queryCodeStdExec" . }} if err != nil { - return 0, err + return 0, {{if $.WrapErrors}}fmt.Errorf("query {{.MethodName}}: %w", err){{else}}err{{end}} } return result.RowsAffected() } @@ -90,7 +100,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}} func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}}) (int64, error) { {{- template "queryCodeStdExec" . }} if err != nil { - return 0, err + return 0, {{if $.WrapErrors}}fmt.Errorf("query {{.MethodName}}: %w", err){{else}}err{{end}} } return result.LastInsertId() } @@ -101,6 +111,12 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}} {{end -}} func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}}) (sql.Result, error) { {{- template "queryCodeStdExec" . }} + {{- if $.WrapErrors}} + if err != nil { + err = fmt.Errorf("query {{.MethodName}}: %w", err) + } + return result, err + {{- end}} } {{end}} diff --git a/internal/codegen/golang/templates/template.tmpl b/internal/codegen/golang/templates/template.tmpl index 35d14da7d9..afd50c01ac 100644 --- a/internal/codegen/golang/templates/template.tmpl +++ b/internal/codegen/golang/templates/template.tmpl @@ -1,15 +1,22 @@ -{{define "dbFile"}}// Code generated by sqlc. DO NOT EDIT. -// versions: +{{define "dbFile"}} +{{if .BuildTags}} +//go:build {{.BuildTags}} + +{{end}}// Code generated by sqlc. DO NOT EDIT. +{{if not .OmitSqlcVersion}}// versions: // sqlc {{.SqlcVersion}} +{{end}} package {{.Package}} +{{ if hasImports .SourceName }} import ( {{range imports .SourceName}} {{range .}}{{.}} {{end}} {{end}} ) +{{end}} {{template "dbCode" . }} {{end}} @@ -24,18 +31,25 @@ import ( {{end}} -{{define "interfaceFile"}}// Code generated by sqlc. DO NOT EDIT. -// versions: +{{define "interfaceFile"}} +{{if .BuildTags}} +//go:build {{.BuildTags}} + +{{end}}// Code generated by sqlc. DO NOT EDIT. +{{if not .OmitSqlcVersion}}// versions: // sqlc {{.SqlcVersion}} +{{end}} package {{.Package}} +{{ if hasImports .SourceName }} import ( {{range imports .SourceName}} {{range .}}{{.}} {{end}} {{end}} ) +{{end}} {{template "interfaceCode" . }} {{end}} @@ -48,18 +62,25 @@ import ( {{end}} {{end}} -{{define "modelsFile"}}// Code generated by sqlc. DO NOT EDIT. -// versions: +{{define "modelsFile"}} +{{if .BuildTags}} +//go:build {{.BuildTags}} + +{{end}}// Code generated by sqlc. DO NOT EDIT. +{{if not .OmitSqlcVersion}}// versions: // sqlc {{.SqlcVersion}} +{{end}} package {{.Package}} +{{ if hasImports .SourceName }} import ( {{range imports .SourceName}} {{range .}}{{.}} {{end}} {{end}} ) +{{end}} {{template "modelsCode" . }} {{end}} @@ -141,19 +162,25 @@ type {{.Name}} struct { {{- range .Fields}} {{end}} {{end}} -{{define "queryFile"}}// Code generated by sqlc. DO NOT EDIT. -// versions: +{{define "queryFile"}} +{{if .BuildTags}} +//go:build {{.BuildTags}} + +{{end}}// Code generated by sqlc. DO NOT EDIT. +{{if not .OmitSqlcVersion}}// versions: // sqlc {{.SqlcVersion}} -// source: {{.SourceName}} +{{end}}// source: {{.SourceName}} package {{.Package}} +{{ if hasImports .SourceName }} import ( {{range imports .SourceName}} {{range .}}{{.}} {{end}} {{end}} ) +{{end}} {{template "queryCode" . }} {{end}} @@ -166,19 +193,25 @@ import ( {{end}} {{end}} -{{define "copyfromFile"}}// Code generated by sqlc. DO NOT EDIT. -// versions: +{{define "copyfromFile"}} +{{if .BuildTags}} +//go:build {{.BuildTags}} + +{{end}}// Code generated by sqlc. DO NOT EDIT. +{{if not .OmitSqlcVersion}}// versions: // sqlc {{.SqlcVersion}} -// source: {{.SourceName}} +{{end}}// source: {{.SourceName}} package {{.Package}} +{{ if hasImports .SourceName }} import ( {{range imports .SourceName}} {{range .}}{{.}} {{end}} {{end}} ) +{{end}} {{template "copyfromCode" . }} {{end}} @@ -191,19 +224,26 @@ import ( {{end}} {{end}} -{{define "batchFile"}}// Code generated by sqlc. DO NOT EDIT. -// versions: +{{define "batchFile"}} +{{if .BuildTags}} +//go:build {{.BuildTags}} + +{{end}}// Code generated by sqlc. DO NOT EDIT. +{{if not .OmitSqlcVersion}}// versions: // sqlc {{.SqlcVersion}} -// source: {{.SourceName}} +{{end}}// source: {{.SourceName}} package {{.Package}} +{{ if hasImports .SourceName }} import ( {{range imports .SourceName}} {{range .}}{{.}} {{end}} {{end}} ) +{{end}} + {{template "batchCode" . }} {{end}} diff --git a/internal/codegen/json/gen.go b/internal/codegen/json/gen.go index d729fccaac..ad797efd92 100644 --- a/internal/codegen/json/gen.go +++ b/internal/codegen/json/gen.go @@ -11,28 +11,21 @@ import ( "github.com/sqlc-dev/sqlc/internal/plugin" ) -func parseOptions(req *plugin.CodeGenRequest) (*plugin.JSONCode, error) { - if req.Settings == nil { - return new(plugin.JSONCode), nil +func parseOptions(req *plugin.GenerateRequest) (*opts, error) { + if len(req.PluginOptions) == 0 { + return new(opts), nil } - if req.Settings.Codegen != nil { - if len(req.Settings.Codegen.Options) != 0 { - var options *plugin.JSONCode - dec := ejson.NewDecoder(bytes.NewReader(req.Settings.Codegen.Options)) - dec.DisallowUnknownFields() - if err := dec.Decode(&options); err != nil { - return options, fmt.Errorf("unmarshalling options: %s", err) - } - return options, nil - } - } - if req.Settings.Json != nil { - return req.Settings.Json, nil + + var options *opts + dec := ejson.NewDecoder(bytes.NewReader(req.PluginOptions)) + dec.DisallowUnknownFields() + if err := dec.Decode(&options); err != nil { + return options, fmt.Errorf("unmarshalling options: %s", err) } - return new(plugin.JSONCode), nil + return options, nil } -func Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) { +func Generate(ctx context.Context, req *plugin.GenerateRequest) (*plugin.GenerateResponse, error) { options, err := parseOptions(req) if err != nil { return nil, err @@ -64,7 +57,7 @@ func Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plugin.CodeGenR if err != nil { return nil, err } - return &plugin.CodeGenResponse{ + return &plugin.GenerateResponse{ Files: []*plugin.File{ { Name: filename, diff --git a/internal/codegen/json/opts.go b/internal/codegen/json/opts.go new file mode 100644 index 0000000000..9b3654b1f4 --- /dev/null +++ b/internal/codegen/json/opts.go @@ -0,0 +1,7 @@ +package json + +type opts struct { + Out string `json:"out"` + Indent string `json:"indent,omitempty"` + Filename string `json:"filename,omitempty"` +} diff --git a/internal/codegen/sdk/sdk.go b/internal/codegen/sdk/sdk.go index 415cbaaec5..53e3fc6a9f 100644 --- a/internal/codegen/sdk/sdk.go +++ b/internal/codegen/sdk/sdk.go @@ -21,32 +21,6 @@ func MatchString(pat, target string) bool { return matcher.MatchString(target) } -func Matches(o *plugin.Override, n *plugin.Identifier, defaultSchema string) bool { - if n == nil { - return false - } - schema := n.Schema - if n.Schema == "" { - schema = defaultSchema - } - if o.Table.Catalog != "" && !MatchString(o.Table.Catalog, n.Catalog) { - return false - } - if o.Table.Schema == "" && schema != "" { - return false - } - if o.Table.Schema != "" && !MatchString(o.Table.Schema, schema) { - return false - } - if o.Table.Name == "" && n.Name != "" { - return false - } - if o.Table.Name != "" && !MatchString(o.Table.Name, n.Name) { - return false - } - return true -} - func SameTableName(tableID, f *plugin.Identifier, defaultSchema string) bool { if tableID == nil { return false diff --git a/internal/codegen/sdk/utils.go b/internal/codegen/sdk/utils.go index 1dffda9e7e..ec4a4e5ab4 100644 --- a/internal/codegen/sdk/utils.go +++ b/internal/codegen/sdk/utils.go @@ -23,12 +23,14 @@ func Title(s string) string { // a backtick, replace it the following way: // // input: -// SELECT `group` FROM foo +// +// SELECT `group` FROM foo // // output: -// SELECT ` + "`" + `group` + "`" + ` FROM foo // -// The escaped string must be rendered inside an existing string literal +// SELECT ` + "`" + `group` + "`" + ` FROM foo +// +// # The escaped string must be rendered inside an existing string literal // // A string cannot be escaped twice func EscapeBacktick(s string) string { diff --git a/internal/compiler/analyze.go b/internal/compiler/analyze.go new file mode 100644 index 0000000000..38d66fce19 --- /dev/null +++ b/internal/compiler/analyze.go @@ -0,0 +1,207 @@ +package compiler + +import ( + "sort" + + analyzer "github.com/sqlc-dev/sqlc/internal/analysis" + "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/source" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/named" + "github.com/sqlc-dev/sqlc/internal/sql/rewrite" + "github.com/sqlc-dev/sqlc/internal/sql/validate" +) + +type analysis struct { + Table *ast.TableName + Columns []*Column + Parameters []Parameter + Named *named.ParamSet + Query string +} + +func convertTableName(id *analyzer.Identifier) *ast.TableName { + if id == nil { + return nil + } + return &ast.TableName{ + Catalog: id.Catalog, + Schema: id.Schema, + Name: id.Name, + } +} + +func convertTypeName(id *analyzer.Identifier) *ast.TypeName { + if id == nil { + return nil + } + return &ast.TypeName{ + Catalog: id.Catalog, + Schema: id.Schema, + Name: id.Name, + } +} + +func convertColumn(c *analyzer.Column) *Column { + length := int(c.Length) + return &Column{ + Name: c.Name, + OriginalName: c.OriginalName, + DataType: c.DataType, + NotNull: c.NotNull, + Unsigned: c.Unsigned, + IsArray: c.IsArray, + ArrayDims: int(c.ArrayDims), + Comment: c.Comment, + Length: &length, + IsNamedParam: c.IsNamedParam, + IsFuncCall: c.IsFuncCall, + Scope: c.Scope, + Table: convertTableName(c.Table), + TableAlias: c.TableAlias, + Type: convertTypeName(c.Type), + EmbedTable: convertTableName(c.EmbedTable), + IsSqlcSlice: c.IsSqlcSlice, + } +} + +func combineAnalysis(prev *analysis, a *analyzer.Analysis) *analysis { + var cols []*Column + for _, c := range a.Columns { + cols = append(cols, convertColumn(c)) + } + var params []Parameter + for _, p := range a.Params { + params = append(params, Parameter{ + Number: int(p.Number), + Column: convertColumn(p.Column), + }) + } + if len(prev.Columns) == len(cols) { + for i := range prev.Columns { + prev.Columns[i].DataType = cols[i].DataType + prev.Columns[i].IsArray = cols[i].IsArray + prev.Columns[i].ArrayDims = cols[i].ArrayDims + } + } else { + embedding := false + for i := range prev.Columns { + if prev.Columns[i].EmbedTable != nil { + embedding = true + } + } + if !embedding { + prev.Columns = cols + } + } + if len(prev.Parameters) == len(params) { + for i := range prev.Parameters { + prev.Parameters[i].Column.DataType = params[i].Column.DataType + prev.Parameters[i].Column.IsArray = params[i].Column.IsArray + prev.Parameters[i].Column.ArrayDims = params[i].Column.ArrayDims + } + } else { + prev.Parameters = params + } + return prev +} + +func (c *Compiler) analyzeQuery(raw *ast.RawStmt, query string) (*analysis, error) { + return c._analyzeQuery(raw, query, true) +} + +func (c *Compiler) inferQuery(raw *ast.RawStmt, query string) (*analysis, error) { + return c._analyzeQuery(raw, query, false) +} + +func (c *Compiler) _analyzeQuery(raw *ast.RawStmt, query string, failfast bool) (*analysis, error) { + errors := make([]error, 0) + check := func(err error) error { + if failfast { + return err + } + if err != nil { + errors = append(errors, err) + } + return nil + } + + numbers, dollar, err := validate.ParamRef(raw) + if err := check(err); err != nil { + return nil, err + } + + raw, namedParams, edits := rewrite.NamedParameters(c.conf.Engine, raw, numbers, dollar) + + var table *ast.TableName + switch n := raw.Stmt.(type) { + case *ast.InsertStmt: + if err := check(validate.InsertStmt(n)); err != nil { + return nil, err + } + var err error + table, err = ParseTableName(n.Relation) + if err := check(err); err != nil { + return nil, err + } + } + + if err := check(validate.FuncCall(c.catalog, c.combo, raw)); err != nil { + return nil, err + } + + if err := check(validate.In(c.catalog, raw)); err != nil { + return nil, err + } + rvs := rangeVars(raw.Stmt) + refs, errs := findParameters(raw.Stmt) + if len(errs) > 0 { + if failfast { + return nil, errs[0] + } + errors = append(errors, errs...) + } + refs = uniqueParamRefs(refs, dollar) + if c.conf.Engine == config.EngineMySQL || !dollar { + sort.Slice(refs, func(i, j int) bool { return refs[i].ref.Location < refs[j].ref.Location }) + } else { + sort.Slice(refs, func(i, j int) bool { return refs[i].ref.Number < refs[j].ref.Number }) + } + raw, embeds := rewrite.Embeds(raw) + qc, err := c.buildQueryCatalog(c.catalog, raw.Stmt, embeds) + if err := check(err); err != nil { + return nil, err + } + + params, err := c.resolveCatalogRefs(qc, rvs, refs, namedParams, embeds) + if err := check(err); err != nil { + return nil, err + } + cols, err := c.outputColumns(qc, raw.Stmt) + if err := check(err); err != nil { + return nil, err + } + + expandEdits, err := c.expand(qc, raw) + if check(err); err != nil { + return nil, err + } + edits = append(edits, expandEdits...) + expanded, err := source.Mutate(query, edits) + if err != nil { + return nil, err + } + + var rerr error + if len(errors) > 0 { + rerr = errors[0] + } + + return &analysis{ + Table: table, + Columns: cols, + Parameters: params, + Query: expanded, + Named: namedParams, + }, rerr +} diff --git a/internal/compiler/compile.go b/internal/compiler/compile.go index 5cbfab674a..84fbb20a3c 100644 --- a/internal/compiler/compile.go +++ b/internal/compiler/compile.go @@ -8,10 +8,11 @@ import ( "path/filepath" "strings" - "github.com/sqlc-dev/sqlc/internal/metadata" "github.com/sqlc-dev/sqlc/internal/migrations" "github.com/sqlc-dev/sqlc/internal/multierr" "github.com/sqlc-dev/sqlc/internal/opts" + "github.com/sqlc-dev/sqlc/internal/rpc" + "github.com/sqlc-dev/sqlc/internal/source" "github.com/sqlc-dev/sqlc/internal/sql/ast" "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" @@ -20,11 +21,10 @@ import ( // TODO: Rename this interface Engine type Parser interface { Parse(io.Reader) ([]ast.Statement, error) - CommentSyntax() metadata.CommentSyntax + CommentSyntax() source.CommentSyntax IsReservedKeyword(string) bool } -// end copypasta func (c *Compiler) parseCatalog(schemas []string) error { files, err := sqlpath.Glob(schemas) if err != nil { @@ -38,6 +38,7 @@ func (c *Compiler) parseCatalog(schemas []string) error { continue } contents := migrations.RemoveRollbackStatements(string(blob)) + c.schema = append(c.schema, contents) stmts, err := c.parser.Parse(strings.NewReader(contents)) if err != nil { merr.Add(filename, contents, 0, err) @@ -78,9 +79,6 @@ func (c *Compiler) parseQueries(o opts.Parser) (*Result, error) { } for _, stmt := range stmts { query, err := c.parseQuery(stmt.Raw, src, o) - if err == ErrUnsupportedStatementType { - continue - } if err != nil { var e *sqlerr.Error loc := stmt.Raw.Pos() @@ -88,19 +86,25 @@ func (c *Compiler) parseQueries(o opts.Parser) (*Result, error) { loc = e.Location } merr.Add(filename, src, loc, err) + // If this rpc unauthenticated error bubbles up, then all future parsing/analysis will fail + if errors.Is(err, rpc.ErrUnauthenticated) { + return nil, merr + } continue } - if query.Name != "" { - if _, exists := set[query.Name]; exists { - merr.Add(filename, src, stmt.Raw.Pos(), fmt.Errorf("duplicate query name: %s", query.Name)) + if query == nil { + continue + } + query.Metadata.Filename = filepath.Base(filename) + queryName := query.Metadata.Name + if queryName != "" { + if _, exists := set[queryName]; exists { + merr.Add(filename, src, stmt.Raw.Pos(), fmt.Errorf("duplicate query name: %s", queryName)) continue } - set[query.Name] = struct{}{} - } - query.Filename = filepath.Base(filename) - if query != nil { - q = append(q, query) + set[queryName] = struct{}{} } + q = append(q, query) } } if len(merr.Errs()) > 0 { diff --git a/internal/compiler/engine.go b/internal/compiler/engine.go index 032c1b0ba7..f742bfd999 100644 --- a/internal/compiler/engine.go +++ b/internal/compiler/engine.go @@ -1,40 +1,67 @@ package compiler import ( + "context" "fmt" + "github.com/sqlc-dev/sqlc/internal/analyzer" "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/dbmanager" "github.com/sqlc-dev/sqlc/internal/engine/dolphin" "github.com/sqlc-dev/sqlc/internal/engine/postgresql" + pganalyze "github.com/sqlc-dev/sqlc/internal/engine/postgresql/analyzer" "github.com/sqlc-dev/sqlc/internal/engine/sqlite" "github.com/sqlc-dev/sqlc/internal/opts" "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) type Compiler struct { - conf config.SQL - combo config.CombinedSettings - catalog *catalog.Catalog - parser Parser - result *Result + conf config.SQL + combo config.CombinedSettings + catalog *catalog.Catalog + parser Parser + result *Result + analyzer analyzer.Analyzer + client dbmanager.Client + selector selector + + schema []string } -func NewCompiler(conf config.SQL, combo config.CombinedSettings) *Compiler { +func NewCompiler(conf config.SQL, combo config.CombinedSettings) (*Compiler, error) { c := &Compiler{conf: conf, combo: combo} + + if conf.Database != nil && conf.Database.Managed { + client := dbmanager.NewClient(combo.Global.Servers) + c.client = client + } + switch conf.Engine { case config.EngineSQLite: c.parser = sqlite.NewParser() c.catalog = sqlite.NewCatalog() + c.selector = newSQLiteSelector() case config.EngineMySQL: c.parser = dolphin.NewParser() c.catalog = dolphin.NewCatalog() + c.selector = newDefaultSelector() case config.EnginePostgreSQL: c.parser = postgresql.NewParser() c.catalog = postgresql.NewCatalog() + c.selector = newDefaultSelector() + if conf.Database != nil { + if conf.Analyzer.Database == nil || *conf.Analyzer.Database { + c.analyzer = analyzer.Cached( + pganalyze.New(c.client, *conf.Database), + combo.Global, + *conf.Database, + ) + } + } default: - panic(fmt.Sprintf("unknown engine: %s", conf.Engine)) + return nil, fmt.Errorf("unknown engine: %s", conf.Engine) } - return c + return c, nil } func (c *Compiler) Catalog() *catalog.Catalog { @@ -57,3 +84,12 @@ func (c *Compiler) ParseQueries(queries []string, o opts.Parser) error { func (c *Compiler) Result() *Result { return c.result } + +func (c *Compiler) Close(ctx context.Context) { + if c.analyzer != nil { + c.analyzer.Close(ctx) + } + if c.client != nil { + c.client.Close(ctx) + } +} diff --git a/internal/compiler/expand.go b/internal/compiler/expand.go index 29adfa316a..c60b7618b2 100644 --- a/internal/compiler/expand.go +++ b/internal/compiler/expand.go @@ -2,6 +2,7 @@ package compiler import ( "fmt" + "regexp" "strings" "github.com/sqlc-dev/sqlc/internal/config" @@ -11,6 +12,14 @@ import ( ) func (c *Compiler) expand(qc *QueryCatalog, raw *ast.RawStmt) ([]source.Edit, error) { + // Return early if there are no A_Star nodes to expand + stars := astutils.Search(raw, func(node ast.Node) bool { + _, ok := node.(*ast.A_Star) + return ok + }) + if len(stars.Items) == 0 { + return nil, nil + } list := astutils.Search(raw, func(node ast.Node) bool { switch node.(type) { case *ast.DeleteStmt: @@ -36,14 +45,25 @@ func (c *Compiler) expand(qc *QueryCatalog, raw *ast.RawStmt) ([]source.Edit, er return edits, nil } +var validPostgresIdent = regexp.MustCompile(`^[a-z_][a-z0-9_$]*$`) + func (c *Compiler) quoteIdent(ident string) string { if c.parser.IsReservedKeyword(ident) { return c.quote(ident) } + // SQL identifiers and key words must begin with a letter (a-z, but also + // letters with diacritical marks and non-Latin letters) or an underscore + // (_). Subsequent characters in an identifier or key word can be letters, + // underscores, digits (0-9), or dollar signs ($). + // + // https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS if c.conf.Engine == config.EnginePostgreSQL { // camelCase means the column is also camelCase if strings.ToLower(ident) != ident { - return "\"" + ident + "\"" + return c.quote(ident) + } + if !validPostgresIdent.MatchString(strings.ToLower(ident)) { + return c.quote(ident) } } return ident @@ -129,12 +149,21 @@ func (c *Compiler) expandStmt(qc *QueryCatalog, raw *ast.RawStmt, node ast.Node) if counts[cname] > 1 { cname = tableName + "." + cname } + + // This is important for SQLite in particular which needs to + // wrap jsonb column values with `json(colname)` so they're in a + // publicly usable format (i.e. not jsonb). + cname = c.selector.ColumnExpr(cname, column) cols = append(cols, cname) } } var old []string for _, p := range parts { - old = append(old, c.quoteIdent(p)) + if p == "*" { + old = append(old, p) + } else { + old = append(old, c.quoteIdent(p)) + } } var oldString string @@ -169,5 +198,6 @@ func (c *Compiler) expandStmt(qc *QueryCatalog, raw *ast.RawStmt, node ast.Node) New: strings.Join(cols, ", "), }) } + return edits, nil } diff --git a/internal/compiler/find_params.go b/internal/compiler/find_params.go index 41ffaf8ad7..8199addd33 100644 --- a/internal/compiler/find_params.go +++ b/internal/compiler/find_params.go @@ -7,14 +7,13 @@ import ( "github.com/sqlc-dev/sqlc/internal/sql/astutils" ) -func findParameters(root ast.Node) ([]paramRef, error) { +func findParameters(root ast.Node) ([]paramRef, []error) { refs := make([]paramRef, 0) errors := make([]error, 0) v := paramSearch{seen: make(map[int]struct{}), refs: &refs, errs: &errors} astutils.Walk(v, root) if len(*v.errs) > 0 { - problems := *v.errs - return nil, problems[0] + return refs, *v.errs } else { return refs, nil } @@ -54,10 +53,6 @@ func (l *limitOffset) Pos() int { } func (p paramSearch) Visit(node ast.Node) astutils.Visitor { - if len(*p.errs) > 0 { - return p - } - switch n := node.(type) { case *ast.A_Expr: @@ -200,7 +195,7 @@ func (p paramSearch) Visit(node ast.Node) astutils.Visitor { if n.Sel == nil { p.parent = node } else { - if sel, ok := n.Sel.(*ast.SelectStmt); ok && sel.FromClause != nil { + if sel, ok := n.Sel.(*ast.SelectStmt); ok && sel.FromClause != nil && len(sel.FromClause.Items) > 0 { from := sel.FromClause if schema, ok := from.Items[0].(*ast.RangeVar); ok && schema != nil { p.rangeVar = &ast.RangeVar{ diff --git a/internal/compiler/output_columns.go b/internal/compiler/output_columns.go index 75ff457d63..b0a15e6ac4 100644 --- a/internal/compiler/output_columns.go +++ b/internal/compiler/output_columns.go @@ -4,10 +4,9 @@ import ( "errors" "fmt" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" - "github.com/sqlc-dev/sqlc/internal/sql/ast" "github.com/sqlc-dev/sqlc/internal/sql/astutils" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" "github.com/sqlc-dev/sqlc/internal/sql/lang" "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" ) @@ -58,7 +57,7 @@ func (c *Compiler) outputColumns(qc *QueryCatalog, node ast.Node) ([]*Column, er return nil, err } - var targets *ast.List + targets := &ast.List{} switch n := node.(type) { case *ast.DeleteStmt: targets = n.ReturningList @@ -115,16 +114,8 @@ func (c *Compiler) outputColumns(qc *QueryCatalog, node ast.Node) ([]*Column, er if isUnion { return c.outputColumns(qc, n.Larg) } - case *ast.DoStmt: - targets = &ast.List{} - case *ast.CallStmt: - targets = &ast.List{} - case *ast.TruncateStmt, *ast.RefreshMatViewStmt, *ast.NotifyStmt, *ast.ListenStmt: - targets = &ast.List{} case *ast.UpdateStmt: targets = n.ReturningList - default: - return nil, fmt.Errorf("outputColumns: unsupported node type: %T", n) } var cols []*Column @@ -159,11 +150,11 @@ func (c *Compiler) outputColumns(qc *QueryCatalog, node ast.Node) ([]*Column, er if res.Name != nil { name = *res.Name } - switch { - case lang.IsComparisonOperator(astutils.Join(n.Name, "")): + switch op := astutils.Join(n.Name, ""); { + case lang.IsComparisonOperator(op): // TODO: Generate a name for these operations cols = append(cols, &Column{Name: name, DataType: "bool", NotNull: true}) - case lang.IsMathematicalOperator(astutils.Join(n.Name, "")): + case lang.IsMathematicalOperator(op): cols = append(cols, &Column{Name: name, DataType: "int", NotNull: true}) default: cols = append(cols, &Column{Name: name, DataType: "any", NotNull: false}) @@ -404,7 +395,8 @@ func (c *Compiler) outputColumns(qc *QueryCatalog, node ast.Node) ([]*Column, er continue } for _, f := range n.FromClause.Items { - if res := isTableRequired(f, col, tableRequired); res != tableNotFound { + res := isTableRequired(f, col, tableRequired) + if res != tableNotFound { col.NotNull = res == tableRequired break } @@ -424,10 +416,12 @@ const ( func isTableRequired(n ast.Node, col *Column, prior int) int { switch n := n.(type) { case *ast.RangeVar: - if n.Alias == nil && *n.Relname == col.Table.Name { - return prior + tableMatch := *n.Relname == col.Table.Name + aliasMatch := true + if n.Alias != nil && col.TableAlias != "" { + aliasMatch = *n.Alias.Aliasname == col.TableAlias } - if n.Alias != nil && *n.Alias.Aliasname == col.TableAlias && *n.Relname == col.Table.Name { + if aliasMatch && tableMatch { return prior } case *ast.JoinExpr: @@ -485,7 +479,7 @@ func (r *tableVisitor) Visit(n ast.Node) astutils.Visitor { // Return an error if a table is referenced twice // Return an error if an unknown column is referenced func (c *Compiler) sourceTables(qc *QueryCatalog, node ast.Node) ([]*Table, error) { - var list *ast.List + list := &ast.List{} switch n := node.(type) { case *ast.DeleteStmt: list = n.Relations @@ -508,21 +502,15 @@ func (c *Compiler) sourceTables(qc *QueryCatalog, node ast.Node) ([]*Table, erro return ok }) case *ast.UpdateStmt: - list = &ast.List{ - Items: append(n.FromClause.Items, n.Relations.Items...), - } - case *ast.DoStmt: - list = &ast.List{} - case *ast.CallStmt: - list = &ast.List{} - case *ast.NotifyStmt, *ast.ListenStmt: - list = &ast.List{} - default: - return nil, fmt.Errorf("sourceTables: unsupported node type: %T", n) + var tv tableVisitor + astutils.Walk(&tv, n.FromClause) + astutils.Walk(&tv, n.Relations) + list = &tv.list } var tables []*Table for _, item := range list.Items { + item := item switch n := item.(type) { case *ast.RangeFunction: @@ -549,22 +537,51 @@ func (c *Compiler) sourceTables(qc *QueryCatalog, node ast.Node) ([]*Table, erro if err != nil { continue } - table, err := qc.GetTable(&ast.TableName{ - Catalog: fn.ReturnType.Catalog, - Schema: fn.ReturnType.Schema, - Name: fn.ReturnType.Name, - }) - if err != nil { - if n.Alias == nil || len(n.Alias.Colnames.Items) == 0 { - continue - } - - table = &Table{} - for _, colName := range n.Alias.Colnames.Items { - table.Columns = append(table.Columns, &Column{ - Name: colName.(*ast.String).Str, - DataType: "any", - }) + var table *Table + if fn.ReturnType != nil { + table, err = qc.GetTable(&ast.TableName{ + Catalog: fn.ReturnType.Catalog, + Schema: fn.ReturnType.Schema, + Name: fn.ReturnType.Name, + }) + } + if table == nil || err != nil { + if n.Alias != nil && len(n.Alias.Colnames.Items) > 0 { + table = &Table{} + for _, colName := range n.Alias.Colnames.Items { + table.Columns = append(table.Columns, &Column{ + Name: colName.(*ast.String).Str, + DataType: "any", + }) + } + } else { + colName := fn.Rel.Name + if n.Alias != nil { + colName = *n.Alias.Aliasname + } + table = &Table{ + Rel: &ast.TableName{ + Catalog: fn.Rel.Catalog, + Schema: fn.Rel.Schema, + Name: fn.Rel.Name, + }, + } + if len(fn.Outs) > 0 { + for _, arg := range fn.Outs { + table.Columns = append(table.Columns, &Column{ + Name: arg.Name, + DataType: arg.Type.Name, + }) + } + } + if fn.ReturnType != nil { + table.Columns = []*Column{ + { + Name: colName, + DataType: fn.ReturnType.Name, + }, + } + } } } if n.Alias != nil { @@ -579,9 +596,15 @@ func (c *Compiler) sourceTables(qc *QueryCatalog, node ast.Node) ([]*Table, erro if err != nil { return nil, err } + + var tableName string + if n.Alias != nil { + tableName = *n.Alias.Aliasname + } + tables = append(tables, &Table{ Rel: &ast.TableName{ - Name: *n.Alias.Aliasname, + Name: tableName, }, Columns: cols, }) @@ -591,6 +614,9 @@ func (c *Compiler) sourceTables(qc *QueryCatalog, node ast.Node) ([]*Table, erro if err != nil { return nil, err } + if qc == nil { + return nil, fmt.Errorf("query catalog is empty") + } table, cerr := qc.GetTable(fqn) if cerr != nil { // TODO: Update error location @@ -640,13 +666,13 @@ func outputColumnRefs(res *ast.ResTarget, tables []*Table, node *ast.ColumnRef) continue } for _, c := range t.Columns { + if c.Name == name { found += 1 cname := c.Name if res.Name != nil { cname = *res.Name } - cols = append(cols, &Column{ Name: cname, Type: c.Type, diff --git a/internal/compiler/parse.go b/internal/compiler/parse.go index c660ef4fb4..681d291122 100644 --- a/internal/compiler/parse.go +++ b/internal/compiler/parse.go @@ -1,63 +1,38 @@ package compiler import ( + "context" "errors" "fmt" - "sort" "strings" - "github.com/sqlc-dev/sqlc/internal/config" "github.com/sqlc-dev/sqlc/internal/debug" "github.com/sqlc-dev/sqlc/internal/metadata" "github.com/sqlc-dev/sqlc/internal/opts" "github.com/sqlc-dev/sqlc/internal/source" "github.com/sqlc-dev/sqlc/internal/sql/ast" "github.com/sqlc-dev/sqlc/internal/sql/astutils" - "github.com/sqlc-dev/sqlc/internal/sql/rewrite" "github.com/sqlc-dev/sqlc/internal/sql/validate" ) -var ErrUnsupportedStatementType = errors.New("parseQuery: unsupported statement type") - func (c *Compiler) parseQuery(stmt ast.Node, src string, o opts.Parser) (*Query, error) { + ctx := context.Background() + if o.Debug.DumpAST { debug.Dump(stmt) } - if err := validate.ParamStyle(stmt); err != nil { - return nil, err - } - numbers, dollar, err := validate.ParamRef(stmt) - if err != nil { + + // validate sqlc-specific syntax + if err := validate.SqlcFunctions(stmt); err != nil { return nil, err } + + // rewrite queries to remove sqlc.* functions + raw, ok := stmt.(*ast.RawStmt) if !ok { return nil, errors.New("node is not a statement") } - var table *ast.TableName - switch n := raw.Stmt.(type) { - case *ast.CallStmt: - case *ast.SelectStmt: - case *ast.DeleteStmt: - case *ast.DoStmt: - case *ast.InsertStmt: - if err := validate.InsertStmt(n); err != nil { - return nil, err - } - var err error - table, err = ParseTableName(n.Relation) - if err != nil { - return nil, err - } - case *ast.ListenStmt: - case *ast.NotifyStmt: - case *ast.TruncateStmt: - case *ast.UpdateStmt: - case *ast.RefreshMatViewStmt: - default: - return nil, ErrUnsupportedStatementType - } - rawSQL, err := source.Pluck(src, raw.StmtLocation, raw.StmtLen) if err != nil { return nil, err @@ -65,56 +40,74 @@ func (c *Compiler) parseQuery(stmt ast.Node, src string, o opts.Parser) (*Query, if rawSQL == "" { return nil, errors.New("missing semicolon at end of file") } - if err := validate.FuncCall(c.catalog, c.combo, raw); err != nil { - return nil, err - } - if err := validate.In(c.catalog, raw); err != nil { - return nil, err - } - name, cmd, err := metadata.ParseQueryNameAndType(strings.TrimSpace(rawSQL), c.parser.CommentSyntax()) - if err != nil { - return nil, err - } - raw, namedParams, edits := rewrite.NamedParameters(c.conf.Engine, raw, numbers, dollar) - if err := validate.Cmd(raw.Stmt, name, cmd); err != nil { - return nil, err - } - rvs := rangeVars(raw.Stmt) - refs, err := findParameters(raw.Stmt) + + name, cmd, err := metadata.ParseQueryNameAndType(rawSQL, metadata.CommentSyntax(c.parser.CommentSyntax())) if err != nil { return nil, err } - refs = uniqueParamRefs(refs, dollar) - if c.conf.Engine == config.EngineMySQL || !dollar { - sort.Slice(refs, func(i, j int) bool { return refs[i].ref.Location < refs[j].ref.Location }) - } else { - sort.Slice(refs, func(i, j int) bool { return refs[i].ref.Number < refs[j].ref.Number }) + + if name == "" { + return nil, nil } - raw, embeds := rewrite.Embeds(raw) - qc, err := c.buildQueryCatalog(c.catalog, raw.Stmt, embeds) - if err != nil { + + if err := validate.Cmd(raw.Stmt, name, cmd); err != nil { return nil, err } - params, err := c.resolveCatalogRefs(qc, rvs, refs, namedParams, embeds) - if err != nil { - return nil, err + md := metadata.Metadata{ + Name: name, + Cmd: cmd, } - cols, err := c.outputColumns(qc, raw.Stmt) + + // TODO eventually can use this for name and type/cmd parsing too + cleanedComments, err := source.CleanedComments(rawSQL, c.parser.CommentSyntax()) if err != nil { return nil, err } - expandEdits, err := c.expand(qc, raw) + md.Params, md.Flags, md.RuleSkiplist, err = metadata.ParseCommentFlags(cleanedComments) if err != nil { return nil, err } - edits = append(edits, expandEdits...) - expanded, err := source.Mutate(rawSQL, edits) - if err != nil { - return nil, err + + var anlys *analysis + if c.analyzer != nil { + inference, _ := c.inferQuery(raw, rawSQL) + if inference == nil { + inference = &analysis{} + } + if inference.Query == "" { + inference.Query = rawSQL + } + + result, err := c.analyzer.Analyze(ctx, raw, inference.Query, c.schema, inference.Named) + if err != nil { + return nil, err + } + + // If the query uses star expansion, verify that it was edited. If not, + // return an error. + stars := astutils.Search(raw, func(node ast.Node) bool { + _, ok := node.(*ast.A_Star) + return ok + }) + hasStars := len(stars.Items) > 0 + unchanged := inference.Query == rawSQL + if unchanged && hasStars { + return nil, fmt.Errorf("star expansion failed for query") + } + + // FOOTGUN: combineAnalysis mutates inference + anlys = combineAnalysis(inference, result) + } else { + anlys, err = c.analyzeQuery(raw, rawSQL) + if err != nil { + return nil, err + } } + expanded := anlys.Query + // If the query string was edited, make sure the syntax is valid if expanded != rawSQL { if _, err := c.parser.Parse(strings.NewReader(expanded)); err != nil { @@ -127,21 +120,15 @@ func (c *Compiler) parseQuery(stmt ast.Node, src string, o opts.Parser) (*Query, return nil, err } - flags, err := metadata.ParseQueryFlags(comments) - if err != nil { - return nil, err - } + md.Comments = comments return &Query{ RawStmt: raw, - Cmd: cmd, - Comments: comments, - Name: name, - Flags: flags, - Params: params, - Columns: cols, + Metadata: md, + Params: anlys.Parameters, + Columns: anlys.Columns, SQL: trimmed, - InsertIntoTable: table, + InsertIntoTable: anlys.Table, }, nil } diff --git a/internal/compiler/query.go b/internal/compiler/query.go index 117cf44813..b3cf9d6154 100644 --- a/internal/compiler/query.go +++ b/internal/compiler/query.go @@ -1,12 +1,15 @@ package compiler import ( + "github.com/sqlc-dev/sqlc/internal/metadata" "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) type Function struct { Rel *ast.FuncName ReturnType *ast.TypeName + Outs []*catalog.Argument } type Table struct { @@ -41,15 +44,9 @@ type Column struct { type Query struct { SQL string - Name string - Cmd string // TODO: Pick a better name. One of: one, many, exec, execrows, copyFrom - Flags map[string]bool + Metadata metadata.Metadata Columns []*Column Params []Parameter - Comments []string - - // XXX: Hack - Filename string // Needed for CopyFrom InsertIntoTable *ast.TableName diff --git a/internal/compiler/query_catalog.go b/internal/compiler/query_catalog.go index ea1190c0de..80b59d876c 100644 --- a/internal/compiler/query_catalog.go +++ b/internal/compiler/query_catalog.go @@ -36,9 +36,22 @@ func (comp *Compiler) buildQueryCatalog(c *catalog.Catalog, node ast.Node, embed if err != nil { return nil, err } + var names []string + if cte.Aliascolnames != nil { + for _, item := range cte.Aliascolnames.Items { + if val, ok := item.(*ast.String); ok { + names = append(names, val.Str) + } else { + names = append(names, "") + } + } + } rel := &ast.TableName{Name: *cte.Ctename} for i := range cols { cols[i].Table = rel + if len(names) > i { + cols[i].Name = names[i] + } } qc.ctes[*cte.Ctename] = &Table{ Rel: rel, @@ -67,7 +80,7 @@ func ConvertColumn(rel *ast.TableName, c *catalog.Column) *Column { func (qc QueryCatalog) GetTable(rel *ast.TableName) (*Table, error) { cte, exists := qc.ctes[rel.Name] if exists { - return cte, nil + return &Table{Rel: rel, Columns: cte.Columns}, nil } src, err := qc.catalog.GetTable(rel) if err != nil { @@ -90,6 +103,7 @@ func (qc QueryCatalog) GetFunc(rel *ast.FuncName) (*Function, error) { } return &Function{ Rel: rel, + Outs: funcs[0].OutArgs(), ReturnType: funcs[0].ReturnType, }, nil } diff --git a/internal/compiler/resolve.go b/internal/compiler/resolve.go index 0a91b45f25..b1fbb1990e 100644 --- a/internal/compiler/resolve.go +++ b/internal/compiler/resolve.go @@ -2,6 +2,7 @@ package compiler import ( "fmt" + "log/slog" "strconv" "github.com/sqlc-dev/sqlc/internal/sql/ast" @@ -62,7 +63,10 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, } table, err := c.GetTable(fqn) if err != nil { - // If the table name doesn't exist, fisrt check if it's a CTE + if qc == nil { + continue + } + // If the table name doesn't exist, first check if it's a CTE if _, qcerr := qc.GetTable(fqn); qcerr != nil { return nil, err } @@ -94,6 +98,20 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, } var a []Parameter + + addUnknownParam := func(ref paramRef) { + defaultP := named.NewInferredParam(ref.name, false) + p, isNamed := params.FetchMerge(ref.ref.Number, defaultP) + a = append(a, Parameter{ + Number: ref.ref.Number, + Column: &Column{ + Name: p.Name(), + DataType: "any", + IsNamedParam: isNamed, + }, + }) + } + for _, ref := range args { switch n := ref.parent.(type) { @@ -141,7 +159,7 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, // TODO: Move this to database-specific engine package dataType := "any" if astutils.Join(n.Name, ".") == "||" { - dataType = "string" + dataType = "text" } defaultP := named.NewParam("") @@ -169,6 +187,10 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, case 2: alias = items[0] key = items[1] + case 3: + // schema := items[0] + alias = items[1] + key = items[2] default: panic("too many field items: " + strconv.Itoa(len(items))) } @@ -310,6 +332,8 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, ReturnType: &ast.TypeName{Name: "any"}, } } + + var added bool for i, item := range n.Args.Items { funcName := fun.Name var argName string @@ -349,6 +373,7 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, defaultP := named.NewInferredParam(defaultName, false) p, isNamed := params.FetchMerge(ref.ref.Number, defaultP) + added = true a = append(a, Parameter{ Number: ref.ref.Number, Column: &Column{ @@ -390,6 +415,7 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, defaultP := named.NewInferredParam(paramName, true) p, isNamed := params.FetchMerge(ref.ref.Number, defaultP) + added = true a = append(a, Parameter{ Number: ref.ref.Number, Column: &Column{ @@ -403,6 +429,9 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, } if fun.ReturnType == nil { + if !added { + addUnknownParam(ref) + } continue } @@ -412,7 +441,9 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, Name: fun.ReturnType.Name, }) if err != nil { - // The return type wasn't a table. + if !added { + addUnknownParam(ref) + } continue } err = indexTable(table) @@ -580,8 +611,6 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, }) } } - } else { - fmt.Println("------------------------") } if found == 0 { @@ -600,7 +629,8 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, } default: - fmt.Printf("unsupported reference type: %T\n", n) + slog.Debug("unsupported reference type", "type", fmt.Sprintf("%T", n)) + addUnknownParam(ref) } } return a, nil diff --git a/internal/compiler/selector.go b/internal/compiler/selector.go new file mode 100644 index 0000000000..04d118ff9c --- /dev/null +++ b/internal/compiler/selector.go @@ -0,0 +1,46 @@ +package compiler + +// selector is an interface used by a compiler for generating expressions for +// output columns in a `SELECT ...` or `RETURNING ...` statement. +// +// This interface is exclusively needed at the moment for SQLite, which must +// wrap output `jsonb` columns with a `json(column_name)` invocation so that a +// publicly consumable format (i.e. not jsonb) is returned. +type selector interface { + // ColumnExpr generates output to be used in a `SELECT ...` or `RETURNING + // ...` statement based on input column name and metadata. + ColumnExpr(name string, column *Column) string +} + +// defaultSelector is a selector implementation that does the simpliest possible +// pass through when generating column expressions. Its use is suitable for all +// database engines not requiring additional customization. +type defaultSelector struct{} + +func newDefaultSelector() *defaultSelector { + return &defaultSelector{} +} + +func (s *defaultSelector) ColumnExpr(name string, column *Column) string { + return name +} + +type sqliteSelector struct{} + +func newSQLiteSelector() *sqliteSelector { + return &sqliteSelector{} +} + +func (s *sqliteSelector) ColumnExpr(name string, column *Column) string { + // Under SQLite, neither json nor jsonb are real data types, and rather just + // of type blob, so database drivers just return whatever raw binary is + // stored as values. This is a problem for jsonb, which is considered an + // internal format to SQLite and no attempt should be made to parse it + // outside of the database itself. For jsonb columns in SQLite, wrap values + // in `json(col)` to coerce the internal binary format to JSON parsable by + // the user-space application. + if column.DataType == "jsonb" { + return "json(" + name + ")" + } + return name +} diff --git a/internal/compiler/selector_test.go b/internal/compiler/selector_test.go new file mode 100644 index 0000000000..e460dd281c --- /dev/null +++ b/internal/compiler/selector_test.go @@ -0,0 +1,35 @@ +package compiler + +import "testing" + +func TestSelector(t *testing.T) { + t.Parallel() + + selectorExpectColumnExpr := func(t *testing.T, selector selector, expected, name string, column *Column) { + if actual := selector.ColumnExpr(name, column); expected != actual { + t.Errorf("Expected %v, got %v for data type %v", expected, actual, column.DataType) + } + } + + t.Run("DefaultSelectorColumnExpr", func(t *testing.T) { + t.Parallel() + + selector := newDefaultSelector() + + selectorExpectColumnExpr(t, selector, "my_column", "my_column", &Column{DataType: "integer"}) + selectorExpectColumnExpr(t, selector, "my_column", "my_column", &Column{DataType: "json"}) + selectorExpectColumnExpr(t, selector, "my_column", "my_column", &Column{DataType: "jsonb"}) + selectorExpectColumnExpr(t, selector, "my_column", "my_column", &Column{DataType: "text"}) + }) + + t.Run("SQLiteSelectorColumnExpr", func(t *testing.T) { + t.Parallel() + + selector := newSQLiteSelector() + + selectorExpectColumnExpr(t, selector, "my_column", "my_column", &Column{DataType: "integer"}) + selectorExpectColumnExpr(t, selector, "my_column", "my_column", &Column{DataType: "json"}) + selectorExpectColumnExpr(t, selector, "json(my_column)", "my_column", &Column{DataType: "jsonb"}) + selectorExpectColumnExpr(t, selector, "my_column", "my_column", &Column{DataType: "text"}) + }) +} diff --git a/internal/config/config.go b/internal/config/config.go index 4a17903e6e..0ff805fccd 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -7,6 +7,8 @@ import ( "io" "gopkg.in/yaml.v3" + + golang "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" ) type versionSetting struct { @@ -55,12 +57,20 @@ const ( ) type Config struct { - Version string `json:"version" yaml:"version"` - Cloud Cloud `json:"cloud" yaml:"cloud"` - SQL []SQL `json:"sql" yaml:"sql"` - Gen Gen `json:"overrides,omitempty" yaml:"overrides"` - Plugins []Plugin `json:"plugins" yaml:"plugins"` - Rules []Rule `json:"rules" yaml:"rules"` + Version string `json:"version" yaml:"version"` + Cloud Cloud `json:"cloud" yaml:"cloud"` + Servers []Server `json:"servers" yaml:"servers"` + SQL []SQL `json:"sql" yaml:"sql"` + Overrides Overrides `json:"overrides,omitempty" yaml:"overrides"` + Plugins []Plugin `json:"plugins" yaml:"plugins"` + Rules []Rule `json:"rules" yaml:"rules"` + Options map[string]yaml.Node `json:"options" yaml:"options"` +} + +type Server struct { + Name string `json:"name,omitempty" yaml:"name"` + Engine Engine `json:"engine,omitempty" yaml:"engine"` + URI string `json:"uri" yaml:"uri"` } type Database struct { @@ -72,13 +82,15 @@ type Cloud struct { Organization string `json:"organization" yaml:"organization"` Project string `json:"project" yaml:"project"` Hostname string `json:"hostname" yaml:"hostname"` + AuthToken string `json:"-" yaml:"-"` } type Plugin struct { Name string `json:"name" yaml:"name"` Env []string `json:"env" yaml:"env"` Process *struct { - Cmd string `json:"cmd" yaml:"cmd"` + Cmd string `json:"cmd" yaml:"cmd"` + Format string `json:"format" yaml:"format"` } `json:"process" yaml:"process"` WASM *struct { URL string `json:"url" yaml:"url"` @@ -92,16 +104,12 @@ type Rule struct { Msg string `json:"message" yaml:"message"` } -type Gen struct { - Go *GenGo `json:"go,omitempty" yaml:"go"` -} - -type GenGo struct { - Overrides []Override `json:"overrides,omitempty" yaml:"overrides"` - Rename map[string]string `json:"rename,omitempty" yaml:"rename"` +type Overrides struct { + Go *golang.GlobalOptions `json:"go,omitempty" yaml:"go"` } type SQL struct { + Name string `json:"name" yaml:"name"` Engine Engine `json:"engine,omitempty" yaml:"engine"` Schema Paths `json:"schema" yaml:"schema"` Queries Paths `json:"queries" yaml:"queries"` @@ -111,6 +119,11 @@ type SQL struct { Gen SQLGen `json:"gen" yaml:"gen"` Codegen []Codegen `json:"codegen" yaml:"codegen"` Rules []string `json:"rules" yaml:"rules"` + Analyzer Analyzer `json:"analyzer" yaml:"analyzer"` +} + +type Analyzer struct { + Database *bool `json:"database" yaml:"database"` } // TODO: Figure out a better name for this @@ -121,41 +134,8 @@ type Codegen struct { } type SQLGen struct { - Go *SQLGo `json:"go,omitempty" yaml:"go"` - JSON *SQLJSON `json:"json,omitempty" yaml:"json"` -} - -type SQLGo struct { - EmitInterface bool `json:"emit_interface" yaml:"emit_interface"` - EmitJSONTags bool `json:"emit_json_tags" yaml:"emit_json_tags"` - JsonTagsIDUppercase bool `json:"json_tags_id_uppercase" yaml:"json_tags_id_uppercase"` - EmitDBTags bool `json:"emit_db_tags" yaml:"emit_db_tags"` - EmitPreparedQueries bool `json:"emit_prepared_queries" yaml:"emit_prepared_queries"` - EmitExactTableNames bool `json:"emit_exact_table_names,omitempty" yaml:"emit_exact_table_names"` - EmitEmptySlices bool `json:"emit_empty_slices,omitempty" yaml:"emit_empty_slices"` - EmitExportedQueries bool `json:"emit_exported_queries" yaml:"emit_exported_queries"` - EmitResultStructPointers bool `json:"emit_result_struct_pointers" yaml:"emit_result_struct_pointers"` - EmitParamsStructPointers bool `json:"emit_params_struct_pointers" yaml:"emit_params_struct_pointers"` - EmitMethodsWithDBArgument bool `json:"emit_methods_with_db_argument,omitempty" yaml:"emit_methods_with_db_argument"` - EmitPointersForNullTypes bool `json:"emit_pointers_for_null_types" yaml:"emit_pointers_for_null_types"` - EmitEnumValidMethod bool `json:"emit_enum_valid_method,omitempty" yaml:"emit_enum_valid_method"` - EmitAllEnumValues bool `json:"emit_all_enum_values,omitempty" yaml:"emit_all_enum_values"` - JSONTagsCaseStyle string `json:"json_tags_case_style,omitempty" yaml:"json_tags_case_style"` - Package string `json:"package" yaml:"package"` - Out string `json:"out" yaml:"out"` - Overrides []Override `json:"overrides,omitempty" yaml:"overrides"` - Rename map[string]string `json:"rename,omitempty" yaml:"rename"` - SQLPackage string `json:"sql_package" yaml:"sql_package"` - SQLDriver string `json:"sql_driver" yaml:"sql_driver"` - OutputBatchFileName string `json:"output_batch_file_name,omitempty" yaml:"output_batch_file_name"` - OutputDBFileName string `json:"output_db_file_name,omitempty" yaml:"output_db_file_name"` - OutputModelsFileName string `json:"output_models_file_name,omitempty" yaml:"output_models_file_name"` - OutputQuerierFileName string `json:"output_querier_file_name,omitempty" yaml:"output_querier_file_name"` - OutputCopyFromFileName string `json:"output_copyfrom_file_name,omitempty" yaml:"output_copyfrom_file_name"` - OutputFilesSuffix string `json:"output_files_suffix,omitempty" yaml:"output_files_suffix"` - InflectionExcludeTableNames []string `json:"inflection_exclude_table_names,omitempty" yaml:"inflection_exclude_table_names"` - QueryParameterLimit *int32 `json:"query_parameter_limit,omitempty" yaml:"query_parameter_limit"` - OmitUnusedStructs bool `json:"omit_unused_structs,omitempty" yaml:"omit_unused_structs"` + Go *golang.Options `json:"go,omitempty" yaml:"go"` + JSON *SQLJSON `json:"json,omitempty" yaml:"json"` } type SQLJSON struct { @@ -167,22 +147,34 @@ type SQLJSON struct { var ErrMissingEngine = errors.New("unknown engine") var ErrMissingVersion = errors.New("no version number") var ErrNoOutPath = errors.New("no output path") -var ErrNoPackageName = errors.New("missing package name") var ErrNoPackagePath = errors.New("missing package path") var ErrNoPackages = errors.New("no packages") var ErrNoQuerierType = errors.New("no querier emit type enabled") var ErrUnknownEngine = errors.New("invalid engine") var ErrUnknownVersion = errors.New("invalid version number") -var ErrInvalidQueryParameterLimit = errors.New("invalid query parameter limit") var ErrPluginBuiltin = errors.New("a built-in plugin with that name already exists") var ErrPluginNoName = errors.New("missing plugin name") var ErrPluginExists = errors.New("a plugin with that name already exists") var ErrPluginNotFound = errors.New("no plugin found") var ErrPluginNoType = errors.New("plugin: field `process` or `wasm` required") -var ErrPluginBothTypes = errors.New("plugin: both `process` and `wasm` cannot both be defined") +var ErrPluginBothTypes = errors.New("plugin: `process` and `wasm` cannot both be defined") var ErrPluginProcessNoCmd = errors.New("plugin: missing process command") +var ErrInvalidDatabase = errors.New("database must be managed or have a non-empty URI") +var ErrManagedDatabaseNoProject = errors.New(`managed databases require a cloud project + +If you don't have a project, you can create one from the sqlc Cloud +dashboard at https://dashboard.sqlc.dev/. If you have a project, ensure +you've set its id as the value of the "project" field within the "cloud" +section of your sqlc configuration. The id will look similar to +"01HA8TWGMYPHK0V2GGMB3R2TP9".`) +var ErrManagedDatabaseNoAuthToken = errors.New(`managed databases require an auth token + +If you don't have an auth token, you can create one from the sqlc Cloud +dashboard at https://dashboard.sqlc.dev/. If you have an auth token, ensure +you've set it as the value of the SQLC_AUTH_TOKEN environment variable.`) + func ParseConfig(rd io.Reader) (Config, error) { var buf bytes.Buffer var config Config @@ -196,23 +188,33 @@ func ParseConfig(rd io.Reader) (Config, error) { if version.Number == "" { return config, ErrMissingVersion } + var err error switch version.Number { case "1": - return v1ParseConfig(&buf) + config, err = v1ParseConfig(&buf) + if err != nil { + return config, err + } case "2": - return v2ParseConfig(&buf) + config, err = v2ParseConfig(&buf) + if err != nil { + return config, err + } default: return config, ErrUnknownVersion } + err = config.addEnvVars() + if err != nil { + return config, err + } + return config, nil } type CombinedSettings struct { - Global Config - Package SQL - Go SQLGo - JSON SQLJSON - Rename map[string]string - Overrides []Override + Global Config + Package SQL + Go golang.Options + JSON SQLJSON // TODO: Combine these into a more usable type Codegen Codegen @@ -222,20 +224,9 @@ func Combine(conf Config, pkg SQL) CombinedSettings { cs := CombinedSettings{ Global: conf, Package: pkg, - Rename: map[string]string{}, - } - if conf.Gen.Go != nil { - for k, v := range conf.Gen.Go.Rename { - cs.Rename[k] = v - } - cs.Overrides = append(cs.Overrides, conf.Gen.Go.Overrides...) } if pkg.Gen.Go != nil { cs.Go = *pkg.Gen.Go - for k, v := range pkg.Gen.Go.Rename { - cs.Rename[k] = v - } - cs.Overrides = append(cs.Overrides, pkg.Gen.Go.Overrides...) } if pkg.Gen.JSON != nil { cs.JSON = *pkg.Gen.JSON diff --git a/internal/config/config_test.go b/internal/config/config_test.go index d643eeb9f0..57211d674c 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -79,124 +79,13 @@ func FuzzConfig(f *testing.F) { func TestInvalidConfig(t *testing.T) { err := Validate(&Config{ SQL: []SQL{{ - Gen: SQLGen{ - Go: &SQLGo{ - EmitMethodsWithDBArgument: true, - EmitPreparedQueries: true, - }, + Database: &Database{ + URI: "", + Managed: false, }, - }}}) + }}, + }) if err == nil { t.Errorf("expected err; got nil") } } - -func TestTypeOverrides(t *testing.T) { - for _, test := range []struct { - override Override - pkg string - typeName string - basic bool - }{ - { - Override{ - DBType: "uuid", - GoType: GoType{Spec: "github.com/segmentio/ksuid.KSUID"}, - }, - "github.com/segmentio/ksuid", - "ksuid.KSUID", - false, - }, - // TODO: Add test for struct pointers - // - // { - // Override{ - // DBType: "uuid", - // GoType: "github.com/segmentio/*ksuid.KSUID", - // }, - // "github.com/segmentio/ksuid", - // "*ksuid.KSUID", - // false, - // }, - { - Override{ - DBType: "citext", - GoType: GoType{Spec: "string"}, - }, - "", - "string", - true, - }, - { - Override{ - DBType: "timestamp", - GoType: GoType{Spec: "time.Time"}, - }, - "time", - "time.Time", - false, - }, - } { - tt := test - t.Run(tt.override.GoType.Spec, func(t *testing.T) { - if err := tt.override.Parse(); err != nil { - t.Fatalf("override parsing failed; %s", err) - } - if diff := cmp.Diff(tt.pkg, tt.override.GoImportPath); diff != "" { - t.Errorf("package mismatch;\n%s", diff) - } - if diff := cmp.Diff(tt.typeName, tt.override.GoTypeName); diff != "" { - t.Errorf("type name mismatch;\n%s", diff) - } - if diff := cmp.Diff(tt.basic, tt.override.GoBasicType); diff != "" { - t.Errorf("basic mismatch;\n%s", diff) - } - }) - } - for _, test := range []struct { - override Override - err string - }{ - { - Override{ - DBType: "uuid", - GoType: GoType{Spec: "Pointer"}, - }, - "Package override `go_type` specifier \"Pointer\" is not a Go basic type e.g. 'string'", - }, - { - Override{ - DBType: "uuid", - GoType: GoType{Spec: "untyped rune"}, - }, - "Package override `go_type` specifier \"untyped rune\" is not a Go basic type e.g. 'string'", - }, - } { - tt := test - t.Run(tt.override.GoType.Spec, func(t *testing.T) { - err := tt.override.Parse() - if err == nil { - t.Fatalf("expected parse to fail; got nil") - } - if diff := cmp.Diff(tt.err, err.Error()); diff != "" { - t.Errorf("error mismatch;\n%s", diff) - } - }) - } -} - -func FuzzOverride(f *testing.F) { - for _, spec := range []string{ - "string", - "github.com/gofrs/uuid.UUID", - "github.com/segmentio/ksuid.KSUID", - } { - f.Add(spec) - } - f.Fuzz(func(t *testing.T, s string) { - o := Override{ - GoType: GoType{Spec: s}, - } - o.Parse() - }) -} diff --git a/internal/config/env.go b/internal/config/env.go new file mode 100644 index 0000000000..0c608aa232 --- /dev/null +++ b/internal/config/env.go @@ -0,0 +1,17 @@ +package config + +import ( + "fmt" + "os" + "strings" +) + +func (c *Config) addEnvVars() error { + authToken := os.Getenv("SQLC_AUTH_TOKEN") + if authToken != "" && !strings.HasPrefix(authToken, "sqlc_") { + return fmt.Errorf("$SQLC_AUTH_TOKEN doesn't start with \"sqlc_\"") + } + c.Cloud.AuthToken = authToken + + return nil +} diff --git a/internal/config/python_type.go b/internal/config/python_type.go deleted file mode 100644 index e908448057..0000000000 --- a/internal/config/python_type.go +++ /dev/null @@ -1,17 +0,0 @@ -package config - -type PythonType struct { - Module string `json:"module" yaml:"module"` - Name string `json:"name" yaml:"name"` -} - -func (t PythonType) IsSet() bool { - return t.Module != "" || t.Name != "" -} - -func (t PythonType) TypeString() string { - if t.Name != "" && t.Module == "" { - return t.Name - } - return t.Module + "." + t.Name -} diff --git a/internal/config/v_one.go b/internal/config/v_one.go index 3d2a53f13a..8efa9f42fc 100644 --- a/internal/config/v_one.go +++ b/internal/config/v_one.go @@ -6,53 +6,59 @@ import ( "path/filepath" yaml "gopkg.in/yaml.v3" + + golang "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" ) type V1GenerateSettings struct { Version string `json:"version" yaml:"version"` Cloud Cloud `json:"cloud" yaml:"cloud"` Packages []v1PackageSettings `json:"packages" yaml:"packages"` - Overrides []Override `json:"overrides,omitempty" yaml:"overrides,omitempty"` + Overrides []golang.Override `json:"overrides,omitempty" yaml:"overrides,omitempty"` Rename map[string]string `json:"rename,omitempty" yaml:"rename,omitempty"` Rules []Rule `json:"rules" yaml:"rules"` } type v1PackageSettings struct { - Name string `json:"name" yaml:"name"` - Engine Engine `json:"engine,omitempty" yaml:"engine"` - Database *Database `json:"database,omitempty" yaml:"database"` - Path string `json:"path" yaml:"path"` - Schema Paths `json:"schema" yaml:"schema"` - Queries Paths `json:"queries" yaml:"queries"` - EmitInterface bool `json:"emit_interface" yaml:"emit_interface"` - EmitJSONTags bool `json:"emit_json_tags" yaml:"emit_json_tags"` - JsonTagsIDUppercase bool `json:"json_tags_id_uppercase" yaml:"json_tags_id_uppercase"` - EmitDBTags bool `json:"emit_db_tags" yaml:"emit_db_tags"` - EmitPreparedQueries bool `json:"emit_prepared_queries" yaml:"emit_prepared_queries"` - EmitExactTableNames bool `json:"emit_exact_table_names,omitempty" yaml:"emit_exact_table_names"` - EmitEmptySlices bool `json:"emit_empty_slices,omitempty" yaml:"emit_empty_slices"` - EmitExportedQueries bool `json:"emit_exported_queries,omitempty" yaml:"emit_exported_queries"` - EmitResultStructPointers bool `json:"emit_result_struct_pointers" yaml:"emit_result_struct_pointers"` - EmitParamsStructPointers bool `json:"emit_params_struct_pointers" yaml:"emit_params_struct_pointers"` - EmitMethodsWithDBArgument bool `json:"emit_methods_with_db_argument" yaml:"emit_methods_with_db_argument"` - EmitPointersForNullTypes bool `json:"emit_pointers_for_null_types" yaml:"emit_pointers_for_null_types"` - EmitEnumValidMethod bool `json:"emit_enum_valid_method,omitempty" yaml:"emit_enum_valid_method"` - EmitAllEnumValues bool `json:"emit_all_enum_values,omitempty" yaml:"emit_all_enum_values"` - JSONTagsCaseStyle string `json:"json_tags_case_style,omitempty" yaml:"json_tags_case_style"` - SQLPackage string `json:"sql_package" yaml:"sql_package"` - SQLDriver string `json:"sql_driver" yaml:"sql_driver"` - Overrides []Override `json:"overrides" yaml:"overrides"` - OutputBatchFileName string `json:"output_batch_file_name,omitempty" yaml:"output_batch_file_name"` - OutputDBFileName string `json:"output_db_file_name,omitempty" yaml:"output_db_file_name"` - OutputModelsFileName string `json:"output_models_file_name,omitempty" yaml:"output_models_file_name"` - OutputQuerierFileName string `json:"output_querier_file_name,omitempty" yaml:"output_querier_file_name"` - OutputCopyFromFileName string `json:"output_copyfrom_file_name,omitempty" yaml:"output_copyfrom_file_name"` - OutputFilesSuffix string `json:"output_files_suffix,omitempty" yaml:"output_files_suffix"` - StrictFunctionChecks bool `json:"strict_function_checks" yaml:"strict_function_checks"` - StrictOrderBy *bool `json:"strict_order_by" yaml:"strict_order_by"` - QueryParameterLimit *int32 `json:"query_parameter_limit,omitempty" yaml:"query_parameter_limit"` - OmitUnusedStructs bool `json:"omit_unused_structs,omitempty" yaml:"omit_unused_structs"` - Rules []string `json:"rules" yaml:"rules"` + Name string `json:"name" yaml:"name"` + Engine Engine `json:"engine,omitempty" yaml:"engine"` + Database *Database `json:"database,omitempty" yaml:"database"` + Analyzer Analyzer `json:"analyzer" yaml:"analyzer"` + Path string `json:"path" yaml:"path"` + Schema Paths `json:"schema" yaml:"schema"` + Queries Paths `json:"queries" yaml:"queries"` + EmitInterface bool `json:"emit_interface" yaml:"emit_interface"` + EmitJSONTags bool `json:"emit_json_tags" yaml:"emit_json_tags"` + JsonTagsIDUppercase bool `json:"json_tags_id_uppercase" yaml:"json_tags_id_uppercase"` + EmitDBTags bool `json:"emit_db_tags" yaml:"emit_db_tags"` + EmitPreparedQueries bool `json:"emit_prepared_queries" yaml:"emit_prepared_queries"` + EmitExactTableNames bool `json:"emit_exact_table_names,omitempty" yaml:"emit_exact_table_names"` + EmitEmptySlices bool `json:"emit_empty_slices,omitempty" yaml:"emit_empty_slices"` + EmitExportedQueries bool `json:"emit_exported_queries,omitempty" yaml:"emit_exported_queries"` + EmitResultStructPointers bool `json:"emit_result_struct_pointers" yaml:"emit_result_struct_pointers"` + EmitParamsStructPointers bool `json:"emit_params_struct_pointers" yaml:"emit_params_struct_pointers"` + EmitMethodsWithDBArgument bool `json:"emit_methods_with_db_argument" yaml:"emit_methods_with_db_argument"` + EmitPointersForNullTypes bool `json:"emit_pointers_for_null_types" yaml:"emit_pointers_for_null_types"` + EmitEnumValidMethod bool `json:"emit_enum_valid_method,omitempty" yaml:"emit_enum_valid_method"` + EmitAllEnumValues bool `json:"emit_all_enum_values,omitempty" yaml:"emit_all_enum_values"` + EmitSqlAsComment bool `json:"emit_sql_as_comment,omitempty" yaml:"emit_sql_as_comment"` + JSONTagsCaseStyle string `json:"json_tags_case_style,omitempty" yaml:"json_tags_case_style"` + SQLPackage string `json:"sql_package" yaml:"sql_package"` + SQLDriver string `json:"sql_driver" yaml:"sql_driver"` + Overrides []golang.Override `json:"overrides" yaml:"overrides"` + OutputBatchFileName string `json:"output_batch_file_name,omitempty" yaml:"output_batch_file_name"` + OutputDBFileName string `json:"output_db_file_name,omitempty" yaml:"output_db_file_name"` + OutputModelsFileName string `json:"output_models_file_name,omitempty" yaml:"output_models_file_name"` + OutputQuerierFileName string `json:"output_querier_file_name,omitempty" yaml:"output_querier_file_name"` + OutputCopyFromFileName string `json:"output_copyfrom_file_name,omitempty" yaml:"output_copyfrom_file_name"` + OutputFilesSuffix string `json:"output_files_suffix,omitempty" yaml:"output_files_suffix"` + StrictFunctionChecks bool `json:"strict_function_checks" yaml:"strict_function_checks"` + StrictOrderBy *bool `json:"strict_order_by" yaml:"strict_order_by"` + QueryParameterLimit *int32 `json:"query_parameter_limit,omitempty" yaml:"query_parameter_limit"` + OmitSqlcVersion bool `json:"omit_sqlc_version,omitempty" yaml:"omit_sqlc_version"` + OmitUnusedStructs bool `json:"omit_unused_structs,omitempty" yaml:"omit_unused_structs"` + Rules []string `json:"rules" yaml:"rules"` + BuildTags string `json:"build_tags,omitempty" yaml:"build_tags"` } func v1ParseConfig(rd io.Reader) (Config, error) { @@ -75,37 +81,18 @@ func v1ParseConfig(rd io.Reader) (Config, error) { if err := settings.ValidateGlobalOverrides(); err != nil { return config, err } - for i := range settings.Overrides { - if err := settings.Overrides[i].Parse(); err != nil { - return config, err - } - } for j := range settings.Packages { if settings.Packages[j].Path == "" { return config, ErrNoPackagePath } - if settings.Packages[j].QueryParameterLimit != nil && (*settings.Packages[j].QueryParameterLimit < 0) { - return config, ErrInvalidQueryParameterLimit - } - - if settings.Packages[j].QueryParameterLimit == nil { - settings.Packages[j].QueryParameterLimit = new(int32) - *settings.Packages[j].QueryParameterLimit = 1 - } - - for i := range settings.Packages[j].Overrides { - if err := settings.Packages[j].Overrides[i].Parse(); err != nil { - return config, err - } - } if settings.Packages[j].Name == "" { settings.Packages[j].Name = filepath.Base(settings.Packages[j].Path) } + if settings.Packages[j].Engine == "" { settings.Packages[j].Engine = EnginePostgreSQL } - } return settings.Translate(), nil @@ -141,41 +128,46 @@ func (c *V1GenerateSettings) Translate() Config { pkg.StrictOrderBy = &defaultValue } conf.SQL = append(conf.SQL, SQL{ + Name: pkg.Name, Engine: pkg.Engine, Database: pkg.Database, Schema: pkg.Schema, Queries: pkg.Queries, Rules: pkg.Rules, + Analyzer: pkg.Analyzer, Gen: SQLGen{ - Go: &SQLGo{ + Go: &golang.Options{ EmitInterface: pkg.EmitInterface, - EmitJSONTags: pkg.EmitJSONTags, - JsonTagsIDUppercase: pkg.JsonTagsIDUppercase, - EmitDBTags: pkg.EmitDBTags, + EmitJsonTags: pkg.EmitJSONTags, + JsonTagsIdUppercase: pkg.JsonTagsIDUppercase, + EmitDbTags: pkg.EmitDBTags, EmitPreparedQueries: pkg.EmitPreparedQueries, EmitExactTableNames: pkg.EmitExactTableNames, EmitEmptySlices: pkg.EmitEmptySlices, EmitExportedQueries: pkg.EmitExportedQueries, EmitResultStructPointers: pkg.EmitResultStructPointers, EmitParamsStructPointers: pkg.EmitParamsStructPointers, - EmitMethodsWithDBArgument: pkg.EmitMethodsWithDBArgument, + EmitMethodsWithDbArgument: pkg.EmitMethodsWithDBArgument, EmitPointersForNullTypes: pkg.EmitPointersForNullTypes, EmitEnumValidMethod: pkg.EmitEnumValidMethod, EmitAllEnumValues: pkg.EmitAllEnumValues, + EmitSqlAsComment: pkg.EmitSqlAsComment, Package: pkg.Name, Out: pkg.Path, - SQLPackage: pkg.SQLPackage, - SQLDriver: pkg.SQLDriver, + SqlPackage: pkg.SQLPackage, + SqlDriver: pkg.SQLDriver, Overrides: pkg.Overrides, - JSONTagsCaseStyle: pkg.JSONTagsCaseStyle, + JsonTagsCaseStyle: pkg.JSONTagsCaseStyle, OutputBatchFileName: pkg.OutputBatchFileName, - OutputDBFileName: pkg.OutputDBFileName, + OutputDbFileName: pkg.OutputDBFileName, OutputModelsFileName: pkg.OutputModelsFileName, OutputQuerierFileName: pkg.OutputQuerierFileName, - OutputCopyFromFileName: pkg.OutputCopyFromFileName, + OutputCopyfromFileName: pkg.OutputCopyFromFileName, OutputFilesSuffix: pkg.OutputFilesSuffix, QueryParameterLimit: pkg.QueryParameterLimit, + OmitSqlcVersion: pkg.OmitSqlcVersion, OmitUnusedStructs: pkg.OmitUnusedStructs, + BuildTags: pkg.BuildTags, }, }, StrictFunctionChecks: pkg.StrictFunctionChecks, @@ -184,7 +176,7 @@ func (c *V1GenerateSettings) Translate() Config { } if len(c.Overrides) > 0 || len(c.Rename) > 0 { - conf.Gen.Go = &GenGo{ + conf.Overrides.Go = &golang.GlobalOptions{ Overrides: c.Overrides, Rename: c.Rename, } diff --git a/internal/config/v_one.json b/internal/config/v_one.json index e2e8fb03cc..a0667a7c9c 100644 --- a/internal/config/v_one.json +++ b/internal/config/v_one.json @@ -75,6 +75,14 @@ } } }, + "analyzer": { + "type": "object", + "properties": { + "database": { + "type": "boolean" + } + } + }, "strict_function_checks": { "type": "boolean" }, @@ -123,6 +131,12 @@ "emit_all_enum_values": { "type": "boolean" }, + "emit_sql_as_comment": { + "type": "boolean" + }, + "build_tags": { + "type": "string" + }, "json_tags_case_style": { "type": "string" }, @@ -329,4 +343,4 @@ } } } -} \ No newline at end of file +} diff --git a/internal/config/v_two.go b/internal/config/v_two.go index e2c97a2749..0fe22ffa2c 100644 --- a/internal/config/v_two.go +++ b/internal/config/v_two.go @@ -3,7 +3,6 @@ package config import ( "fmt" "io" - "path/filepath" yaml "gopkg.in/yaml.v3" ) @@ -27,13 +26,6 @@ func v2ParseConfig(rd io.Reader) (Config, error) { if err := conf.validateGlobalOverrides(); err != nil { return conf, err } - if conf.Gen.Go != nil { - for i := range conf.Gen.Go.Overrides { - if err := conf.Gen.Go.Overrides[i].Parse(); err != nil { - return conf, err - } - } - } // TODO: Store built-in plugins somewhere else builtins := map[string]struct{}{ "go": {}, @@ -71,27 +63,6 @@ func v2ParseConfig(rd io.Reader) (Config, error) { if conf.SQL[j].Gen.Go.Out == "" { return conf, ErrNoPackagePath } - if conf.SQL[j].Gen.Go.Package == "" { - conf.SQL[j].Gen.Go.Package = filepath.Base(conf.SQL[j].Gen.Go.Out) - } - - if conf.SQL[j].Gen.Go.QueryParameterLimit != nil && (*conf.SQL[j].Gen.Go.QueryParameterLimit < 0) { - return conf, ErrInvalidQueryParameterLimit - } - - if conf.SQL[j].Gen.Go.QueryParameterLimit == nil { - conf.SQL[j].Gen.Go.QueryParameterLimit = new(int32) - *conf.SQL[j].Gen.Go.QueryParameterLimit = 1 - } - - for i := range conf.SQL[j].Gen.Go.Overrides { - if err := conf.SQL[j].Gen.Go.Overrides[i].Parse(); err != nil { - return conf, err - } - } - for k, v := range conf.SQL[j].Gen.Go.Rename { - conf.SQL[j].Gen.Go.Rename[k] = v - } } if conf.SQL[j].Gen.JSON != nil { if conf.SQL[j].Gen.JSON.Out == "" { @@ -105,7 +76,7 @@ func v2ParseConfig(rd io.Reader) (Config, error) { if cg.Out == "" { return conf, ErrNoOutPath } - // TOOD: Allow the use of built-in codegen from here + // TODO: Allow the use of built-in codegen from here if _, ok := plugins[cg.Plugin]; !ok { return conf, ErrPluginNotFound } @@ -125,11 +96,11 @@ func (c *Config) validateGlobalOverrides() error { engines[pkg.Engine] = struct{}{} } } - if c.Gen.Go == nil { + if c.Overrides.Go == nil { return nil } usesMultipleEngines := len(engines) > 1 - for _, oride := range c.Gen.Go.Overrides { + for _, oride := range c.Overrides.Go.Overrides { if usesMultipleEngines && oride.Engine == "" { return fmt.Errorf(`the "engine" field is required for global type overrides because your configuration uses multiple database engines`) } diff --git a/internal/config/v_two.json b/internal/config/v_two.json index a77f2616df..acf914997d 100644 --- a/internal/config/v_two.json +++ b/internal/config/v_two.json @@ -31,6 +31,9 @@ "engine" ], "properties": { + "name": { + "type": "string" + }, "engine": { "enum": [ "postgresql", @@ -75,6 +78,14 @@ } } }, + "analyzer": { + "type": "object", + "properties": { + "database": { + "type": "boolean" + } + } + }, "strict_function_checks": { "type": "boolean" }, @@ -129,6 +140,12 @@ "emit_all_enum_values": { "type": "boolean" }, + "emit_sql_as_comment": { + "type": "boolean" + }, + "build_tags": { + "type": "string" + }, "json_tags_case_style": { "type": "string" }, @@ -428,4 +445,4 @@ } } } -} \ No newline at end of file +} diff --git a/internal/config/validate.go b/internal/config/validate.go index 207a888ecf..fadef4fb3b 100644 --- a/internal/config/validate.go +++ b/internal/config/validate.go @@ -1,19 +1,10 @@ package config -import "fmt" - func Validate(c *Config) error { for _, sql := range c.SQL { - sqlGo := sql.Gen.Go - if sqlGo == nil { - continue - } - if sqlGo.EmitMethodsWithDBArgument && sqlGo.EmitPreparedQueries { - return fmt.Errorf("invalid config: emit_methods_with_db_argument and emit_prepared_queries settings are mutually exclusive") - } if sql.Database != nil { if sql.Database.URI == "" && !sql.Database.Managed { - return fmt.Errorf("invalid config: database must be managed or have a non-empty URI") + return ErrInvalidDatabase } } } diff --git a/internal/constants/query.go b/internal/constants/query.go new file mode 100644 index 0000000000..a572c56c6f --- /dev/null +++ b/internal/constants/query.go @@ -0,0 +1,12 @@ +package constants + +// Flags +const ( + QueryFlagParam = "@param" + QueryFlagSqlcVetDisable = "@sqlc-vet-disable" +) + +// Rules +const ( + QueryRuleDbPrepare = "sqlc/db-prepare" +) diff --git a/internal/dbmanager/client.go b/internal/dbmanager/client.go new file mode 100644 index 0000000000..18aec947cb --- /dev/null +++ b/internal/dbmanager/client.go @@ -0,0 +1,150 @@ +package dbmanager + +import ( + "context" + "fmt" + "hash/fnv" + "io" + "net/url" + "strings" + + "github.com/jackc/pgx/v5" + "golang.org/x/sync/singleflight" + + "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/pgx/poolcache" + "github.com/sqlc-dev/sqlc/internal/shfmt" +) + +type CreateDatabaseRequest struct { + Engine string + Migrations []string + Prefix string +} + +type CreateDatabaseResponse struct { + Uri string +} + +type Client interface { + CreateDatabase(context.Context, *CreateDatabaseRequest) (*CreateDatabaseResponse, error) + Close(context.Context) +} + +var flight singleflight.Group + +type ManagedClient struct { + cache *poolcache.Cache + replacer *shfmt.Replacer + servers []config.Server +} + +func dbid(migrations []string) string { + h := fnv.New64() + for _, query := range migrations { + io.WriteString(h, query) + } + return fmt.Sprintf("%x", h.Sum(nil)) +} + +func (m *ManagedClient) CreateDatabase(ctx context.Context, req *CreateDatabaseRequest) (*CreateDatabaseResponse, error) { + hash := dbid(req.Migrations) + prefix := req.Prefix + if prefix == "" { + prefix = "sqlc_managed" + } + name := fmt.Sprintf("%s_%s", prefix, hash) + + engine := config.Engine(req.Engine) + switch engine { + case config.EngineMySQL: + // pass + case config.EnginePostgreSQL: + // pass + default: + return nil, fmt.Errorf("unsupported engine: %s", engine) + } + + var base string + for _, server := range m.servers { + if server.Engine == engine { + base = server.URI + break + } + } + + if strings.TrimSpace(base) == "" { + return nil, fmt.Errorf("no PostgreSQL database server found") + } + + serverUri := m.replacer.Replace(base) + pool, err := m.cache.Open(ctx, serverUri) + if err != nil { + return nil, err + } + + uri, err := url.Parse(serverUri) + if err != nil { + return nil, err + } + uri.Path = "/" + name + + key := uri.String() + _, err, _ = flight.Do(key, func() (interface{}, error) { + // TODO: Use a parameterized query + row := pool.QueryRow(ctx, + fmt.Sprintf(`SELECT datname FROM pg_database WHERE datname = '%s'`, name)) + + var datname string + if err := row.Scan(&datname); err == nil { + return nil, nil + } + + if _, err := pool.Exec(ctx, fmt.Sprintf(`CREATE DATABASE "%s"`, name)); err != nil { + return nil, err + } + + conn, err := pgx.Connect(ctx, uri.String()) + if err != nil { + pool.Exec(ctx, fmt.Sprintf(`DROP DATABASE IF EXISTS "%s" WITH (FORCE)`, name)) + return nil, fmt.Errorf("connect %s: %s", name, err) + } + defer conn.Close(ctx) + + var migrationErr error + for _, q := range req.Migrations { + if len(strings.TrimSpace(q)) == 0 { + continue + } + if _, err := conn.Exec(ctx, q); err != nil { + migrationErr = fmt.Errorf("%s: %s", q, err) + break + } + } + + if migrationErr != nil { + pool.Exec(ctx, fmt.Sprintf(`DROP DATABASE IF EXISTS "%s" WITH (FORCE)`, name)) + return nil, migrationErr + } + + return nil, nil + }) + + if err != nil { + return nil, err + } + + return &CreateDatabaseResponse{Uri: key}, err +} + +func (m *ManagedClient) Close(ctx context.Context) { + m.cache.Close() +} + +func NewClient(servers []config.Server) *ManagedClient { + return &ManagedClient{ + cache: poolcache.New(), + servers: servers, + replacer: shfmt.NewReplacer(nil), + } +} diff --git a/internal/endtoend/case_test.go b/internal/endtoend/case_test.go new file mode 100644 index 0000000000..4389a4da28 --- /dev/null +++ b/internal/endtoend/case_test.go @@ -0,0 +1,96 @@ +package main + +import ( + "encoding/json" + "fmt" + "os" + "path/filepath" + "runtime" + "strings" + "testing" +) + +type Testcase struct { + Name string + Path string + ConfigName string + Stderr []byte + Exec *Exec +} + +type ExecMeta struct { + InvalidSchema bool `json:"invalid_schema"` +} + +type Exec struct { + Command string `json:"command"` + Contexts []string `json:"contexts"` + Process string `json:"process"` + OS []string `json:"os"` + Env map[string]string `json:"env"` + Meta ExecMeta `json:"meta"` +} + +func parseStderr(t *testing.T, dir, testctx string) []byte { + t.Helper() + paths := []string{ + filepath.Join(dir, "stderr", fmt.Sprintf("%s.txt", testctx)), + filepath.Join(dir, fmt.Sprintf("stderr_%s.txt", runtime.GOOS)), + filepath.Join(dir, "stderr.txt"), + } + for _, path := range paths { + if _, err := os.Stat(path); !os.IsNotExist(err) { + blob, err := os.ReadFile(path) + if err != nil { + t.Fatal(err) + } + return blob + } + } + return nil +} + +func parseExec(t *testing.T, dir string) *Exec { + t.Helper() + path := filepath.Join(dir, "exec.json") + if _, err := os.Stat(path); os.IsNotExist(err) { + return nil + } + var e Exec + blob, err := os.ReadFile(path) + if err != nil { + t.Fatalf("%s: %s", path, err) + } + if err := json.Unmarshal(blob, &e); err != nil { + t.Fatalf("%s: %s", path, err) + } + if e.Command == "" { + e.Command = "generate" + } + return &e +} + +func FindTests(t *testing.T, root, testctx string) []*Testcase { + var tcs []*Testcase + err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + if info.Name() == "sqlc.json" || info.Name() == "sqlc.yaml" || info.Name() == "sqlc.yml" { + dir := filepath.Dir(path) + tcs = append(tcs, &Testcase{ + Path: dir, + Name: strings.TrimPrefix(dir, root+string(filepath.Separator)), + ConfigName: info.Name(), + Stderr: parseStderr(t, dir, testctx), + Exec: parseExec(t, dir), + }) + return filepath.SkipDir + } + return nil + }) + if err != nil { + t.Fatal(err) + } + return tcs +} diff --git a/internal/endtoend/ddl_test.go b/internal/endtoend/ddl_test.go index 46ec73b75c..bed9333743 100644 --- a/internal/endtoend/ddl_test.go +++ b/internal/endtoend/ddl_test.go @@ -1,59 +1,26 @@ package main import ( - "context" "fmt" - "io/fs" "os" "path/filepath" - "strings" "testing" - "github.com/jackc/pgx/v5" - "github.com/sqlc-dev/sqlc/internal/config" - "github.com/sqlc-dev/sqlc/internal/migrations" - "github.com/sqlc-dev/sqlc/internal/quickdb" - pb "github.com/sqlc-dev/sqlc/internal/quickdb/v1" - "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" + "github.com/sqlc-dev/sqlc/internal/sqltest/local" ) func TestValidSchema(t *testing.T) { - ctx := context.Background() - - projectID := os.Getenv("CI_SQLC_PROJECT_ID") - authToken := os.Getenv("CI_SQLC_AUTH_TOKEN") - if projectID == "" || authToken == "" { - t.Skip("missing project id or auth token") - } - - client, err := quickdb.NewClient(projectID, authToken) - if err != nil { - t.Fatal(err) - } + for _, replay := range FindTests(t, "testdata", "base") { + replay := replay // https://golang.org/doc/faq#closures_and_goroutines - files := []string{} - - // Find all tests that do not have a stderr.txt file - err = filepath.Walk("testdata", func(path string, info fs.FileInfo, err error) error { - if err != nil { - return err - } - if filepath.Base(path) == "sqlc.json" || filepath.Base(path) == "sqlc.yaml" { - stderr := filepath.Join(filepath.Dir(path), "stderr.txt") - if _, err := os.Stat(stderr); !os.IsNotExist(err) { - return nil + if replay.Exec != nil { + if replay.Exec.Meta.InvalidSchema { + continue } - files = append(files, path) } - return nil - }) - if err != nil { - t.Fatal(err) - } - for _, file := range files { - file := file // https://golang.org/doc/faq#closures_and_goroutines + file := filepath.Join(replay.Path, replay.ConfigName) rd, err := os.Open(file) if err != nil { t.Fatal(err) @@ -66,63 +33,28 @@ func TestValidSchema(t *testing.T) { for j, pkg := range conf.SQL { j, pkg := j, pkg - if pkg.Engine != config.EnginePostgreSQL { + switch pkg.Engine { + case config.EnginePostgreSQL: + // pass + case config.EngineMySQL: + // pass + default: continue } t.Run(fmt.Sprintf("endtoend-%s-%d", file, j), func(t *testing.T) { t.Parallel() - if strings.Contains(file, "pg_dump") { - t.Skip("loading pg_dump not supported") - } - var schema []string for _, path := range pkg.Schema { schema = append(schema, filepath.Join(filepath.Dir(file), path)) } - files, err := sqlpath.Glob(schema) - if err != nil { - t.Fatal(err) - } - - var sqls []string - for _, f := range files { - contents, err := os.ReadFile(f) - if err != nil { - t.Fatalf("%s: %s", f, err) - } - // TODO: Split schema into separate files - before, _, _ := strings.Cut(string(contents), "-- name:") - before, _, _ = strings.Cut(before, "/* name:") - // Support loading pg_dump SQL files - before = strings.ReplaceAll(before, "CREATE SCHEMA public;", "CREATE SCHEMA IF NOT EXISTS public;") - sqls = append(sqls, migrations.RemoveRollbackStatements(before)) - } - - resp, err := client.CreateEphemeralDatabase(ctx, &pb.CreateEphemeralDatabaseRequest{ - Engine: "postgresql", - Region: quickdb.GetClosestRegion(), - Migrations: sqls, - }) - if err != nil { - t.Fatalf("region %s: %s", quickdb.GetClosestRegion(), err) - } - - t.Cleanup(func() { - _, err = client.DropEphemeralDatabase(ctx, &pb.DropEphemeralDatabaseRequest{ - DatabaseId: resp.DatabaseId, - }) - if err != nil { - t.Fatal(err) - } - }) - - conn, err := pgx.Connect(ctx, resp.Uri) - if err != nil { - t.Fatalf("connect %s: %s", resp.Uri, err) + switch pkg.Engine { + case config.EnginePostgreSQL: + local.PostgreSQL(t, schema) + case config.EngineMySQL: + local.MySQL(t, schema) } - defer conn.Close(ctx) }) } } diff --git a/internal/endtoend/endtoend_test.go b/internal/endtoend/endtoend_test.go index e91e9f9c56..311eba9825 100644 --- a/internal/endtoend/endtoend_test.go +++ b/internal/endtoend/endtoend_test.go @@ -3,10 +3,11 @@ package main import ( "bytes" "context" - "encoding/json" "os" osexec "os/exec" "path/filepath" + "runtime" + "slices" "strings" "testing" @@ -14,9 +15,25 @@ import ( "github.com/google/go-cmp/cmp/cmpopts" "github.com/sqlc-dev/sqlc/internal/cmd" + "github.com/sqlc-dev/sqlc/internal/config" "github.com/sqlc-dev/sqlc/internal/opts" + "github.com/sqlc-dev/sqlc/internal/sqltest/docker" ) +func lineEndings() cmp.Option { + return cmp.Transformer("LineEndings", func(in string) string { + // Replace Windows new lines with Unix newlines + return strings.Replace(in, "\r\n", "\n", -1) + }) +} + +func stderrTransformer() cmp.Option { + return cmp.Transformer("Stderr", func(in string) string { + s := strings.Replace(in, "\r", "", -1) + return strings.Replace(s, "\\", "/", -1) + }) +} + func TestExamples(t *testing.T) { t.Parallel() ctx := context.Background() @@ -40,7 +57,11 @@ func TestExamples(t *testing.T) { t.Parallel() path := filepath.Join(examples, tc) var stderr bytes.Buffer - output, err := cmd.Generate(ctx, cmd.Env{}, path, "", &stderr) + opts := &cmd.Options{ + Env: cmd.Env{}, + Stderr: &stderr, + } + output, err := cmd.Generate(ctx, path, "", opts) if err != nil { t.Fatalf("sqlc generate failed: %s", stderr.String()) } @@ -68,79 +89,169 @@ func BenchmarkExamples(b *testing.B) { path := filepath.Join(examples, tc) for i := 0; i < b.N; i++ { var stderr bytes.Buffer - cmd.Generate(ctx, cmd.Env{}, path, "", &stderr) + opts := &cmd.Options{ + Env: cmd.Env{}, + Stderr: &stderr, + } + cmd.Generate(ctx, path, "", opts) } }) } } +type textContext struct { + Mutate func(*testing.T, string) func(*config.Config) + Enabled func() bool +} + func TestReplay(t *testing.T) { // Ensure that this environment variable is always set to true when running // end-to-end tests os.Setenv("SQLC_DUMMY_VALUE", "true") - t.Parallel() + // t.Parallel() ctx := context.Background() - var dirs []string - err := filepath.Walk("testdata", func(path string, info os.FileInfo, err error) error { - if err != nil { - return err + + var mysqlURI, postgresURI string + if err := docker.Installed(); err == nil { + { + host, err := docker.StartPostgreSQLServer(ctx) + if err != nil { + t.Fatalf("starting postgresql failed: %s", err) + } + postgresURI = host } - if info.Name() == "sqlc.json" || info.Name() == "sqlc.yaml" { - dirs = append(dirs, filepath.Dir(path)) - return filepath.SkipDir + { + host, err := docker.StartMySQLServer(ctx) + if err != nil { + t.Fatalf("starting mysql failed: %s", err) + } + mysqlURI = host } - return nil - }) - if err != nil { - t.Fatal(err) } - for _, replay := range dirs { - tc := replay - t.Run(tc, func(t *testing.T) { - t.Parallel() - var stderr bytes.Buffer - var output map[string]string - var err error + contexts := map[string]textContext{ + "base": { + Mutate: func(t *testing.T, path string) func(*config.Config) { return func(c *config.Config) {} }, + Enabled: func() bool { return true }, + }, + "managed-db": { + Mutate: func(t *testing.T, path string) func(*config.Config) { + return func(c *config.Config) { + c.Servers = []config.Server{ + { + Name: "postgres", + Engine: config.EnginePostgreSQL, + URI: postgresURI, + }, - path, _ := filepath.Abs(tc) - args := parseExec(t, path) - expected := expectedStderr(t, path) + { + Name: "mysql", + Engine: config.EngineMySQL, + URI: mysqlURI, + }, + } + for i := range c.SQL { + switch c.SQL[i].Engine { + case config.EnginePostgreSQL: + c.SQL[i].Database = &config.Database{ + Managed: true, + } + case config.EngineMySQL: + c.SQL[i].Database = &config.Database{ + Managed: true, + } + default: + // pass + } + } + } + }, + Enabled: func() bool { + err := docker.Installed() + return err == nil + }, + }, + } + + for name, testctx := range contexts { + name := name + testctx := testctx + + if !testctx.Enabled() { + continue + } - if args.Process != "" { - _, err := osexec.LookPath(args.Process) - if err != nil { - t.Skipf("executable not found: %s %s", args.Process, err) + for _, replay := range FindTests(t, "testdata", name) { + tc := replay + t.Run(filepath.Join(name, tc.Name), func(t *testing.T) { + var stderr bytes.Buffer + var output map[string]string + var err error + + path, _ := filepath.Abs(tc.Path) + args := tc.Exec + if args == nil { + args = &Exec{Command: "generate"} } - } + expected := string(tc.Stderr) - env := cmd.Env{ - Debug: opts.DebugFromString(args.Env["SQLCDEBUG"]), - NoRemote: true, - } - switch args.Command { - case "diff": - err = cmd.Diff(ctx, env, path, "", &stderr) - case "generate": - output, err = cmd.Generate(ctx, env, path, "", &stderr) - if err == nil { - cmpDirectory(t, path, output) + if args.Process != "" { + _, err := osexec.LookPath(args.Process) + if err != nil { + t.Skipf("executable not found: %s %s", args.Process, err) + } } - case "vet": - err = cmd.Vet(ctx, env, path, "", &stderr) - default: - t.Fatalf("unknown command") - } - if len(expected) == 0 && err != nil { - t.Fatalf("sqlc %s failed: %s", args.Command, stderr.String()) - } + if len(args.Contexts) > 0 { + if !slices.Contains(args.Contexts, name) { + t.Skipf("unsupported context: %s", name) + } + } - if diff := cmp.Diff(expected, stderr.String()); diff != "" { - t.Errorf("stderr differed (-want +got):\n%s", diff) - } - }) + if len(args.OS) > 0 { + if !slices.Contains(args.OS, runtime.GOOS) { + t.Skipf("unsupported os: %s", runtime.GOOS) + } + } + + opts := cmd.Options{ + Env: cmd.Env{ + Debug: opts.DebugFromString(args.Env["SQLCDEBUG"]), + NoRemote: true, + }, + Stderr: &stderr, + MutateConfig: testctx.Mutate(t, path), + } + + switch args.Command { + case "diff": + err = cmd.Diff(ctx, path, "", &opts) + case "generate": + output, err = cmd.Generate(ctx, path, "", &opts) + if err == nil { + cmpDirectory(t, path, output) + } + case "vet": + err = cmd.Vet(ctx, path, "", &opts) + default: + t.Fatalf("unknown command") + } + + if len(expected) == 0 && err != nil { + t.Fatalf("sqlc %s failed: %s", args.Command, stderr.String()) + } + + diff := cmp.Diff( + strings.TrimSpace(expected), + strings.TrimSpace(stderr.String()), + stderrTransformer(), + ) + if diff != "" { + t.Fatalf("stderr differed (-want +got):\n%s", diff) + } + }) + } } } @@ -188,60 +299,24 @@ func cmpDirectory(t *testing.T, dir string, actual map[string]string) { t.Fatal(err) } - if !cmp.Equal(expected, actual, cmpopts.EquateEmpty()) { + opts := []cmp.Option{ + cmpopts.EquateEmpty(), + lineEndings(), + } + + if !cmp.Equal(expected, actual, opts...) { t.Errorf("%s contents differ", dir) for name, contents := range expected { name := name - tn := strings.Replace(name, dir+"/", "", -1) - t.Run(tn, func(t *testing.T) { - if actual[name] == "" { - t.Errorf("%s is empty", name) - return - } - if diff := cmp.Diff(contents, actual[name]); diff != "" { - t.Errorf("%s differed (-want +got):\n%s", name, diff) - } - }) - } - } -} - -func expectedStderr(t *testing.T, dir string) string { - t.Helper() - path := filepath.Join(dir, "stderr.txt") - if _, err := os.Stat(path); !os.IsNotExist(err) { - blob, err := os.ReadFile(path) - if err != nil { - t.Fatal(err) - } - return string(blob) - } - return "" -} - -type exec struct { - Command string `json:"command"` - Process string `json:"process"` - Env map[string]string `json:"env"` -} - -func parseExec(t *testing.T, dir string) exec { - t.Helper() - var e exec - path := filepath.Join(dir, "exec.json") - if _, err := os.Stat(path); !os.IsNotExist(err) { - blob, err := os.ReadFile(path) - if err != nil { - t.Fatal(err) - } - if err := json.Unmarshal(blob, &e); err != nil { - t.Fatal(err) + if actual[name] == "" { + t.Errorf("%s is empty", name) + return + } + if diff := cmp.Diff(contents, actual[name], opts...); diff != "" { + t.Errorf("%s differed (-want +got):\n%s", name, diff) + } } } - if e.Command == "" { - e.Command = "generate" - } - return e } func BenchmarkReplay(b *testing.B) { @@ -251,7 +326,7 @@ func BenchmarkReplay(b *testing.B) { if err != nil { return err } - if info.Name() == "sqlc.json" || info.Name() == "sqlc.yaml" { + if info.Name() == "sqlc.json" || info.Name() == "sqlc.yaml" || info.Name() == "sqlc.yml" { dirs = append(dirs, filepath.Dir(path)) return filepath.SkipDir } @@ -266,7 +341,11 @@ func BenchmarkReplay(b *testing.B) { path, _ := filepath.Abs(tc) for i := 0; i < b.N; i++ { var stderr bytes.Buffer - cmd.Generate(ctx, cmd.Env{}, path, "", &stderr) + opts := &cmd.Options{ + Env: cmd.Env{}, + Stderr: &stderr, + } + cmd.Generate(ctx, path, "", opts) } }) } diff --git a/internal/endtoend/fmt_test.go b/internal/endtoend/fmt_test.go new file mode 100644 index 0000000000..04e753e5b7 --- /dev/null +++ b/internal/endtoend/fmt_test.go @@ -0,0 +1,74 @@ +package main + +import ( + "bytes" + "fmt" + "os" + "path/filepath" + "strings" + "testing" + + "github.com/sqlc-dev/sqlc/internal/debug" + "github.com/sqlc-dev/sqlc/internal/engine/postgresql" + "github.com/sqlc-dev/sqlc/internal/sql/ast" +) + +func TestFormat(t *testing.T) { + t.Parallel() + parse := postgresql.NewParser() + for _, tc := range FindTests(t, "testdata", "base") { + tc := tc + + if !strings.Contains(tc.Path, filepath.Join("pgx/v5")) { + continue + } + + q := filepath.Join(tc.Path, "query.sql") + if _, err := os.Stat(q); os.IsNotExist(err) { + continue + } + + t.Run(tc.Name, func(t *testing.T) { + contents, err := os.ReadFile(q) + if err != nil { + t.Fatal(err) + } + for i, query := range bytes.Split(bytes.TrimSpace(contents), []byte(";")) { + if len(query) <= 1 { + continue + } + query := query + t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { + expected, err := postgresql.Fingerprint(string(query)) + if err != nil { + t.Fatal(err) + } + stmts, err := parse.Parse(bytes.NewReader(query)) + if err != nil { + t.Fatal(err) + } + if len(stmts) != 1 { + t.Fatal("expected one statement") + } + if false { + r, err := postgresql.Parse(string(query)) + debug.Dump(r, err) + } + + out := ast.Format(stmts[0].Raw) + actual, err := postgresql.Fingerprint(out) + if err != nil { + t.Error(err) + } + if expected != actual { + debug.Dump(stmts[0].Raw) + t.Errorf("- %s", expected) + t.Errorf("- %s", string(query)) + t.Errorf("+ %s", actual) + t.Errorf("+ %s", out) + } + }) + } + }) + } +} diff --git a/internal/endtoend/testdata/alias/mysql/go/db.go b/internal/endtoend/testdata/alias/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/alias/mysql/go/db.go +++ b/internal/endtoend/testdata/alias/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/alias/mysql/go/models.go b/internal/endtoend/testdata/alias/mysql/go/models.go index 40001531be..65820844a6 100644 --- a/internal/endtoend/testdata/alias/mysql/go/models.go +++ b/internal/endtoend/testdata/alias/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID uint64 } diff --git a/internal/endtoend/testdata/alias/mysql/go/query.sql.go b/internal/endtoend/testdata/alias/mysql/go/query.sql.go index f9ca2e7e4e..65c9e9044e 100644 --- a/internal/endtoend/testdata/alias/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/alias/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/alias/mysql/query.sql b/internal/endtoend/testdata/alias/mysql/query.sql index b9f6249f78..d762623472 100644 --- a/internal/endtoend/testdata/alias/mysql/query.sql +++ b/internal/endtoend/testdata/alias/mysql/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id serial not null); - -- name: AliasBar :exec DELETE FROM bar b WHERE b.id = ?; diff --git a/internal/endtoend/testdata/alias/mysql/schema.sql b/internal/endtoend/testdata/alias/mysql/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/alias/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/alias/mysql/sqlc.json b/internal/endtoend/testdata/alias/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/alias/mysql/sqlc.json +++ b/internal/endtoend/testdata/alias/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/query.sql.go index 998d97b872..91a4336a66 100644 --- a/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/alias/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/alias/postgresql/pgx/v4/query.sql index f92b01765d..69c610ce9b 100644 --- a/internal/endtoend/testdata/alias/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v4/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id serial not null); - -- name: AliasBar :exec DELETE FROM bar b WHERE b.id = $1; diff --git a/internal/endtoend/testdata/alias/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/alias/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/alias/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/alias/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/alias/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/query.sql.go index 998d97b872..91a4336a66 100644 --- a/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/alias/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/alias/postgresql/pgx/v5/query.sql index f92b01765d..69c610ce9b 100644 --- a/internal/endtoend/testdata/alias/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v5/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id serial not null); - -- name: AliasBar :exec DELETE FROM bar b WHERE b.id = $1; diff --git a/internal/endtoend/testdata/alias/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/alias/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/alias/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/alias/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/alias/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/alias/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/alias/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/alias/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/alias/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/alias/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/alias/postgresql/stdlib/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/alias/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/alias/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/alias/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/alias/postgresql/stdlib/go/query.sql.go index e876ebcb2d..d082362095 100644 --- a/internal/endtoend/testdata/alias/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/alias/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/alias/postgresql/stdlib/query.sql b/internal/endtoend/testdata/alias/postgresql/stdlib/query.sql index f92b01765d..69c610ce9b 100644 --- a/internal/endtoend/testdata/alias/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/alias/postgresql/stdlib/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id serial not null); - -- name: AliasBar :exec DELETE FROM bar b WHERE b.id = $1; diff --git a/internal/endtoend/testdata/alias/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/alias/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..b7ee888d47 --- /dev/null +++ b/internal/endtoend/testdata/alias/postgresql/stdlib/schema.sql @@ -0,0 +1 @@ +CREATE TABLE bar (id serial not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/alias/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/alias/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/alias/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/alias/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/alias/sqlite/go/db.go b/internal/endtoend/testdata/alias/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/alias/sqlite/go/db.go +++ b/internal/endtoend/testdata/alias/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/alias/sqlite/go/models.go b/internal/endtoend/testdata/alias/sqlite/go/models.go index 214487814e..1344b5dab9 100644 --- a/internal/endtoend/testdata/alias/sqlite/go/models.go +++ b/internal/endtoend/testdata/alias/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int64 } diff --git a/internal/endtoend/testdata/alias/sqlite/go/query.sql.go b/internal/endtoend/testdata/alias/sqlite/go/query.sql.go index fb40e61422..66c338beb1 100644 --- a/internal/endtoend/testdata/alias/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/alias/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/alias/sqlite/query.sql b/internal/endtoend/testdata/alias/sqlite/query.sql index aa69308cd2..05df804af7 100644 --- a/internal/endtoend/testdata/alias/sqlite/query.sql +++ b/internal/endtoend/testdata/alias/sqlite/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id integer NOT NULL PRIMARY KEY AUTOINCREMENT); - -- name: AliasBar :exec DELETE FROM bar AS b WHERE b.id = ?; diff --git a/internal/endtoend/testdata/alias/sqlite/schema.sql b/internal/endtoend/testdata/alias/sqlite/schema.sql new file mode 100644 index 0000000000..89b739c996 --- /dev/null +++ b/internal/endtoend/testdata/alias/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id integer NOT NULL PRIMARY KEY AUTOINCREMENT); + diff --git a/internal/endtoend/testdata/alias/sqlite/sqlc.json b/internal/endtoend/testdata/alias/sqlite/sqlc.json index fcb288cb35..d4963e751f 100644 --- a/internal/endtoend/testdata/alias/sqlite/sqlc.json +++ b/internal/endtoend/testdata/alias/sqlite/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "sqlite", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/any/pgx/v4/go/db.go b/internal/endtoend/testdata/any/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/any/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/any/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/any/pgx/v4/go/models.go b/internal/endtoend/testdata/any/pgx/v4/go/models.go index 214487814e..1344b5dab9 100644 --- a/internal/endtoend/testdata/any/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/any/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int64 } diff --git a/internal/endtoend/testdata/any/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/any/pgx/v4/go/query.sql.go index bb7fc45673..d191817769 100644 --- a/internal/endtoend/testdata/any/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/any/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -12,7 +12,7 @@ import ( const any = `-- name: Any :many SELECT id FROM bar -WHERE foo = ANY($1::bigserial[]) +WHERE id = ANY($1::bigint[]) ` func (q *Queries) Any(ctx context.Context, dollar_1 []int64) ([]int64, error) { diff --git a/internal/endtoend/testdata/any/pgx/v4/query.sql b/internal/endtoend/testdata/any/pgx/v4/query.sql index 9836cf66ea..82f863a2a0 100644 --- a/internal/endtoend/testdata/any/pgx/v4/query.sql +++ b/internal/endtoend/testdata/any/pgx/v4/query.sql @@ -1,6 +1,4 @@ -CREATE TABLE bar (id bigserial not null); - -- name: Any :many SELECT id FROM bar -WHERE foo = ANY($1::bigserial[]); +WHERE id = ANY($1::bigint[]); diff --git a/internal/endtoend/testdata/any/pgx/v4/schema.sql b/internal/endtoend/testdata/any/pgx/v4/schema.sql new file mode 100644 index 0000000000..88127d9df8 --- /dev/null +++ b/internal/endtoend/testdata/any/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id bigserial not null); + diff --git a/internal/endtoend/testdata/any/pgx/v4/sqlc.json b/internal/endtoend/testdata/any/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/any/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/any/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/any/pgx/v5/go/db.go b/internal/endtoend/testdata/any/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/any/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/any/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/any/pgx/v5/go/models.go b/internal/endtoend/testdata/any/pgx/v5/go/models.go index 214487814e..1344b5dab9 100644 --- a/internal/endtoend/testdata/any/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/any/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int64 } diff --git a/internal/endtoend/testdata/any/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/any/pgx/v5/go/query.sql.go index bb7fc45673..d191817769 100644 --- a/internal/endtoend/testdata/any/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/any/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -12,7 +12,7 @@ import ( const any = `-- name: Any :many SELECT id FROM bar -WHERE foo = ANY($1::bigserial[]) +WHERE id = ANY($1::bigint[]) ` func (q *Queries) Any(ctx context.Context, dollar_1 []int64) ([]int64, error) { diff --git a/internal/endtoend/testdata/any/pgx/v5/query.sql b/internal/endtoend/testdata/any/pgx/v5/query.sql index 9836cf66ea..82f863a2a0 100644 --- a/internal/endtoend/testdata/any/pgx/v5/query.sql +++ b/internal/endtoend/testdata/any/pgx/v5/query.sql @@ -1,6 +1,4 @@ -CREATE TABLE bar (id bigserial not null); - -- name: Any :many SELECT id FROM bar -WHERE foo = ANY($1::bigserial[]); +WHERE id = ANY($1::bigint[]); diff --git a/internal/endtoend/testdata/any/pgx/v5/schema.sql b/internal/endtoend/testdata/any/pgx/v5/schema.sql new file mode 100644 index 0000000000..88127d9df8 --- /dev/null +++ b/internal/endtoend/testdata/any/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id bigserial not null); + diff --git a/internal/endtoend/testdata/any/pgx/v5/sqlc.json b/internal/endtoend/testdata/any/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/any/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/any/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/any/stdlib/go/db.go b/internal/endtoend/testdata/any/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/any/stdlib/go/db.go +++ b/internal/endtoend/testdata/any/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/any/stdlib/go/models.go b/internal/endtoend/testdata/any/stdlib/go/models.go index 214487814e..1344b5dab9 100644 --- a/internal/endtoend/testdata/any/stdlib/go/models.go +++ b/internal/endtoend/testdata/any/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int64 } diff --git a/internal/endtoend/testdata/any/stdlib/go/query.sql.go b/internal/endtoend/testdata/any/stdlib/go/query.sql.go index df94520be8..7adc371a65 100644 --- a/internal/endtoend/testdata/any/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/any/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -14,7 +14,7 @@ import ( const any = `-- name: Any :many SELECT id FROM bar -WHERE foo = ANY($1::bigserial[]) +WHERE id = ANY($1::bigint[]) ` func (q *Queries) Any(ctx context.Context, dollar_1 []int64) ([]int64, error) { diff --git a/internal/endtoend/testdata/any/stdlib/query.sql b/internal/endtoend/testdata/any/stdlib/query.sql index 9836cf66ea..82f863a2a0 100644 --- a/internal/endtoend/testdata/any/stdlib/query.sql +++ b/internal/endtoend/testdata/any/stdlib/query.sql @@ -1,6 +1,4 @@ -CREATE TABLE bar (id bigserial not null); - -- name: Any :many SELECT id FROM bar -WHERE foo = ANY($1::bigserial[]); +WHERE id = ANY($1::bigint[]); diff --git a/internal/endtoend/testdata/any/stdlib/schema.sql b/internal/endtoend/testdata/any/stdlib/schema.sql new file mode 100644 index 0000000000..88127d9df8 --- /dev/null +++ b/internal/endtoend/testdata/any/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id bigserial not null); + diff --git a/internal/endtoend/testdata/any/stdlib/sqlc.json b/internal/endtoend/testdata/any/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/any/stdlib/sqlc.json +++ b/internal/endtoend/testdata/any/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/array_in/pgx/v4/go/db.go b/internal/endtoend/testdata/array_in/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/array_in/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/array_in/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/array_in/pgx/v4/go/models.go b/internal/endtoend/testdata/array_in/pgx/v4/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/array_in/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/array_in/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/array_in/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/array_in/pgx/v4/go/query.sql.go index 36db3eb777..6f95dad606 100644 --- a/internal/endtoend/testdata/array_in/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/array_in/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/array_in/pgx/v4/query.sql b/internal/endtoend/testdata/array_in/pgx/v4/query.sql index 5a43588fdf..d412b55664 100644 --- a/internal/endtoend/testdata/array_in/pgx/v4/query.sql +++ b/internal/endtoend/testdata/array_in/pgx/v4/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id serial not null); - -- name: In :many SELECT * FROM bar diff --git a/internal/endtoend/testdata/array_in/pgx/v4/schema.sql b/internal/endtoend/testdata/array_in/pgx/v4/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/array_in/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/array_in/pgx/v4/sqlc.json b/internal/endtoend/testdata/array_in/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/array_in/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/array_in/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/array_in/pgx/v5/go/db.go b/internal/endtoend/testdata/array_in/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/array_in/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/array_in/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/array_in/pgx/v5/go/models.go b/internal/endtoend/testdata/array_in/pgx/v5/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/array_in/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/array_in/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/array_in/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/array_in/pgx/v5/go/query.sql.go index 36db3eb777..6f95dad606 100644 --- a/internal/endtoend/testdata/array_in/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/array_in/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/array_in/pgx/v5/query.sql b/internal/endtoend/testdata/array_in/pgx/v5/query.sql index 5a43588fdf..d412b55664 100644 --- a/internal/endtoend/testdata/array_in/pgx/v5/query.sql +++ b/internal/endtoend/testdata/array_in/pgx/v5/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id serial not null); - -- name: In :many SELECT * FROM bar diff --git a/internal/endtoend/testdata/array_in/pgx/v5/schema.sql b/internal/endtoend/testdata/array_in/pgx/v5/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/array_in/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/array_in/pgx/v5/sqlc.json b/internal/endtoend/testdata/array_in/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/array_in/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/array_in/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/array_in/stdlib/go/db.go b/internal/endtoend/testdata/array_in/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/array_in/stdlib/go/db.go +++ b/internal/endtoend/testdata/array_in/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/array_in/stdlib/go/models.go b/internal/endtoend/testdata/array_in/stdlib/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/array_in/stdlib/go/models.go +++ b/internal/endtoend/testdata/array_in/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/array_in/stdlib/go/query.sql.go b/internal/endtoend/testdata/array_in/stdlib/go/query.sql.go index 3badae5d44..e63538bd0e 100644 --- a/internal/endtoend/testdata/array_in/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/array_in/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/array_in/stdlib/query.sql b/internal/endtoend/testdata/array_in/stdlib/query.sql index 5a43588fdf..d412b55664 100644 --- a/internal/endtoend/testdata/array_in/stdlib/query.sql +++ b/internal/endtoend/testdata/array_in/stdlib/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id serial not null); - -- name: In :many SELECT * FROM bar diff --git a/internal/endtoend/testdata/array_in/stdlib/schema.sql b/internal/endtoend/testdata/array_in/stdlib/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/array_in/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/array_in/stdlib/sqlc.json b/internal/endtoend/testdata/array_in/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/array_in/stdlib/sqlc.json +++ b/internal/endtoend/testdata/array_in/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/array_text/pgx/v4/go/db.go b/internal/endtoend/testdata/array_text/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/array_text/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/array_text/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/array_text/pgx/v4/go/models.go b/internal/endtoend/testdata/array_text/pgx/v4/go/models.go index 7ff93babe8..84b877e966 100644 --- a/internal/endtoend/testdata/array_text/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/array_text/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { Tags []string } diff --git a/internal/endtoend/testdata/array_text/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/array_text/pgx/v4/go/query.sql.go index 6d8593c5ea..1c1dec9c23 100644 --- a/internal/endtoend/testdata/array_text/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/array_text/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/array_text/pgx/v4/query.sql b/internal/endtoend/testdata/array_text/pgx/v4/query.sql index cdb0878271..4c6b35329a 100644 --- a/internal/endtoend/testdata/array_text/pgx/v4/query.sql +++ b/internal/endtoend/testdata/array_text/pgx/v4/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE bar (tags text[] not null); - -- name: TextArray :many SELECT * FROM bar; diff --git a/internal/endtoend/testdata/array_text/pgx/v4/schema.sql b/internal/endtoend/testdata/array_text/pgx/v4/schema.sql new file mode 100644 index 0000000000..9d6d66b3a7 --- /dev/null +++ b/internal/endtoend/testdata/array_text/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (tags text[] not null); + diff --git a/internal/endtoend/testdata/array_text/pgx/v4/sqlc.json b/internal/endtoend/testdata/array_text/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/array_text/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/array_text/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/array_text/pgx/v5/go/db.go b/internal/endtoend/testdata/array_text/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/array_text/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/array_text/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/array_text/pgx/v5/go/models.go b/internal/endtoend/testdata/array_text/pgx/v5/go/models.go index 7ff93babe8..84b877e966 100644 --- a/internal/endtoend/testdata/array_text/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/array_text/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { Tags []string } diff --git a/internal/endtoend/testdata/array_text/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/array_text/pgx/v5/go/query.sql.go index 6d8593c5ea..1c1dec9c23 100644 --- a/internal/endtoend/testdata/array_text/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/array_text/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/array_text/pgx/v5/query.sql b/internal/endtoend/testdata/array_text/pgx/v5/query.sql index cdb0878271..4c6b35329a 100644 --- a/internal/endtoend/testdata/array_text/pgx/v5/query.sql +++ b/internal/endtoend/testdata/array_text/pgx/v5/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE bar (tags text[] not null); - -- name: TextArray :many SELECT * FROM bar; diff --git a/internal/endtoend/testdata/array_text/pgx/v5/schema.sql b/internal/endtoend/testdata/array_text/pgx/v5/schema.sql new file mode 100644 index 0000000000..9d6d66b3a7 --- /dev/null +++ b/internal/endtoend/testdata/array_text/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (tags text[] not null); + diff --git a/internal/endtoend/testdata/array_text/pgx/v5/sqlc.json b/internal/endtoend/testdata/array_text/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/array_text/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/array_text/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/array_text/stdlib/go/db.go b/internal/endtoend/testdata/array_text/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/array_text/stdlib/go/db.go +++ b/internal/endtoend/testdata/array_text/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/array_text/stdlib/go/models.go b/internal/endtoend/testdata/array_text/stdlib/go/models.go index 7ff93babe8..84b877e966 100644 --- a/internal/endtoend/testdata/array_text/stdlib/go/models.go +++ b/internal/endtoend/testdata/array_text/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { Tags []string } diff --git a/internal/endtoend/testdata/array_text/stdlib/go/query.sql.go b/internal/endtoend/testdata/array_text/stdlib/go/query.sql.go index 70ae1c0dd5..20946c6015 100644 --- a/internal/endtoend/testdata/array_text/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/array_text/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/array_text/stdlib/query.sql b/internal/endtoend/testdata/array_text/stdlib/query.sql index cdb0878271..4c6b35329a 100644 --- a/internal/endtoend/testdata/array_text/stdlib/query.sql +++ b/internal/endtoend/testdata/array_text/stdlib/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE bar (tags text[] not null); - -- name: TextArray :many SELECT * FROM bar; diff --git a/internal/endtoend/testdata/array_text/stdlib/schema.sql b/internal/endtoend/testdata/array_text/stdlib/schema.sql new file mode 100644 index 0000000000..9d6d66b3a7 --- /dev/null +++ b/internal/endtoend/testdata/array_text/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (tags text[] not null); + diff --git a/internal/endtoend/testdata/array_text/stdlib/sqlc.json b/internal/endtoend/testdata/array_text/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/array_text/stdlib/sqlc.json +++ b/internal/endtoend/testdata/array_text/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/array_text_join/pgx/v4/go/db.go b/internal/endtoend/testdata/array_text_join/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/array_text_join/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/array_text_join/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/array_text_join/pgx/v4/go/models.go b/internal/endtoend/testdata/array_text_join/pgx/v4/go/models.go index 76e761cb44..90d0021ea1 100644 --- a/internal/endtoend/testdata/array_text_join/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/array_text_join/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID string Info []string diff --git a/internal/endtoend/testdata/array_text_join/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/array_text_join/pgx/v4/go/query.sql.go index 4eb79d9508..f4eab73a31 100644 --- a/internal/endtoend/testdata/array_text_join/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/array_text_join/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/array_text_join/pgx/v4/query.sql b/internal/endtoend/testdata/array_text_join/pgx/v4/query.sql index 4b2417b860..68135c6cd9 100644 --- a/internal/endtoend/testdata/array_text_join/pgx/v4/query.sql +++ b/internal/endtoend/testdata/array_text_join/pgx/v4/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE foo (id text not null, bar text not null); -CREATE TABLE bar (id text not null, info text[] not null); - -- name: JoinTextArray :many SELECT bar.info FROM foo diff --git a/internal/endtoend/testdata/array_text_join/pgx/v4/schema.sql b/internal/endtoend/testdata/array_text_join/pgx/v4/schema.sql new file mode 100644 index 0000000000..a8ba18ef30 --- /dev/null +++ b/internal/endtoend/testdata/array_text_join/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (id text not null, bar text not null); +CREATE TABLE bar (id text not null, info text[] not null); + diff --git a/internal/endtoend/testdata/array_text_join/pgx/v4/sqlc.json b/internal/endtoend/testdata/array_text_join/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/array_text_join/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/array_text_join/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/array_text_join/pgx/v5/go/db.go b/internal/endtoend/testdata/array_text_join/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/array_text_join/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/array_text_join/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/array_text_join/pgx/v5/go/models.go b/internal/endtoend/testdata/array_text_join/pgx/v5/go/models.go index 76e761cb44..90d0021ea1 100644 --- a/internal/endtoend/testdata/array_text_join/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/array_text_join/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID string Info []string diff --git a/internal/endtoend/testdata/array_text_join/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/array_text_join/pgx/v5/go/query.sql.go index 4eb79d9508..f4eab73a31 100644 --- a/internal/endtoend/testdata/array_text_join/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/array_text_join/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/array_text_join/pgx/v5/query.sql b/internal/endtoend/testdata/array_text_join/pgx/v5/query.sql index 4b2417b860..68135c6cd9 100644 --- a/internal/endtoend/testdata/array_text_join/pgx/v5/query.sql +++ b/internal/endtoend/testdata/array_text_join/pgx/v5/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE foo (id text not null, bar text not null); -CREATE TABLE bar (id text not null, info text[] not null); - -- name: JoinTextArray :many SELECT bar.info FROM foo diff --git a/internal/endtoend/testdata/array_text_join/pgx/v5/schema.sql b/internal/endtoend/testdata/array_text_join/pgx/v5/schema.sql new file mode 100644 index 0000000000..a8ba18ef30 --- /dev/null +++ b/internal/endtoend/testdata/array_text_join/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (id text not null, bar text not null); +CREATE TABLE bar (id text not null, info text[] not null); + diff --git a/internal/endtoend/testdata/array_text_join/pgx/v5/sqlc.json b/internal/endtoend/testdata/array_text_join/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/array_text_join/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/array_text_join/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/array_text_join/stdlib/go/db.go b/internal/endtoend/testdata/array_text_join/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/array_text_join/stdlib/go/db.go +++ b/internal/endtoend/testdata/array_text_join/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/array_text_join/stdlib/go/models.go b/internal/endtoend/testdata/array_text_join/stdlib/go/models.go index 76e761cb44..90d0021ea1 100644 --- a/internal/endtoend/testdata/array_text_join/stdlib/go/models.go +++ b/internal/endtoend/testdata/array_text_join/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID string Info []string diff --git a/internal/endtoend/testdata/array_text_join/stdlib/go/query.sql.go b/internal/endtoend/testdata/array_text_join/stdlib/go/query.sql.go index b2409c82d4..5ffc67158e 100644 --- a/internal/endtoend/testdata/array_text_join/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/array_text_join/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/array_text_join/stdlib/query.sql b/internal/endtoend/testdata/array_text_join/stdlib/query.sql index 4b2417b860..68135c6cd9 100644 --- a/internal/endtoend/testdata/array_text_join/stdlib/query.sql +++ b/internal/endtoend/testdata/array_text_join/stdlib/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE foo (id text not null, bar text not null); -CREATE TABLE bar (id text not null, info text[] not null); - -- name: JoinTextArray :many SELECT bar.info FROM foo diff --git a/internal/endtoend/testdata/array_text_join/stdlib/schema.sql b/internal/endtoend/testdata/array_text_join/stdlib/schema.sql new file mode 100644 index 0000000000..a8ba18ef30 --- /dev/null +++ b/internal/endtoend/testdata/array_text_join/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (id text not null, bar text not null); +CREATE TABLE bar (id text not null, info text[] not null); + diff --git a/internal/endtoend/testdata/array_text_join/stdlib/sqlc.json b/internal/endtoend/testdata/array_text_join/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/array_text_join/stdlib/sqlc.json +++ b/internal/endtoend/testdata/array_text_join/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/bad_config/engine/query.sql b/internal/endtoend/testdata/bad_config/engine/query.sql new file mode 100644 index 0000000000..18b0c0d03c --- /dev/null +++ b/internal/endtoend/testdata/bad_config/engine/query.sql @@ -0,0 +1,2 @@ +-- name: Test :exec +SELECT 1; \ No newline at end of file diff --git a/internal/endtoend/testdata/bad_config/engine/sqlc.yaml b/internal/endtoend/testdata/bad_config/engine/sqlc.yaml new file mode 100644 index 0000000000..8f20b4eaa5 --- /dev/null +++ b/internal/endtoend/testdata/bad_config/engine/sqlc.yaml @@ -0,0 +1,8 @@ +version: 2 +sql: +- queries: query.sql + schema: query.sql + engine: "bad_engine" + gen: + go: + out: "db" \ No newline at end of file diff --git a/internal/endtoend/testdata/bad_config/engine/stderr.txt b/internal/endtoend/testdata/bad_config/engine/stderr.txt new file mode 100644 index 0000000000..9797244924 --- /dev/null +++ b/internal/endtoend/testdata/bad_config/engine/stderr.txt @@ -0,0 +1 @@ +error creating compiler: unknown engine: bad_engine \ No newline at end of file diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/batch.go b/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/batch.go index 863d96d847..adaedfa3c0 100644 --- a/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/batch.go +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/batch.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: batch.go package querytest diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/db.go index e28790b2ce..fa88475d3d 100644 --- a/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/models.go index ee9c9d3d4e..f0e5a24373 100644 --- a/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/query.sql.go index ddc6c6534c..a80cdbd2f0 100644 --- a/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/query.sql.go @@ -1,8 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest - -import () diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/batch/postgresql/pgx/v4/query.sql index 2c6b776fd5..c8e2570a55 100644 --- a/internal/endtoend/testdata/batch/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v4/query.sql @@ -1,6 +1,3 @@ -CREATE SCHEMA myschema; -CREATE TABLE myschema.foo (a text, b integer); - -- name: InsertValues :batchone INSERT INTO myschema.foo (a, b) VALUES ($1, $2) diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/batch/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..e53abe57ad --- /dev/null +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA myschema; +CREATE TABLE myschema.foo (a text, b integer); + diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/batch/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/batch/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/batch.go b/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/batch.go index 78b22e9016..b61a4ca6c8 100644 --- a/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/batch.go +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/batch.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: batch.go package querytest diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/db.go index 21d826834a..9a44027379 100644 --- a/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/models.go index 219b82bdc2..7226216da5 100644 --- a/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/query.sql.go index ddc6c6534c..a80cdbd2f0 100644 --- a/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/query.sql.go @@ -1,8 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest - -import () diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/batch/postgresql/pgx/v5/query.sql index 2c6b776fd5..c8e2570a55 100644 --- a/internal/endtoend/testdata/batch/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v5/query.sql @@ -1,6 +1,3 @@ -CREATE SCHEMA myschema; -CREATE TABLE myschema.foo (a text, b integer); - -- name: InsertValues :batchone INSERT INTO myschema.foo (a, b) VALUES ($1, $2) diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/batch/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..e53abe57ad --- /dev/null +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA myschema; +CREATE TABLE myschema.foo (a text, b integer); + diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/batch/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/batch/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/batch.go b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/batch.go index 049c0dc215..adefff482a 100644 --- a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/batch.go +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/batch.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: batch.go package querytest diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/db.go index e28790b2ce..fa88475d3d 100644 --- a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/models.go index ee9c9d3d4e..f0e5a24373 100644 --- a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/query.sql.go index 979298df0a..e5b3f3a089 100644 --- a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/query.sql index 706cf8ef94..def00fb6ac 100644 --- a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/query.sql @@ -1,6 +1,3 @@ -CREATE SCHEMA myschema; -CREATE TABLE myschema.foo (a text, b integer); - -- name: InsertValues :batchone INSERT INTO myschema.foo (a, b) VALUES ($1, $2) diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..e53abe57ad --- /dev/null +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA myschema; +CREATE TABLE myschema.foo (a text, b integer); + diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/batch.go b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/batch.go index 244080045c..e9ed1d9634 100644 --- a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/batch.go +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/batch.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: batch.go package querytest diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/db.go index 21d826834a..9a44027379 100644 --- a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/models.go index 219b82bdc2..7226216da5 100644 --- a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/query.sql.go index f0a273303c..c3bd3f6e65 100644 --- a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/query.sql index 706cf8ef94..def00fb6ac 100644 --- a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/query.sql @@ -1,6 +1,3 @@ -CREATE SCHEMA myschema; -CREATE TABLE myschema.foo (a text, b integer); - -- name: InsertValues :batchone INSERT INTO myschema.foo (a, b) VALUES ($1, $2) diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..e53abe57ad --- /dev/null +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA myschema; +CREATE TABLE myschema.foo (a text, b integer); + diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/batch_parameter_limit/issue.md b/internal/endtoend/testdata/batch_parameter_limit/issue.md new file mode 100644 index 0000000000..e0d6146269 --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_limit/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/3185 diff --git a/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/go/batch.go b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/go/batch.go new file mode 100644 index 0000000000..9e0fc66652 --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/go/batch.go @@ -0,0 +1,71 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: batch.go + +package querytest + +import ( + "context" + "errors" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgtype" +) + +var ( + ErrBatchAlreadyClosed = errors.New("batch already closed") +) + +const createAuthors = `-- name: CreateAuthors :batchexec +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +` + +type CreateAuthorsBatchResults struct { + br pgx.BatchResults + tot int + closed bool +} + +type CreateAuthorsParams struct { + Name string + Bio pgtype.Text +} + +func (q *Queries) CreateAuthors(ctx context.Context, arg []CreateAuthorsParams) *CreateAuthorsBatchResults { + batch := &pgx.Batch{} + for _, a := range arg { + vals := []interface{}{ + a.Name, + a.Bio, + } + batch.Queue(createAuthors, vals...) + } + br := q.db.SendBatch(ctx, batch) + return &CreateAuthorsBatchResults{br, len(arg), false} +} + +func (b *CreateAuthorsBatchResults) Exec(f func(int, error)) { + defer b.br.Close() + for t := 0; t < b.tot; t++ { + if b.closed { + if f != nil { + f(t, ErrBatchAlreadyClosed) + } + continue + } + _, err := b.br.Exec() + if f != nil { + f(t, err) + } + } +} + +func (b *CreateAuthorsBatchResults) Close() error { + b.closed = true + return b.br.Close() +} diff --git a/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/go/db.go b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..9a44027379 --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/go/db.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row + SendBatch(context.Context, *pgx.Batch) pgx.BatchResults +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/go/models.go b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..e4cf9d17ae --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Author struct { + ID int64 + Name string + Bio pgtype.Text +} diff --git a/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..a80cdbd2f0 --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/go/query.sql.go @@ -0,0 +1,6 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest diff --git a/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/query.sql b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/query.sql new file mode 100644 index 0000000000..3c25c9349e --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/query.sql @@ -0,0 +1,6 @@ +-- name: CreateAuthors :batchexec +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +); diff --git a/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/schema.sql b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..69b607d902 --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..e5eb77fa4e --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/sqlc.yaml @@ -0,0 +1,11 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" + query_parameter_limit: 2 diff --git a/internal/endtoend/testdata/batch_parameter_type/issue.md b/internal/endtoend/testdata/batch_parameter_type/issue.md new file mode 100644 index 0000000000..13bb3e6b52 --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_type/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/2152 diff --git a/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/exec.json b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/go/batch.go b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/go/batch.go new file mode 100644 index 0000000000..bf8da49f59 --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/go/batch.go @@ -0,0 +1,101 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: batch.go + +package querytest + +import ( + "context" + "errors" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgtype" +) + +var ( + ErrBatchAlreadyClosed = errors.New("batch already closed") +) + +const insertMappping = `-- name: InsertMappping :batchexec +WITH + table1 + AS ( + SELECT + version + FROM + solar_commcard_mapping + WHERE + "deviceId" = $1 + ORDER BY + "updatedAt" DESC + LIMIT + 1 + ) +INSERT +INTO + solar_commcard_mapping + ("deviceId", version, sn, "updatedAt") +SELECT + $1, $2::text, $3, $4 +WHERE + NOT + EXISTS( + SELECT + version + FROM + table1 + WHERE + table1.version = $2::text + ) + OR NOT EXISTS(SELECT version FROM table1) +` + +type InsertMapppingBatchResults struct { + br pgx.BatchResults + tot int + closed bool +} + +type InsertMapppingParams struct { + DeviceId int64 + Version string + Sn string + UpdatedAt pgtype.Timestamptz +} + +func (q *Queries) InsertMappping(ctx context.Context, arg []InsertMapppingParams) *InsertMapppingBatchResults { + batch := &pgx.Batch{} + for _, a := range arg { + vals := []interface{}{ + a.DeviceId, + a.Version, + a.Sn, + a.UpdatedAt, + } + batch.Queue(insertMappping, vals...) + } + br := q.db.SendBatch(ctx, batch) + return &InsertMapppingBatchResults{br, len(arg), false} +} + +func (b *InsertMapppingBatchResults) Exec(f func(int, error)) { + defer b.br.Close() + for t := 0; t < b.tot; t++ { + if b.closed { + if f != nil { + f(t, ErrBatchAlreadyClosed) + } + continue + } + _, err := b.br.Exec() + if f != nil { + f(t, err) + } + } +} + +func (b *InsertMapppingBatchResults) Close() error { + b.closed = true + return b.br.Close() +} diff --git a/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/go/db.go b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..9a44027379 --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/go/db.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row + SendBatch(context.Context, *pgx.Batch) pgx.BatchResults +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/go/models.go b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..c75fd00ac3 --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type SolarCommcardMapping struct { + ID int64 + DeviceId int64 + Version string + Sn string + CreatedAt pgtype.Timestamptz + UpdatedAt pgtype.Timestamptz +} diff --git a/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..a80cdbd2f0 --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/go/query.sql.go @@ -0,0 +1,6 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest diff --git a/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/query.sql b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/query.sql new file mode 100644 index 0000000000..326b9f2f46 --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/query.sql @@ -0,0 +1,32 @@ +-- name: InsertMappping :batchexec +WITH + table1 + AS ( + SELECT + version + FROM + solar_commcard_mapping + WHERE + "deviceId" = $1 + ORDER BY + "updatedAt" DESC + LIMIT + 1 + ) +INSERT +INTO + solar_commcard_mapping + ("deviceId", version, sn, "updatedAt") +SELECT + $1, @version::text, $3, $4 +WHERE + NOT + EXISTS( + SELECT + * + FROM + table1 + WHERE + table1.version = @version::text + ) + OR NOT EXISTS(SELECT * FROM table1); diff --git a/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/schema.sql b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..3aaa4db952 --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/schema.sql @@ -0,0 +1,14 @@ +CREATE TABLE public.solar_commcard_mapping ( + id + INT8 NOT NULL, + "deviceId" + INT8 NOT NULL, + version + VARCHAR(32) DEFAULT ''::VARCHAR NOT NULL, + sn + VARCHAR(32) DEFAULT ''::VARCHAR NOT NULL, + "createdAt" + TIMESTAMPTZ DEFAULT now(), + "updatedAt" + TIMESTAMPTZ DEFAULT now() +); diff --git a/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/between_args/mysql/go/db.go b/internal/endtoend/testdata/between_args/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/between_args/mysql/go/db.go +++ b/internal/endtoend/testdata/between_args/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/between_args/mysql/go/models.go b/internal/endtoend/testdata/between_args/mysql/go/models.go index 699c74d3dc..5d811ab385 100644 --- a/internal/endtoend/testdata/between_args/mysql/go/models.go +++ b/internal/endtoend/testdata/between_args/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Product struct { ID int64 Name string diff --git a/internal/endtoend/testdata/between_args/mysql/go/query.sql.go b/internal/endtoend/testdata/between_args/mysql/go/query.sql.go index d421964a55..6270cb28c0 100644 --- a/internal/endtoend/testdata/between_args/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/between_args/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/between_args/mysql/query.sql b/internal/endtoend/testdata/between_args/mysql/query.sql index 7458e0ecb5..3632dfb5ca 100644 --- a/internal/endtoend/testdata/between_args/mysql/query.sql +++ b/internal/endtoend/testdata/between_args/mysql/query.sql @@ -1,10 +1,3 @@ -CREATE TABLE products ( - id BIGINT NOT NULL AUTO_INCREMENT, - name TEXT NOT NULL, - price INT NOT NULL, - PRIMARY KEY (id) -); - -- name: GetBetweenPrices :many SELECT * FROM products diff --git a/internal/endtoend/testdata/between_args/mysql/schema.sql b/internal/endtoend/testdata/between_args/mysql/schema.sql new file mode 100644 index 0000000000..76f64e9ac2 --- /dev/null +++ b/internal/endtoend/testdata/between_args/mysql/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE products ( + id BIGINT NOT NULL AUTO_INCREMENT, + name TEXT NOT NULL, + price INT NOT NULL, + PRIMARY KEY (id) +); + diff --git a/internal/endtoend/testdata/between_args/mysql/sqlc.json b/internal/endtoend/testdata/between_args/mysql/sqlc.json index 9bb6e56fd0..f0d61c7e82 100644 --- a/internal/endtoend/testdata/between_args/mysql/sqlc.json +++ b/internal/endtoend/testdata/between_args/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/between_args/sqlite/go/db.go b/internal/endtoend/testdata/between_args/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/between_args/sqlite/go/db.go +++ b/internal/endtoend/testdata/between_args/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/between_args/sqlite/go/models.go b/internal/endtoend/testdata/between_args/sqlite/go/models.go index 9d6fdf8f18..d03b9b329b 100644 --- a/internal/endtoend/testdata/between_args/sqlite/go/models.go +++ b/internal/endtoend/testdata/between_args/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Product struct { Name string Price int64 diff --git a/internal/endtoend/testdata/between_args/sqlite/go/query.sql.go b/internal/endtoend/testdata/between_args/sqlite/go/query.sql.go index 8fdca27665..4265ed944d 100644 --- a/internal/endtoend/testdata/between_args/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/between_args/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/between_args/sqlite/query.sql b/internal/endtoend/testdata/between_args/sqlite/query.sql index f2984f9822..a7648ca582 100644 --- a/internal/endtoend/testdata/between_args/sqlite/query.sql +++ b/internal/endtoend/testdata/between_args/sqlite/query.sql @@ -1,8 +1,3 @@ -CREATE TABLE products ( - name TEXT NOT NULL, - price INT NOT NULL -); - -- name: GetBetweenPrices :many SELECT * FROM products diff --git a/internal/endtoend/testdata/between_args/sqlite/schema.sql b/internal/endtoend/testdata/between_args/sqlite/schema.sql new file mode 100644 index 0000000000..b13fafb48e --- /dev/null +++ b/internal/endtoend/testdata/between_args/sqlite/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE products ( + name TEXT NOT NULL, + price INT NOT NULL +); + diff --git a/internal/endtoend/testdata/between_args/sqlite/sqlc.json b/internal/endtoend/testdata/between_args/sqlite/sqlc.json index 6f0ca7541c..494a33e004 100644 --- a/internal/endtoend/testdata/between_args/sqlite/sqlc.json +++ b/internal/endtoend/testdata/between_args/sqlite/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "sqlite", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/bit_string/pgx/v4/go/db.go b/internal/endtoend/testdata/bit_string/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/bit_string/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/bit_string/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/bit_string/pgx/v4/go/models.go b/internal/endtoend/testdata/bit_string/pgx/v4/go/models.go index ce7ffea6a5..0c086e39e1 100644 --- a/internal/endtoend/testdata/bit_string/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/bit_string/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/bit_string/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/bit_string/pgx/v4/go/query.sql.go index 2cc808cbe2..c69ebfb265 100644 --- a/internal/endtoend/testdata/bit_string/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/bit_string/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/bit_string/pgx/v4/query.sql b/internal/endtoend/testdata/bit_string/pgx/v4/query.sql index 20405dc52e..3ab56eee50 100644 --- a/internal/endtoend/testdata/bit_string/pgx/v4/query.sql +++ b/internal/endtoend/testdata/bit_string/pgx/v4/query.sql @@ -1,11 +1,3 @@ -CREATE TABLE test_table -( - v_bit_null bit(3), - v_varbit_null bit varying(3), - v_bit bit(3) not null, - v_varbit bit varying(3) not null -); - -- name: SelectTest :many SELECT * from test_table; diff --git a/internal/endtoend/testdata/bit_string/pgx/v4/schema.sql b/internal/endtoend/testdata/bit_string/pgx/v4/schema.sql new file mode 100644 index 0000000000..0790c781d8 --- /dev/null +++ b/internal/endtoend/testdata/bit_string/pgx/v4/schema.sql @@ -0,0 +1,8 @@ +CREATE TABLE test_table +( + v_bit_null bit(3), + v_varbit_null bit varying(3), + v_bit bit(3) not null, + v_varbit bit varying(3) not null +); + diff --git a/internal/endtoend/testdata/bit_string/pgx/v4/sqlc.json b/internal/endtoend/testdata/bit_string/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/bit_string/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/bit_string/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/bit_string/pgx/v5/go/db.go b/internal/endtoend/testdata/bit_string/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/bit_string/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/bit_string/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/bit_string/pgx/v5/go/models.go b/internal/endtoend/testdata/bit_string/pgx/v5/go/models.go index 6fc89fd265..0b1dad3b41 100644 --- a/internal/endtoend/testdata/bit_string/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/bit_string/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/bit_string/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/bit_string/pgx/v5/go/query.sql.go index 2cc808cbe2..c69ebfb265 100644 --- a/internal/endtoend/testdata/bit_string/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/bit_string/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/bit_string/pgx/v5/query.sql b/internal/endtoend/testdata/bit_string/pgx/v5/query.sql index 20405dc52e..3ab56eee50 100644 --- a/internal/endtoend/testdata/bit_string/pgx/v5/query.sql +++ b/internal/endtoend/testdata/bit_string/pgx/v5/query.sql @@ -1,11 +1,3 @@ -CREATE TABLE test_table -( - v_bit_null bit(3), - v_varbit_null bit varying(3), - v_bit bit(3) not null, - v_varbit bit varying(3) not null -); - -- name: SelectTest :many SELECT * from test_table; diff --git a/internal/endtoend/testdata/bit_string/pgx/v5/schema.sql b/internal/endtoend/testdata/bit_string/pgx/v5/schema.sql new file mode 100644 index 0000000000..0790c781d8 --- /dev/null +++ b/internal/endtoend/testdata/bit_string/pgx/v5/schema.sql @@ -0,0 +1,8 @@ +CREATE TABLE test_table +( + v_bit_null bit(3), + v_varbit_null bit varying(3), + v_bit bit(3) not null, + v_varbit bit varying(3) not null +); + diff --git a/internal/endtoend/testdata/bit_string/pgx/v5/sqlc.json b/internal/endtoend/testdata/bit_string/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/bit_string/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/bit_string/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..60956b99c4 --- /dev/null +++ b/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/db.go @@ -0,0 +1,33 @@ +//go:build some_tag + +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package authors + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..4365cb07ec --- /dev/null +++ b/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/models.go @@ -0,0 +1,17 @@ +//go:build some_tag + +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package authors + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/querier.go b/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/querier.go new file mode 100644 index 0000000000..0fe1b09fe9 --- /dev/null +++ b/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/querier.go @@ -0,0 +1,20 @@ +//go:build some_tag + +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package authors + +import ( + "context" +) + +type Querier interface { + CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) + DeleteAuthor(ctx context.Context, id int64) error + GetAuthor(ctx context.Context, id int64) (Author, error) + ListAuthors(ctx context.Context) ([]Author, error) +} + +var _ Querier = (*Queries)(nil) diff --git a/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/query.sql.go new file mode 100644 index 0000000000..9dc153a3aa --- /dev/null +++ b/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,84 @@ +//go:build some_tag + +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package authors + +import ( + "context" + "database/sql" +) + +const createAuthor = `-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +RETURNING id, name, bio +` + +type CreateAuthorParams struct { + Name string + Bio sql.NullString +} + +func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { + row := q.db.QueryRowContext(ctx, createAuthor, arg.Name, arg.Bio) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} + +const deleteAuthor = `-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = $1 +` + +func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { + _, err := q.db.ExecContext(ctx, deleteAuthor, id) + return err +} + +const getAuthor = `-- name: GetAuthor :one +SELECT id, name, bio FROM authors +WHERE id = $1 LIMIT 1 +` + +func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { + row := q.db.QueryRowContext(ctx, getAuthor, id) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name, bio FROM authors +ORDER BY name +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan(&i.ID, &i.Name, &i.Bio); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/emit_pydantic_models/postgresql/query.sql b/internal/endtoend/testdata/build_tags/postgresql/stdlib/query.sql similarity index 100% rename from internal/endtoend/testdata/emit_pydantic_models/postgresql/query.sql rename to internal/endtoend/testdata/build_tags/postgresql/stdlib/query.sql diff --git a/internal/endtoend/testdata/emit_pydantic_models/postgresql/schema.sql b/internal/endtoend/testdata/build_tags/postgresql/stdlib/schema.sql similarity index 100% rename from internal/endtoend/testdata/emit_pydantic_models/postgresql/schema.sql rename to internal/endtoend/testdata/build_tags/postgresql/stdlib/schema.sql diff --git a/internal/endtoend/testdata/build_tags/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/build_tags/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..3255dad106 --- /dev/null +++ b/internal/endtoend/testdata/build_tags/postgresql/stdlib/sqlc.json @@ -0,0 +1,15 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "authors", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql", + "omit_unused_structs": true, + "emit_interface": true, + "build_tags": "some_tag" + } + ] +} diff --git a/internal/endtoend/testdata/builtins/postgresql/exec.json b/internal/endtoend/testdata/builtins/postgresql/exec.json new file mode 100644 index 0000000000..97f81fbc66 --- /dev/null +++ b/internal/endtoend/testdata/builtins/postgresql/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/builtins/postgresql/go/db.go b/internal/endtoend/testdata/builtins/postgresql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/builtins/postgresql/go/db.go +++ b/internal/endtoend/testdata/builtins/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/builtins/postgresql/go/models.go b/internal/endtoend/testdata/builtins/postgresql/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/builtins/postgresql/go/models.go +++ b/internal/endtoend/testdata/builtins/postgresql/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/builtins/postgresql/go/query.sql.go b/internal/endtoend/testdata/builtins/postgresql/go/query.sql.go new file mode 100644 index 0000000000..1c72cea1c8 --- /dev/null +++ b/internal/endtoend/testdata/builtins/postgresql/go/query.sql.go @@ -0,0 +1,274 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const abs = `-- name: Abs :one +SELECT abs(-17.4) +` + +func (q *Queries) Abs(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, abs) + var abs int64 + err := row.Scan(&abs) + return abs, err +} + +const cbrt = `-- name: Cbrt :one +SELECT cbrt(27.0) +` + +func (q *Queries) Cbrt(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, cbrt) + var cbrt float64 + err := row.Scan(&cbrt) + return cbrt, err +} + +const ceil = `-- name: Ceil :one +SELECT ceil(-42.8) +` + +func (q *Queries) Ceil(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, ceil) + var ceil float64 + err := row.Scan(&ceil) + return ceil, err +} + +const ceiling = `-- name: Ceiling :one +SELECT ceiling(-95.3) +` + +func (q *Queries) Ceiling(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, ceiling) + var ceiling float64 + err := row.Scan(&ceiling) + return ceiling, err +} + +const degrees = `-- name: Degrees :one +SELECT degrees(0.5) +` + +func (q *Queries) Degrees(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, degrees) + var degrees float64 + err := row.Scan(°rees) + return degrees, err +} + +const div = `-- name: Div :one +SELECT div(9,4) +` + +func (q *Queries) Div(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, div) + var div string + err := row.Scan(&div) + return div, err +} + +const exp = `-- name: Exp :one +SELECT exp(1.0) +` + +func (q *Queries) Exp(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, exp) + var exp float64 + err := row.Scan(&exp) + return exp, err +} + +const floor = `-- name: Floor :one +SELECT floor(-42.8) +` + +func (q *Queries) Floor(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, floor) + var floor float64 + err := row.Scan(&floor) + return floor, err +} + +const ln = `-- name: Ln :one +SELECT ln(2.0) +` + +func (q *Queries) Ln(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, ln) + var ln float64 + err := row.Scan(&ln) + return ln, err +} + +const log = `-- name: Log :one +SELECT log(100.0) +` + +func (q *Queries) Log(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, log) + var log float64 + err := row.Scan(&log) + return log, err +} + +const logs = `-- name: Logs :one +SELECT log(2.0, 64.0) +` + +func (q *Queries) Logs(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, logs) + var log string + err := row.Scan(&log) + return log, err +} + +const mod = `-- name: Mod :one +SELECT mod(9,4) +` + +func (q *Queries) Mod(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, mod) + var mod int64 + err := row.Scan(&mod) + return mod, err +} + +const pi = `-- name: Pi :one +SELECT pi() +` + +func (q *Queries) Pi(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, pi) + var pi float64 + err := row.Scan(&pi) + return pi, err +} + +const power = `-- name: Power :one +SELECT power(9.0, 3.0) +` + +func (q *Queries) Power(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, power) + var power float64 + err := row.Scan(&power) + return power, err +} + +const radians = `-- name: Radians :one +SELECT radians(45.0) +` + +func (q *Queries) Radians(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, radians) + var radians float64 + err := row.Scan(&radians) + return radians, err +} + +const round = `-- name: Round :one +SELECT round(42.4) +` + +func (q *Queries) Round(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, round) + var round float64 + err := row.Scan(&round) + return round, err +} + +const rounds = `-- name: Rounds :one +SELECT round(42.4382, 2) +` + +func (q *Queries) Rounds(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, rounds) + var round string + err := row.Scan(&round) + return round, err +} + +const scale = `-- name: Scale :one +SELECT scale(8.41) +` + +func (q *Queries) Scale(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, scale) + var scale int32 + err := row.Scan(&scale) + return scale, err +} + +const sign = `-- name: Sign :one +SELECT sign(-8.4) +` + +func (q *Queries) Sign(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, sign) + var sign float64 + err := row.Scan(&sign) + return sign, err +} + +const sqrt = `-- name: Sqrt :one +SELECT sqrt(2.0) +` + +func (q *Queries) Sqrt(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, sqrt) + var sqrt float64 + err := row.Scan(&sqrt) + return sqrt, err +} + +const trunc = `-- name: Trunc :one +SELECT trunc(42.8) +` + +func (q *Queries) Trunc(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, trunc) + var trunc float64 + err := row.Scan(&trunc) + return trunc, err +} + +const truncs = `-- name: Truncs :one +SELECT trunc(42.4382, 2) +` + +func (q *Queries) Truncs(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, truncs) + var trunc string + err := row.Scan(&trunc) + return trunc, err +} + +const widthBucketNumerics = `-- name: WidthBucketNumerics :one +SELECT width_bucket(5.35, 0.024, 10.06, 5) +` + +func (q *Queries) WidthBucketNumerics(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, widthBucketNumerics) + var width_bucket int32 + err := row.Scan(&width_bucket) + return width_bucket, err +} + +const widthBucketTimestamps = `-- name: WidthBucketTimestamps :one +SELECT width_bucket(now(), array['yesterday', 'today', 'tomorrow']::timestamptz[]) +` + +func (q *Queries) WidthBucketTimestamps(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, widthBucketTimestamps) + var width_bucket int32 + err := row.Scan(&width_bucket) + return width_bucket, err +} diff --git a/internal/endtoend/testdata/builtins/postgresql/query.sql b/internal/endtoend/testdata/builtins/postgresql/query.sql index ee4723f8ed..2c62e5f772 100644 --- a/internal/endtoend/testdata/builtins/postgresql/query.sql +++ b/internal/endtoend/testdata/builtins/postgresql/query.sql @@ -1,25 +1,48 @@ +-- name: Abs :one SELECT abs(-17.4); +-- name: Cbrt :one SELECT cbrt(27.0); +-- name: Ceil :one SELECT ceil(-42.8); +-- name: Ceiling :one SELECT ceiling(-95.3); +-- name: Degrees :one SELECT degrees(0.5); +-- name: Div :one SELECT div(9,4); +-- name: Exp :one SELECT exp(1.0); +-- name: Floor :one SELECT floor(-42.8); +-- name: Ln :one SELECT ln(2.0); +-- name: Log :one SELECT log(100.0); +-- name: Logs :one SELECT log(2.0, 64.0); +-- name: Mod :one SELECT mod(9,4); +-- name: Pi :one SELECT pi(); +-- name: Power :one SELECT power(9.0, 3.0); +-- name: Radians :one SELECT radians(45.0); +-- name: Round :one SELECT round(42.4); +-- name: Rounds :one SELECT round(42.4382, 2); +-- name: Scale :one SELECT scale(8.41); +-- name: Sign :one SELECT sign(-8.4); +-- name: Sqrt :one SELECT sqrt(2.0); +-- name: Trunc :one SELECT trunc(42.8); +-- name: Truncs :one SELECT trunc(42.4382, 2); +-- name: WidthBucketNumerics :one SELECT width_bucket(5.35, 0.024, 10.06, 5); +-- name: WidthBucketTimestamps :one SELECT width_bucket(now(), array['yesterday', 'today', 'tomorrow']::timestamptz[]); -create schema if not exists sqlc; diff --git a/internal/endtoend/testdata/builtins/postgresql/schema.sql b/internal/endtoend/testdata/builtins/postgresql/schema.sql new file mode 100644 index 0000000000..1974548e2b --- /dev/null +++ b/internal/endtoend/testdata/builtins/postgresql/schema.sql @@ -0,0 +1,2 @@ +create schema if not exists sqlc; + diff --git a/internal/endtoend/testdata/builtins/postgresql/sqlc.json b/internal/endtoend/testdata/builtins/postgresql/sqlc.json index bc05cb0384..dbe55e66a6 100644 --- a/internal/endtoend/testdata/builtins/postgresql/sqlc.json +++ b/internal/endtoend/testdata/builtins/postgresql/sqlc.json @@ -4,8 +4,8 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] -} \ No newline at end of file +} diff --git a/internal/endtoend/testdata/builtins/sqlite/go/aggfunc.sql.go b/internal/endtoend/testdata/builtins/sqlite/go/aggfunc.sql.go index 0cd44e32b8..370401e4d7 100644 --- a/internal/endtoend/testdata/builtins/sqlite/go/aggfunc.sql.go +++ b/internal/endtoend/testdata/builtins/sqlite/go/aggfunc.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: aggfunc.sql package querytest diff --git a/internal/endtoend/testdata/builtins/sqlite/go/db.go b/internal/endtoend/testdata/builtins/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/builtins/sqlite/go/db.go +++ b/internal/endtoend/testdata/builtins/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/builtins/sqlite/go/mathfunc.sql.go b/internal/endtoend/testdata/builtins/sqlite/go/mathfunc.sql.go index f83814a94a..bc1532576b 100644 --- a/internal/endtoend/testdata/builtins/sqlite/go/mathfunc.sql.go +++ b/internal/endtoend/testdata/builtins/sqlite/go/mathfunc.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: mathfunc.sql package querytest diff --git a/internal/endtoend/testdata/builtins/sqlite/go/models.go b/internal/endtoend/testdata/builtins/sqlite/go/models.go index 7ed428673c..ba96e73b83 100644 --- a/internal/endtoend/testdata/builtins/sqlite/go/models.go +++ b/internal/endtoend/testdata/builtins/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Test struct { ID int64 IntVal int64 diff --git a/internal/endtoend/testdata/builtins/sqlite/go/scalarfunc.sql.go b/internal/endtoend/testdata/builtins/sqlite/go/scalarfunc.sql.go index a920c10b9a..a54cb8134c 100644 --- a/internal/endtoend/testdata/builtins/sqlite/go/scalarfunc.sql.go +++ b/internal/endtoend/testdata/builtins/sqlite/go/scalarfunc.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: scalarfunc.sql package querytest diff --git a/internal/endtoend/testdata/case_named_params/mysql/go/db.go b/internal/endtoend/testdata/case_named_params/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/case_named_params/mysql/go/db.go +++ b/internal/endtoend/testdata/case_named_params/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/case_named_params/mysql/go/models.go b/internal/endtoend/testdata/case_named_params/mysql/go/models.go index eeab96d306..34088348d6 100644 --- a/internal/endtoend/testdata/case_named_params/mysql/go/models.go +++ b/internal/endtoend/testdata/case_named_params/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/case_named_params/mysql/go/query.sql.go b/internal/endtoend/testdata/case_named_params/mysql/go/query.sql.go index e1ad20cf29..54d0542f78 100644 --- a/internal/endtoend/testdata/case_named_params/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/case_named_params/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/case_named_params/mysql/query.sql b/internal/endtoend/testdata/case_named_params/mysql/query.sql index ef5deca36c..523c946815 100644 --- a/internal/endtoend/testdata/case_named_params/mysql/query.sql +++ b/internal/endtoend/testdata/case_named_params/mysql/query.sql @@ -1,15 +1,3 @@ --- https://github.com/sqlc-dev/sqlc/issues/1195 - -CREATE TABLE authors ( - id BIGINT PRIMARY KEY, - username TEXT NULL, - email TEXT NULL, - name TEXT NOT NULL, - bio TEXT, - UNIQUE KEY idx_username (username), - UNIQUE KEY ids_email (email) -); - -- name: ListAuthors :one SELECT * FROM authors diff --git a/internal/endtoend/testdata/case_named_params/mysql/schema.sql b/internal/endtoend/testdata/case_named_params/mysql/schema.sql new file mode 100644 index 0000000000..5e2bcfacf0 --- /dev/null +++ b/internal/endtoend/testdata/case_named_params/mysql/schema.sql @@ -0,0 +1,12 @@ +-- https://github.com/sqlc-dev/sqlc/issues/1195 + +CREATE TABLE authors ( + id BIGINT PRIMARY KEY, + username VARCHAR(10) NULL, + email VARCHAR(10) NULL, + name TEXT NOT NULL, + bio TEXT, + UNIQUE KEY idx_username (username), + UNIQUE KEY ids_email (email) +); + diff --git a/internal/endtoend/testdata/case_named_params/mysql/sqlc.json b/internal/endtoend/testdata/case_named_params/mysql/sqlc.json index 534b7e24e9..0390f67889 100644 --- a/internal/endtoend/testdata/case_named_params/mysql/sqlc.json +++ b/internal/endtoend/testdata/case_named_params/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/case_named_params/postgresql/go/db.go b/internal/endtoend/testdata/case_named_params/postgresql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/case_named_params/postgresql/go/db.go +++ b/internal/endtoend/testdata/case_named_params/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/case_named_params/postgresql/go/models.go b/internal/endtoend/testdata/case_named_params/postgresql/go/models.go index eeab96d306..34088348d6 100644 --- a/internal/endtoend/testdata/case_named_params/postgresql/go/models.go +++ b/internal/endtoend/testdata/case_named_params/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/case_named_params/postgresql/go/query.sql.go b/internal/endtoend/testdata/case_named_params/postgresql/go/query.sql.go index ae222375ca..fda09df343 100644 --- a/internal/endtoend/testdata/case_named_params/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/case_named_params/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/case_named_params/postgresql/query.sql b/internal/endtoend/testdata/case_named_params/postgresql/query.sql index a4e653aee4..d677a6f7d8 100644 --- a/internal/endtoend/testdata/case_named_params/postgresql/query.sql +++ b/internal/endtoend/testdata/case_named_params/postgresql/query.sql @@ -1,13 +1,3 @@ --- https://github.com/sqlc-dev/sqlc/issues/1195 - -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - username TEXT NULL, - email TEXT NULL, - name TEXT NOT NULL, - bio TEXT -); - -- name: ListAuthors :one SELECT * FROM authors diff --git a/internal/endtoend/testdata/case_named_params/postgresql/schema.sql b/internal/endtoend/testdata/case_named_params/postgresql/schema.sql new file mode 100644 index 0000000000..c9b66c8760 --- /dev/null +++ b/internal/endtoend/testdata/case_named_params/postgresql/schema.sql @@ -0,0 +1,10 @@ +-- https://github.com/sqlc-dev/sqlc/issues/1195 + +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + username TEXT NULL, + email TEXT NULL, + name TEXT NOT NULL, + bio TEXT +); + diff --git a/internal/endtoend/testdata/case_named_params/postgresql/sqlc.json b/internal/endtoend/testdata/case_named_params/postgresql/sqlc.json index af57681f66..a590361309 100644 --- a/internal/endtoend/testdata/case_named_params/postgresql/sqlc.json +++ b/internal/endtoend/testdata/case_named_params/postgresql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/case_named_params/sqlite/go/db.go b/internal/endtoend/testdata/case_named_params/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/case_named_params/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/case_named_params/sqlite/go/models.go b/internal/endtoend/testdata/case_named_params/sqlite/go/models.go new file mode 100644 index 0000000000..72d21e0408 --- /dev/null +++ b/internal/endtoend/testdata/case_named_params/sqlite/go/models.go @@ -0,0 +1,17 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Username interface{} + Email interface{} + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/case_named_params/sqlite/go/query.sql.go b/internal/endtoend/testdata/case_named_params/sqlite/go/query.sql.go new file mode 100644 index 0000000000..296eef7593 --- /dev/null +++ b/internal/endtoend/testdata/case_named_params/sqlite/go/query.sql.go @@ -0,0 +1,36 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listAuthors = `-- name: ListAuthors :one +SELECT id, username, email, name, bio +FROM authors +WHERE email = CASE WHEN ?1 = '' then NULL else ?1 END + OR username = CASE WHEN ?2 = '' then NULL else ?2 END +LIMIT 1 +` + +type ListAuthorsParams struct { + Email interface{} + Username interface{} +} + +func (q *Queries) ListAuthors(ctx context.Context, arg ListAuthorsParams) (Author, error) { + row := q.db.QueryRowContext(ctx, listAuthors, arg.Email, arg.Username) + var i Author + err := row.Scan( + &i.ID, + &i.Username, + &i.Email, + &i.Name, + &i.Bio, + ) + return i, err +} diff --git a/internal/endtoend/testdata/case_named_params/sqlite/query.sql b/internal/endtoend/testdata/case_named_params/sqlite/query.sql new file mode 100644 index 0000000000..39d990902a --- /dev/null +++ b/internal/endtoend/testdata/case_named_params/sqlite/query.sql @@ -0,0 +1,6 @@ +-- name: ListAuthors :one +SELECT * +FROM authors +WHERE email = CASE WHEN sqlc.arg(email) = '' then NULL else sqlc.arg(email) END + OR username = CASE WHEN sqlc.arg(username) = '' then NULL else sqlc.arg(username) END +LIMIT 1; diff --git a/internal/endtoend/testdata/case_named_params/sqlite/schema.sql b/internal/endtoend/testdata/case_named_params/sqlite/schema.sql new file mode 100644 index 0000000000..0d6facced1 --- /dev/null +++ b/internal/endtoend/testdata/case_named_params/sqlite/schema.sql @@ -0,0 +1,8 @@ +CREATE TABLE authors ( + id INTEGER PRIMARY KEY, + username TEXT NULL, + email TEXT NULL, + name TEXT NOT NULL, + bio TEXT +); + diff --git a/internal/endtoend/testdata/case_named_params/sqlite/sqlc.json b/internal/endtoend/testdata/case_named_params/sqlite/sqlc.json new file mode 100644 index 0000000000..95b9cd09c0 --- /dev/null +++ b/internal/endtoend/testdata/case_named_params/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/case_sensitive/sqlite/go/db.go b/internal/endtoend/testdata/case_sensitive/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/case_sensitive/sqlite/go/db.go +++ b/internal/endtoend/testdata/case_sensitive/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/case_sensitive/sqlite/go/models.go b/internal/endtoend/testdata/case_sensitive/sqlite/go/models.go index cbd9b0e495..fe54e54809 100644 --- a/internal/endtoend/testdata/case_sensitive/sqlite/go/models.go +++ b/internal/endtoend/testdata/case_sensitive/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/case_sensitive/sqlite/go/query.sql.go b/internal/endtoend/testdata/case_sensitive/sqlite/go/query.sql.go index 9c81d090e4..b6c08e7713 100644 --- a/internal/endtoend/testdata/case_sensitive/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/case_sensitive/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/case_sensitive/sqlite/query.sql b/internal/endtoend/testdata/case_sensitive/sqlite/query.sql index 82616fd664..0c05277ef4 100644 --- a/internal/endtoend/testdata/case_sensitive/sqlite/query.sql +++ b/internal/endtoend/testdata/case_sensitive/sqlite/query.sql @@ -1,8 +1,3 @@ -CREATE TABLE contacts ( - pid TEXT, - CustomerName TEXT -); - -- name: InsertContact :exec INSERT INTO contacts ( pid, diff --git a/internal/endtoend/testdata/case_sensitive/sqlite/schema.sql b/internal/endtoend/testdata/case_sensitive/sqlite/schema.sql new file mode 100644 index 0000000000..af6e1131c6 --- /dev/null +++ b/internal/endtoend/testdata/case_sensitive/sqlite/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE contacts ( + pid TEXT, + CustomerName TEXT +); + diff --git a/internal/endtoend/testdata/case_sensitive/sqlite/sqlc.json b/internal/endtoend/testdata/case_sensitive/sqlite/sqlc.json index fd6d575377..99b3b5f074 100644 --- a/internal/endtoend/testdata/case_sensitive/sqlite/sqlc.json +++ b/internal/endtoend/testdata/case_sensitive/sqlite/sqlc.json @@ -1 +1 @@ -{"version": "1", "packages": [{"path": "go", "engine": "sqlite", "schema": "query.sql", "queries": "query.sql", "name": "querytest"}]} \ No newline at end of file +{"version": "1", "packages": [{"path": "go", "engine": "sqlite", "schema": "schema.sql", "queries": "query.sql", "name": "querytest"}]} \ No newline at end of file diff --git a/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/db.go b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/models.go b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/models.go index 91961addfb..ef6e41447e 100644 --- a/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { ID string } diff --git a/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/query.sql.go index 9e45f24968..48d37ec374 100644 --- a/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/case_stmt_bool/pgx/v4/query.sql b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/query.sql index 822b1dd8f5..604393ba65 100644 --- a/internal/endtoend/testdata/case_stmt_bool/pgx/v4/query.sql +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (id text not null); - -- name: CaseStatementBoolean :many SELECT CASE WHEN id = $1 THEN true diff --git a/internal/endtoend/testdata/case_stmt_bool/pgx/v4/schema.sql b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/schema.sql new file mode 100644 index 0000000000..1576c819ea --- /dev/null +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id text not null); + diff --git a/internal/endtoend/testdata/case_stmt_bool/pgx/v4/sqlc.json b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/case_stmt_bool/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/db.go b/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/models.go b/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/models.go index 91961addfb..ef6e41447e 100644 --- a/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { ID string } diff --git a/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/query.sql.go index 9e45f24968..48d37ec374 100644 --- a/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/case_stmt_bool/pgx/v5/query.sql b/internal/endtoend/testdata/case_stmt_bool/pgx/v5/query.sql index 822b1dd8f5..604393ba65 100644 --- a/internal/endtoend/testdata/case_stmt_bool/pgx/v5/query.sql +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v5/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (id text not null); - -- name: CaseStatementBoolean :many SELECT CASE WHEN id = $1 THEN true diff --git a/internal/endtoend/testdata/case_stmt_bool/pgx/v5/schema.sql b/internal/endtoend/testdata/case_stmt_bool/pgx/v5/schema.sql new file mode 100644 index 0000000000..1576c819ea --- /dev/null +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id text not null); + diff --git a/internal/endtoend/testdata/case_stmt_bool/pgx/v5/sqlc.json b/internal/endtoend/testdata/case_stmt_bool/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/case_stmt_bool/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/case_stmt_bool/stdlib/go/db.go b/internal/endtoend/testdata/case_stmt_bool/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/case_stmt_bool/stdlib/go/db.go +++ b/internal/endtoend/testdata/case_stmt_bool/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/case_stmt_bool/stdlib/go/models.go b/internal/endtoend/testdata/case_stmt_bool/stdlib/go/models.go index 91961addfb..ef6e41447e 100644 --- a/internal/endtoend/testdata/case_stmt_bool/stdlib/go/models.go +++ b/internal/endtoend/testdata/case_stmt_bool/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { ID string } diff --git a/internal/endtoend/testdata/case_stmt_bool/stdlib/go/query.sql.go b/internal/endtoend/testdata/case_stmt_bool/stdlib/go/query.sql.go index 323fd6a663..1bd6efb852 100644 --- a/internal/endtoend/testdata/case_stmt_bool/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/case_stmt_bool/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/case_stmt_bool/stdlib/query.sql b/internal/endtoend/testdata/case_stmt_bool/stdlib/query.sql index 822b1dd8f5..604393ba65 100644 --- a/internal/endtoend/testdata/case_stmt_bool/stdlib/query.sql +++ b/internal/endtoend/testdata/case_stmt_bool/stdlib/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (id text not null); - -- name: CaseStatementBoolean :many SELECT CASE WHEN id = $1 THEN true diff --git a/internal/endtoend/testdata/case_stmt_bool/stdlib/schema.sql b/internal/endtoend/testdata/case_stmt_bool/stdlib/schema.sql new file mode 100644 index 0000000000..1576c819ea --- /dev/null +++ b/internal/endtoend/testdata/case_stmt_bool/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id text not null); + diff --git a/internal/endtoend/testdata/case_stmt_bool/stdlib/sqlc.json b/internal/endtoend/testdata/case_stmt_bool/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/case_stmt_bool/stdlib/sqlc.json +++ b/internal/endtoend/testdata/case_stmt_bool/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/case_text/pgx/v4/go/db.go b/internal/endtoend/testdata/case_text/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/case_text/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/case_text/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/case_text/pgx/v4/go/models.go b/internal/endtoend/testdata/case_text/pgx/v4/go/models.go index 91961addfb..ef6e41447e 100644 --- a/internal/endtoend/testdata/case_text/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/case_text/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { ID string } diff --git a/internal/endtoend/testdata/case_text/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/case_text/pgx/v4/go/query.sql.go index b103a40c65..fe8d84420e 100644 --- a/internal/endtoend/testdata/case_text/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/case_text/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/case_text/pgx/v4/query.sql b/internal/endtoend/testdata/case_text/pgx/v4/query.sql index 857a74ff91..eff5ec28fb 100644 --- a/internal/endtoend/testdata/case_text/pgx/v4/query.sql +++ b/internal/endtoend/testdata/case_text/pgx/v4/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (id text not null); - -- name: CaseStatementText :many SELECT CASE WHEN id = $1 THEN 'foo' diff --git a/internal/endtoend/testdata/case_text/pgx/v4/schema.sql b/internal/endtoend/testdata/case_text/pgx/v4/schema.sql new file mode 100644 index 0000000000..1576c819ea --- /dev/null +++ b/internal/endtoend/testdata/case_text/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id text not null); + diff --git a/internal/endtoend/testdata/case_text/pgx/v4/sqlc.json b/internal/endtoend/testdata/case_text/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/case_text/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/case_text/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/case_text/pgx/v5/go/db.go b/internal/endtoend/testdata/case_text/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/case_text/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/case_text/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/case_text/pgx/v5/go/models.go b/internal/endtoend/testdata/case_text/pgx/v5/go/models.go index 91961addfb..ef6e41447e 100644 --- a/internal/endtoend/testdata/case_text/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/case_text/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { ID string } diff --git a/internal/endtoend/testdata/case_text/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/case_text/pgx/v5/go/query.sql.go index b103a40c65..fe8d84420e 100644 --- a/internal/endtoend/testdata/case_text/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/case_text/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/case_text/pgx/v5/query.sql b/internal/endtoend/testdata/case_text/pgx/v5/query.sql index 857a74ff91..eff5ec28fb 100644 --- a/internal/endtoend/testdata/case_text/pgx/v5/query.sql +++ b/internal/endtoend/testdata/case_text/pgx/v5/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (id text not null); - -- name: CaseStatementText :many SELECT CASE WHEN id = $1 THEN 'foo' diff --git a/internal/endtoend/testdata/case_text/pgx/v5/schema.sql b/internal/endtoend/testdata/case_text/pgx/v5/schema.sql new file mode 100644 index 0000000000..1576c819ea --- /dev/null +++ b/internal/endtoend/testdata/case_text/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id text not null); + diff --git a/internal/endtoend/testdata/case_text/pgx/v5/sqlc.json b/internal/endtoend/testdata/case_text/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/case_text/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/case_text/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/case_text/stdlib/go/db.go b/internal/endtoend/testdata/case_text/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/case_text/stdlib/go/db.go +++ b/internal/endtoend/testdata/case_text/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/case_text/stdlib/go/models.go b/internal/endtoend/testdata/case_text/stdlib/go/models.go index 91961addfb..ef6e41447e 100644 --- a/internal/endtoend/testdata/case_text/stdlib/go/models.go +++ b/internal/endtoend/testdata/case_text/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { ID string } diff --git a/internal/endtoend/testdata/case_text/stdlib/go/query.sql.go b/internal/endtoend/testdata/case_text/stdlib/go/query.sql.go index 1711b5ae08..5856ff2f69 100644 --- a/internal/endtoend/testdata/case_text/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/case_text/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/case_text/stdlib/query.sql b/internal/endtoend/testdata/case_text/stdlib/query.sql index 857a74ff91..eff5ec28fb 100644 --- a/internal/endtoend/testdata/case_text/stdlib/query.sql +++ b/internal/endtoend/testdata/case_text/stdlib/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (id text not null); - -- name: CaseStatementText :many SELECT CASE WHEN id = $1 THEN 'foo' diff --git a/internal/endtoend/testdata/case_text/stdlib/schema.sql b/internal/endtoend/testdata/case_text/stdlib/schema.sql new file mode 100644 index 0000000000..1576c819ea --- /dev/null +++ b/internal/endtoend/testdata/case_text/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id text not null); + diff --git a/internal/endtoend/testdata/case_text/stdlib/sqlc.json b/internal/endtoend/testdata/case_text/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/case_text/stdlib/sqlc.json +++ b/internal/endtoend/testdata/case_text/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/case_value_param/issue.md b/internal/endtoend/testdata/case_value_param/issue.md new file mode 100644 index 0000000000..c8ac2fa390 --- /dev/null +++ b/internal/endtoend/testdata/case_value_param/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/2847 diff --git a/internal/endtoend/testdata/case_value_param/mysql/go/db.go b/internal/endtoend/testdata/case_value_param/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/case_value_param/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/case_value_param/mysql/go/models.go b/internal/endtoend/testdata/case_value_param/mysql/go/models.go new file mode 100644 index 0000000000..aa87e2f1af --- /dev/null +++ b/internal/endtoend/testdata/case_value_param/mysql/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Testing struct { + ID int32 + Value sql.NullString +} diff --git a/internal/endtoend/testdata/case_value_param/mysql/go/query.sql.go b/internal/endtoend/testdata/case_value_param/mysql/go/query.sql.go new file mode 100644 index 0000000000..97330eb75e --- /dev/null +++ b/internal/endtoend/testdata/case_value_param/mysql/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const update = `-- name: Update :exec +UPDATE testing +SET value = CASE ? WHEN true THEN 'Hello' WHEN false THEN 'Goodbye' ELSE value END +` + +func (q *Queries) Update(ctx context.Context, value sql.NullString) error { + _, err := q.db.ExecContext(ctx, update, value) + return err +} diff --git a/internal/endtoend/testdata/case_value_param/mysql/query.sql b/internal/endtoend/testdata/case_value_param/mysql/query.sql new file mode 100644 index 0000000000..2c4e1f9889 --- /dev/null +++ b/internal/endtoend/testdata/case_value_param/mysql/query.sql @@ -0,0 +1,3 @@ +-- name: Update :exec +UPDATE testing +SET value = CASE ? WHEN true THEN 'Hello' WHEN false THEN 'Goodbye' ELSE value END; diff --git a/internal/endtoend/testdata/case_value_param/mysql/schema.sql b/internal/endtoend/testdata/case_value_param/mysql/schema.sql new file mode 100644 index 0000000000..556ca0b530 --- /dev/null +++ b/internal/endtoend/testdata/case_value_param/mysql/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE testing ( + id int PRIMARY KEY, + value text +); diff --git a/internal/endtoend/testdata/case_value_param/mysql/sqlc.yaml b/internal/endtoend/testdata/case_value_param/mysql/sqlc.yaml new file mode 100644 index 0000000000..b843ef55e3 --- /dev/null +++ b/internal/endtoend/testdata/case_value_param/mysql/sqlc.yaml @@ -0,0 +1,9 @@ +version: "2" +sql: + - engine: "mysql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" diff --git a/internal/endtoend/testdata/case_value_param/postgresql/exec.json b/internal/endtoend/testdata/case_value_param/postgresql/exec.json new file mode 100644 index 0000000000..97f81fbc66 --- /dev/null +++ b/internal/endtoend/testdata/case_value_param/postgresql/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/case_value_param/postgresql/go/db.go b/internal/endtoend/testdata/case_value_param/postgresql/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/case_value_param/postgresql/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/case_value_param/postgresql/go/models.go b/internal/endtoend/testdata/case_value_param/postgresql/go/models.go new file mode 100644 index 0000000000..9b6177de7b --- /dev/null +++ b/internal/endtoend/testdata/case_value_param/postgresql/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Testing struct { + ID int32 + Value pgtype.Text +} diff --git a/internal/endtoend/testdata/case_value_param/postgresql/go/query.sql.go b/internal/endtoend/testdata/case_value_param/postgresql/go/query.sql.go new file mode 100644 index 0000000000..e0c352e43b --- /dev/null +++ b/internal/endtoend/testdata/case_value_param/postgresql/go/query.sql.go @@ -0,0 +1,22 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const update = `-- name: Update :exec +UPDATE testing +SET value = CASE $1 WHEN true THEN 'Hello' WHEN false THEN 'Goodbye' ELSE value END +` + +func (q *Queries) Update(ctx context.Context, value pgtype.Text) error { + _, err := q.db.Exec(ctx, update, value) + return err +} diff --git a/internal/endtoend/testdata/case_value_param/postgresql/query.sql b/internal/endtoend/testdata/case_value_param/postgresql/query.sql new file mode 100644 index 0000000000..106653b43f --- /dev/null +++ b/internal/endtoend/testdata/case_value_param/postgresql/query.sql @@ -0,0 +1,3 @@ +-- name: Update :exec +UPDATE testing +SET value = CASE $1 WHEN true THEN 'Hello' WHEN false THEN 'Goodbye' ELSE value END; diff --git a/internal/endtoend/testdata/case_value_param/postgresql/schema.sql b/internal/endtoend/testdata/case_value_param/postgresql/schema.sql new file mode 100644 index 0000000000..556ca0b530 --- /dev/null +++ b/internal/endtoend/testdata/case_value_param/postgresql/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE testing ( + id int PRIMARY KEY, + value text +); diff --git a/internal/endtoend/testdata/case_value_param/postgresql/sqlc.yaml b/internal/endtoend/testdata/case_value_param/postgresql/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/case_value_param/postgresql/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/db.go b/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/models.go b/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/models.go index 353c2b0d63..92ddc7826f 100644 --- a/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/query.sql.go index 6ce6b7507b..9d1e88143a 100644 --- a/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cast_coalesce/pgx/v4/query.sql b/internal/endtoend/testdata/cast_coalesce/pgx/v4/query.sql index b3ca73e3ec..db193da18a 100644 --- a/internal/endtoend/testdata/cast_coalesce/pgx/v4/query.sql +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v4/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar text); - -- name: CastCoalesce :many SELECT coalesce(bar, '')::text as login FROM foo; diff --git a/internal/endtoend/testdata/cast_coalesce/pgx/v4/schema.sql b/internal/endtoend/testdata/cast_coalesce/pgx/v4/schema.sql new file mode 100644 index 0000000000..bd55621dc2 --- /dev/null +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); + diff --git a/internal/endtoend/testdata/cast_coalesce/pgx/v4/sqlc.json b/internal/endtoend/testdata/cast_coalesce/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/cast_coalesce/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/db.go b/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/models.go b/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/models.go index a6fa331406..f2fbf9abf3 100644 --- a/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/query.sql.go index 6ce6b7507b..9d1e88143a 100644 --- a/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cast_coalesce/pgx/v5/query.sql b/internal/endtoend/testdata/cast_coalesce/pgx/v5/query.sql index b3ca73e3ec..db193da18a 100644 --- a/internal/endtoend/testdata/cast_coalesce/pgx/v5/query.sql +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v5/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar text); - -- name: CastCoalesce :many SELECT coalesce(bar, '')::text as login FROM foo; diff --git a/internal/endtoend/testdata/cast_coalesce/pgx/v5/schema.sql b/internal/endtoend/testdata/cast_coalesce/pgx/v5/schema.sql new file mode 100644 index 0000000000..bd55621dc2 --- /dev/null +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); + diff --git a/internal/endtoend/testdata/cast_coalesce/pgx/v5/sqlc.json b/internal/endtoend/testdata/cast_coalesce/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/cast_coalesce/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/cast_coalesce/stdlib/go/db.go b/internal/endtoend/testdata/cast_coalesce/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/cast_coalesce/stdlib/go/db.go +++ b/internal/endtoend/testdata/cast_coalesce/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cast_coalesce/stdlib/go/models.go b/internal/endtoend/testdata/cast_coalesce/stdlib/go/models.go index 353c2b0d63..92ddc7826f 100644 --- a/internal/endtoend/testdata/cast_coalesce/stdlib/go/models.go +++ b/internal/endtoend/testdata/cast_coalesce/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cast_coalesce/stdlib/go/query.sql.go b/internal/endtoend/testdata/cast_coalesce/stdlib/go/query.sql.go index 5276686cc7..a155d78efe 100644 --- a/internal/endtoend/testdata/cast_coalesce/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/cast_coalesce/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cast_coalesce/stdlib/query.sql b/internal/endtoend/testdata/cast_coalesce/stdlib/query.sql index b3ca73e3ec..db193da18a 100644 --- a/internal/endtoend/testdata/cast_coalesce/stdlib/query.sql +++ b/internal/endtoend/testdata/cast_coalesce/stdlib/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar text); - -- name: CastCoalesce :many SELECT coalesce(bar, '')::text as login FROM foo; diff --git a/internal/endtoend/testdata/cast_coalesce/stdlib/schema.sql b/internal/endtoend/testdata/cast_coalesce/stdlib/schema.sql new file mode 100644 index 0000000000..bd55621dc2 --- /dev/null +++ b/internal/endtoend/testdata/cast_coalesce/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); + diff --git a/internal/endtoend/testdata/cast_coalesce/stdlib/sqlc.json b/internal/endtoend/testdata/cast_coalesce/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/cast_coalesce/stdlib/sqlc.json +++ b/internal/endtoend/testdata/cast_coalesce/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/cast_null/pgx/v4/go/db.go b/internal/endtoend/testdata/cast_null/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/cast_null/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/cast_null/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cast_null/pgx/v4/go/models.go b/internal/endtoend/testdata/cast_null/pgx/v4/go/models.go index 353c2b0d63..92ddc7826f 100644 --- a/internal/endtoend/testdata/cast_null/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/cast_null/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cast_null/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/cast_null/pgx/v4/go/query.sql.go index 14004f64b8..112ea86167 100644 --- a/internal/endtoend/testdata/cast_null/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/cast_null/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cast_null/pgx/v4/query.sql b/internal/endtoend/testdata/cast_null/pgx/v4/query.sql index b2a7a6ed81..ca3a9491bd 100644 --- a/internal/endtoend/testdata/cast_null/pgx/v4/query.sql +++ b/internal/endtoend/testdata/cast_null/pgx/v4/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar text); - -- name: ListNullable :many SELECT NULL::text as a, diff --git a/internal/endtoend/testdata/cast_null/pgx/v4/schema.sql b/internal/endtoend/testdata/cast_null/pgx/v4/schema.sql new file mode 100644 index 0000000000..bd55621dc2 --- /dev/null +++ b/internal/endtoend/testdata/cast_null/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); + diff --git a/internal/endtoend/testdata/cast_null/pgx/v4/sqlc.json b/internal/endtoend/testdata/cast_null/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/cast_null/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/cast_null/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/cast_null/pgx/v5/go/db.go b/internal/endtoend/testdata/cast_null/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/cast_null/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/cast_null/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cast_null/pgx/v5/go/models.go b/internal/endtoend/testdata/cast_null/pgx/v5/go/models.go index a6fa331406..f2fbf9abf3 100644 --- a/internal/endtoend/testdata/cast_null/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/cast_null/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cast_null/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/cast_null/pgx/v5/go/query.sql.go index 1726d097ec..65118d0419 100644 --- a/internal/endtoend/testdata/cast_null/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/cast_null/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cast_null/pgx/v5/query.sql b/internal/endtoend/testdata/cast_null/pgx/v5/query.sql index b2a7a6ed81..ca3a9491bd 100644 --- a/internal/endtoend/testdata/cast_null/pgx/v5/query.sql +++ b/internal/endtoend/testdata/cast_null/pgx/v5/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar text); - -- name: ListNullable :many SELECT NULL::text as a, diff --git a/internal/endtoend/testdata/cast_null/pgx/v5/schema.sql b/internal/endtoend/testdata/cast_null/pgx/v5/schema.sql new file mode 100644 index 0000000000..bd55621dc2 --- /dev/null +++ b/internal/endtoend/testdata/cast_null/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); + diff --git a/internal/endtoend/testdata/cast_null/pgx/v5/sqlc.json b/internal/endtoend/testdata/cast_null/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/cast_null/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/cast_null/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/cast_null/stdlib/go/db.go b/internal/endtoend/testdata/cast_null/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/cast_null/stdlib/go/db.go +++ b/internal/endtoend/testdata/cast_null/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cast_null/stdlib/go/models.go b/internal/endtoend/testdata/cast_null/stdlib/go/models.go index 353c2b0d63..92ddc7826f 100644 --- a/internal/endtoend/testdata/cast_null/stdlib/go/models.go +++ b/internal/endtoend/testdata/cast_null/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cast_null/stdlib/go/query.sql.go b/internal/endtoend/testdata/cast_null/stdlib/go/query.sql.go index d8bb47b220..627477f66f 100644 --- a/internal/endtoend/testdata/cast_null/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/cast_null/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cast_null/stdlib/query.sql b/internal/endtoend/testdata/cast_null/stdlib/query.sql index b2a7a6ed81..ca3a9491bd 100644 --- a/internal/endtoend/testdata/cast_null/stdlib/query.sql +++ b/internal/endtoend/testdata/cast_null/stdlib/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar text); - -- name: ListNullable :many SELECT NULL::text as a, diff --git a/internal/endtoend/testdata/cast_null/stdlib/schema.sql b/internal/endtoend/testdata/cast_null/stdlib/schema.sql new file mode 100644 index 0000000000..bd55621dc2 --- /dev/null +++ b/internal/endtoend/testdata/cast_null/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); + diff --git a/internal/endtoend/testdata/cast_null/stdlib/sqlc.json b/internal/endtoend/testdata/cast_null/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/cast_null/stdlib/sqlc.json +++ b/internal/endtoend/testdata/cast_null/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/cast_param/sqlite/go/db.go b/internal/endtoend/testdata/cast_param/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/cast_param/sqlite/go/db.go +++ b/internal/endtoend/testdata/cast_param/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cast_param/sqlite/go/models.go b/internal/endtoend/testdata/cast_param/sqlite/go/models.go index ee1c34b192..c20d34bc5f 100644 --- a/internal/endtoend/testdata/cast_param/sqlite/go/models.go +++ b/internal/endtoend/testdata/cast_param/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cast_param/sqlite/go/query.sql.go b/internal/endtoend/testdata/cast_param/sqlite/go/query.sql.go index 212cf5f384..3fad3fbb46 100644 --- a/internal/endtoend/testdata/cast_param/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/cast_param/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cast_param/sqlite/query.sql b/internal/endtoend/testdata/cast_param/sqlite/query.sql index 0353d74c84..53f8c0391c 100644 --- a/internal/endtoend/testdata/cast_param/sqlite/query.sql +++ b/internal/endtoend/testdata/cast_param/sqlite/query.sql @@ -1,9 +1,3 @@ -create table my_table -( - invalid boolean, - foo varchar -); - -- name: GetData :many select * from my_table diff --git a/internal/endtoend/testdata/cast_param/sqlite/schema.sql b/internal/endtoend/testdata/cast_param/sqlite/schema.sql new file mode 100644 index 0000000000..831af7c2bd --- /dev/null +++ b/internal/endtoend/testdata/cast_param/sqlite/schema.sql @@ -0,0 +1,6 @@ +create table my_table +( + invalid boolean, + foo varchar +); + diff --git a/internal/endtoend/testdata/cast_param/sqlite/sqlc.json b/internal/endtoend/testdata/cast_param/sqlite/sqlc.json index 3ed5eea856..ea4a23425f 100644 --- a/internal/endtoend/testdata/cast_param/sqlite/sqlc.json +++ b/internal/endtoend/testdata/cast_param/sqlite/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "engine": "sqlite", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "name": "querytest" } diff --git a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/db.go b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/models.go b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/models.go index e8c067f57e..42b69e9729 100644 --- a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/query.sql.go index 104beb663f..3e37867bec 100644 --- a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/query.sql b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/query.sql index b25692daba..3ab56eee50 100644 --- a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/query.sql +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/query.sql @@ -1,15 +1,3 @@ -CREATE TABLE test_table -( - v_cid_null cid, - v_oid_null oid, - v_tid_null tid, - v_xid_null xid, - v_cid cid not null, - v_oid oid not null, - v_tid tid not null, - v_xid xid not null -); - -- name: SelectTest :many SELECT * from test_table; diff --git a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/schema.sql b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/schema.sql new file mode 100644 index 0000000000..ecd09ac882 --- /dev/null +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/schema.sql @@ -0,0 +1,12 @@ +CREATE TABLE test_table +( + v_cid_null cid, + v_oid_null oid, + v_tid_null tid, + v_xid_null xid, + v_cid cid not null, + v_oid oid not null, + v_tid tid not null, + v_xid xid not null +); + diff --git a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/sqlc.json b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/db.go b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/models.go b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/models.go index aca7bb24c1..a8133f8ace 100644 --- a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/query.sql.go index 104beb663f..3e37867bec 100644 --- a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/query.sql b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/query.sql index b25692daba..3ab56eee50 100644 --- a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/query.sql +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/query.sql @@ -1,15 +1,3 @@ -CREATE TABLE test_table -( - v_cid_null cid, - v_oid_null oid, - v_tid_null tid, - v_xid_null xid, - v_cid cid not null, - v_oid oid not null, - v_tid tid not null, - v_xid xid not null -); - -- name: SelectTest :many SELECT * from test_table; diff --git a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/schema.sql b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/schema.sql new file mode 100644 index 0000000000..ecd09ac882 --- /dev/null +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/schema.sql @@ -0,0 +1,12 @@ +CREATE TABLE test_table +( + v_cid_null cid, + v_oid_null oid, + v_tid_null tid, + v_xid_null xid, + v_cid cid not null, + v_oid oid not null, + v_tid tid not null, + v_xid xid not null +); + diff --git a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/sqlc.json b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/citext/pgx/go/db.go b/internal/endtoend/testdata/citext/pgx/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/citext/pgx/go/db.go +++ b/internal/endtoend/testdata/citext/pgx/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/citext/pgx/go/models.go b/internal/endtoend/testdata/citext/pgx/go/models.go index 9bec929b73..ca947ee379 100644 --- a/internal/endtoend/testdata/citext/pgx/go/models.go +++ b/internal/endtoend/testdata/citext/pgx/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/citext/pgx/go/query.sql.go b/internal/endtoend/testdata/citext/pgx/go/query.sql.go index 718a7118df..6e5d9e9855 100644 --- a/internal/endtoend/testdata/citext/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/citext/pgx/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/citext/pgx/query.sql b/internal/endtoend/testdata/citext/pgx/query.sql index b686dec569..0c151ef5f6 100644 --- a/internal/endtoend/testdata/citext/pgx/query.sql +++ b/internal/endtoend/testdata/citext/pgx/query.sql @@ -1,10 +1,3 @@ -CREATE EXTENSION IF NOT EXISTS citext; - -CREATE TABLE foo ( - bar citext, - bat citext not null -); - -- name: GetCitexts :many SELECT bar, bat FROM foo; diff --git a/internal/endtoend/testdata/citext/pgx/schema.sql b/internal/endtoend/testdata/citext/pgx/schema.sql new file mode 100644 index 0000000000..60c067822a --- /dev/null +++ b/internal/endtoend/testdata/citext/pgx/schema.sql @@ -0,0 +1,7 @@ +CREATE EXTENSION IF NOT EXISTS citext; + +CREATE TABLE foo ( + bar citext, + bat citext not null +); + diff --git a/internal/endtoend/testdata/citext/pgx/sqlc.json b/internal/endtoend/testdata/citext/pgx/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/citext/pgx/sqlc.json +++ b/internal/endtoend/testdata/citext/pgx/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/citext/stdlib/go/db.go b/internal/endtoend/testdata/citext/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/citext/stdlib/go/db.go +++ b/internal/endtoend/testdata/citext/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/citext/stdlib/go/models.go b/internal/endtoend/testdata/citext/stdlib/go/models.go index 9bec929b73..ca947ee379 100644 --- a/internal/endtoend/testdata/citext/stdlib/go/models.go +++ b/internal/endtoend/testdata/citext/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/citext/stdlib/go/query.sql.go b/internal/endtoend/testdata/citext/stdlib/go/query.sql.go index 5668027804..10f3e1fb7b 100644 --- a/internal/endtoend/testdata/citext/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/citext/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/citext/stdlib/query.sql b/internal/endtoend/testdata/citext/stdlib/query.sql index d569fc9a73..b6b08d2144 100644 --- a/internal/endtoend/testdata/citext/stdlib/query.sql +++ b/internal/endtoend/testdata/citext/stdlib/query.sql @@ -1,10 +1,3 @@ -CREATE EXTENSION IF NOT EXISTS citext; - -CREATE TABLE foo ( - bar citext, - bat citext not null -); - -- name: GetCitexts :many SELECT bar, bat FROM foo; diff --git a/internal/endtoend/testdata/citext/stdlib/schema.sql b/internal/endtoend/testdata/citext/stdlib/schema.sql new file mode 100644 index 0000000000..60c067822a --- /dev/null +++ b/internal/endtoend/testdata/citext/stdlib/schema.sql @@ -0,0 +1,7 @@ +CREATE EXTENSION IF NOT EXISTS citext; + +CREATE TABLE foo ( + bar citext, + bat citext not null +); + diff --git a/internal/endtoend/testdata/citext/stdlib/sqlc.json b/internal/endtoend/testdata/citext/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/citext/stdlib/sqlc.json +++ b/internal/endtoend/testdata/citext/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/coalesce/mysql/go/db.go b/internal/endtoend/testdata/coalesce/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/coalesce/mysql/go/db.go +++ b/internal/endtoend/testdata/coalesce/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/coalesce/mysql/go/models.go b/internal/endtoend/testdata/coalesce/mysql/go/models.go index 9bec929b73..ca947ee379 100644 --- a/internal/endtoend/testdata/coalesce/mysql/go/models.go +++ b/internal/endtoend/testdata/coalesce/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/coalesce/mysql/go/query.sql.go b/internal/endtoend/testdata/coalesce/mysql/go/query.sql.go index 58e848606d..d3676747e9 100644 --- a/internal/endtoend/testdata/coalesce/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/coalesce/mysql/query.sql b/internal/endtoend/testdata/coalesce/mysql/query.sql index 022c1fb653..4cc0de9e29 100644 --- a/internal/endtoend/testdata/coalesce/mysql/query.sql +++ b/internal/endtoend/testdata/coalesce/mysql/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar text, bat text not null); - -- name: Coalesce :many SELECT coalesce(bar, '') as login FROM foo; diff --git a/internal/endtoend/testdata/coalesce/mysql/schema.sql b/internal/endtoend/testdata/coalesce/mysql/schema.sql new file mode 100644 index 0000000000..c5002ec257 --- /dev/null +++ b/internal/endtoend/testdata/coalesce/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text, bat text not null); + diff --git a/internal/endtoend/testdata/coalesce/mysql/sqlc.json b/internal/endtoend/testdata/coalesce/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/coalesce/mysql/sqlc.json +++ b/internal/endtoend/testdata/coalesce/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/models.go index 7cfc7da78b..9ba63f911e 100644 --- a/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/query.sql.go index b346e74da1..4d4c47b82f 100644 --- a/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/query.sql index 63cf1a6d10..73d0693ca0 100644 --- a/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/query.sql @@ -1,10 +1,3 @@ -CREATE TABLE foo ( - bar text, - bat text not null, - baz bigint, - qux bigint not null -); - -- name: CoalesceString :many SELECT coalesce(bar, '') as login FROM foo; diff --git a/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..0dc995de96 --- /dev/null +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE foo ( + bar text, + bat text not null, + baz bigint, + qux bigint not null +); + diff --git a/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/models.go index 6f076520d1..4bad9f8d4d 100644 --- a/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/query.sql.go index e3da5f6f9b..cd31d38719 100644 --- a/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/query.sql index 63cf1a6d10..73d0693ca0 100644 --- a/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/query.sql @@ -1,10 +1,3 @@ -CREATE TABLE foo ( - bar text, - bat text not null, - baz bigint, - qux bigint not null -); - -- name: CoalesceString :many SELECT coalesce(bar, '') as login FROM foo; diff --git a/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..0dc995de96 --- /dev/null +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE foo ( + bar text, + bat text not null, + baz bigint, + qux bigint not null +); + diff --git a/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/models.go index 7cfc7da78b..9ba63f911e 100644 --- a/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/query.sql.go index 78eca4fee5..5b1398ea52 100644 --- a/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/coalesce/postgresql/stdlib/query.sql b/internal/endtoend/testdata/coalesce/postgresql/stdlib/query.sql index 63cf1a6d10..73d0693ca0 100644 --- a/internal/endtoend/testdata/coalesce/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/coalesce/postgresql/stdlib/query.sql @@ -1,10 +1,3 @@ -CREATE TABLE foo ( - bar text, - bat text not null, - baz bigint, - qux bigint not null -); - -- name: CoalesceString :many SELECT coalesce(bar, '') as login FROM foo; diff --git a/internal/endtoend/testdata/coalesce/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/coalesce/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..0dc995de96 --- /dev/null +++ b/internal/endtoend/testdata/coalesce/postgresql/stdlib/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE foo ( + bar text, + bat text not null, + baz bigint, + qux bigint not null +); + diff --git a/internal/endtoend/testdata/coalesce/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/coalesce/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/coalesce/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/coalesce/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/coalesce/sqlite/go/db.go b/internal/endtoend/testdata/coalesce/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/coalesce/sqlite/go/db.go +++ b/internal/endtoend/testdata/coalesce/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/coalesce/sqlite/go/models.go b/internal/endtoend/testdata/coalesce/sqlite/go/models.go index 9bec929b73..ca947ee379 100644 --- a/internal/endtoend/testdata/coalesce/sqlite/go/models.go +++ b/internal/endtoend/testdata/coalesce/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/coalesce/sqlite/go/query.sql.go b/internal/endtoend/testdata/coalesce/sqlite/go/query.sql.go index 58e848606d..d3676747e9 100644 --- a/internal/endtoend/testdata/coalesce/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/coalesce/sqlite/query.sql b/internal/endtoend/testdata/coalesce/sqlite/query.sql index 022c1fb653..4cc0de9e29 100644 --- a/internal/endtoend/testdata/coalesce/sqlite/query.sql +++ b/internal/endtoend/testdata/coalesce/sqlite/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar text, bat text not null); - -- name: Coalesce :many SELECT coalesce(bar, '') as login FROM foo; diff --git a/internal/endtoend/testdata/coalesce/sqlite/schema.sql b/internal/endtoend/testdata/coalesce/sqlite/schema.sql new file mode 100644 index 0000000000..c5002ec257 --- /dev/null +++ b/internal/endtoend/testdata/coalesce/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text, bat text not null); + diff --git a/internal/endtoend/testdata/coalesce/sqlite/sqlc.json b/internal/endtoend/testdata/coalesce/sqlite/sqlc.json index fcb288cb35..d4963e751f 100644 --- a/internal/endtoend/testdata/coalesce/sqlite/sqlc.json +++ b/internal/endtoend/testdata/coalesce/sqlite/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "sqlite", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/coalesce_as/mysql/go/db.go b/internal/endtoend/testdata/coalesce_as/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/coalesce_as/mysql/go/db.go +++ b/internal/endtoend/testdata/coalesce_as/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/coalesce_as/mysql/go/models.go b/internal/endtoend/testdata/coalesce_as/mysql/go/models.go index e3d18a55bc..1d0ec38f48 100644 --- a/internal/endtoend/testdata/coalesce_as/mysql/go/models.go +++ b/internal/endtoend/testdata/coalesce_as/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/coalesce_as/mysql/go/query.sql.go b/internal/endtoend/testdata/coalesce_as/mysql/go/query.sql.go index e6c5a51741..b695d58d52 100644 --- a/internal/endtoend/testdata/coalesce_as/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce_as/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/coalesce_as/mysql/query.sql b/internal/endtoend/testdata/coalesce_as/mysql/query.sql index b4e64b0bdd..3f51061f8b 100644 --- a/internal/endtoend/testdata/coalesce_as/mysql/query.sql +++ b/internal/endtoend/testdata/coalesce_as/mysql/query.sql @@ -1,8 +1,3 @@ -CREATE TABLE foo ( - bar text, - baz integer -); - -- name: SumBaz :many SELECT bar, coalesce(sum(baz), 0) as quantity FROM foo diff --git a/internal/endtoend/testdata/coalesce_as/mysql/schema.sql b/internal/endtoend/testdata/coalesce_as/mysql/schema.sql new file mode 100644 index 0000000000..eb1099a145 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/mysql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE foo ( + bar text, + baz integer +); + diff --git a/internal/endtoend/testdata/coalesce_as/mysql/sqlc.json b/internal/endtoend/testdata/coalesce_as/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/coalesce_as/mysql/sqlc.json +++ b/internal/endtoend/testdata/coalesce_as/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/exec.json b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/db.go b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/models.go b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/models.go new file mode 100644 index 0000000000..fec76da088 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Foo struct { + Bar pgtype.Text + Baz pgtype.Int8 +} diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/query.sql.go b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/query.sql.go new file mode 100644 index 0000000000..c78eee2cb8 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/query.sql.go @@ -0,0 +1,43 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const sumBaz = `-- name: SumBaz :many +SELECT bar, coalesce(sum(baz), 0) as quantity +FROM foo +GROUP BY 1 +` + +type SumBazRow struct { + Bar pgtype.Text + Quantity pgtype.Numeric +} + +func (q *Queries) SumBaz(ctx context.Context) ([]SumBazRow, error) { + rows, err := q.db.Query(ctx, sumBaz) + if err != nil { + return nil, err + } + defer rows.Close() + var items []SumBazRow + for rows.Next() { + var i SumBazRow + if err := rows.Scan(&i.Bar, &i.Quantity); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/query.sql b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/query.sql new file mode 100644 index 0000000000..3f51061f8b --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/query.sql @@ -0,0 +1,4 @@ +-- name: SumBaz :many +SELECT bar, coalesce(sum(baz), 0) as quantity +FROM foo +GROUP BY 1; diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/schema.sql b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/schema.sql new file mode 100644 index 0000000000..b7a16c0e28 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE foo ( + bar text, + baz bigint +); + diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/sqlc.json b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/sqlc.json new file mode 100644 index 0000000000..f5e265377f --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/sqlc.json @@ -0,0 +1,19 @@ +{ + "version": "1", + "cloud": { + "project": "01HAQMMECEYQYKFJN8MP16QC41" + }, + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v5", + "database": { + "managed": true + }, + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/exec.json b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/models.go index a5bacd538d..d03557129d 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/query.sql.go index 2aae35c6c8..ca18c2b954 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/query.sql index 27b3017c04..3f51061f8b 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/query.sql @@ -1,8 +1,3 @@ -CREATE TABLE foo ( - bar text, - baz bigint -); - -- name: SumBaz :many SELECT bar, coalesce(sum(baz), 0) as quantity FROM foo diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..b7a16c0e28 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE foo ( + bar text, + baz bigint +); + diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/exec.json b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/models.go index fcb8c8cb65..fec76da088 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/query.sql.go index cc0f787b34..5dc871d4ca 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/query.sql index 27b3017c04..3f51061f8b 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/query.sql @@ -1,8 +1,3 @@ -CREATE TABLE foo ( - bar text, - baz bigint -); - -- name: SumBaz :many SELECT bar, coalesce(sum(baz), 0) as quantity FROM foo diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..b7a16c0e28 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE foo ( + bar text, + baz bigint +); + diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/exec.json b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/models.go index a5bacd538d..d03557129d 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/query.sql.go index e6c5a51741..b695d58d52 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/query.sql b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/query.sql index 27b3017c04..3f51061f8b 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/query.sql @@ -1,8 +1,3 @@ -CREATE TABLE foo ( - bar text, - baz bigint -); - -- name: SumBaz :many SELECT bar, coalesce(sum(baz), 0) as quantity FROM foo diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..b7a16c0e28 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE foo ( + bar text, + baz bigint +); + diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/coalesce_as/sqlite/go/db.go b/internal/endtoend/testdata/coalesce_as/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/coalesce_as/sqlite/go/db.go +++ b/internal/endtoend/testdata/coalesce_as/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/coalesce_as/sqlite/go/models.go b/internal/endtoend/testdata/coalesce_as/sqlite/go/models.go index a5bacd538d..d03557129d 100644 --- a/internal/endtoend/testdata/coalesce_as/sqlite/go/models.go +++ b/internal/endtoend/testdata/coalesce_as/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/coalesce_as/sqlite/go/query.sql.go b/internal/endtoend/testdata/coalesce_as/sqlite/go/query.sql.go index e6c5a51741..b695d58d52 100644 --- a/internal/endtoend/testdata/coalesce_as/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce_as/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/coalesce_as/sqlite/query.sql b/internal/endtoend/testdata/coalesce_as/sqlite/query.sql index b4e64b0bdd..3f51061f8b 100644 --- a/internal/endtoend/testdata/coalesce_as/sqlite/query.sql +++ b/internal/endtoend/testdata/coalesce_as/sqlite/query.sql @@ -1,8 +1,3 @@ -CREATE TABLE foo ( - bar text, - baz integer -); - -- name: SumBaz :many SELECT bar, coalesce(sum(baz), 0) as quantity FROM foo diff --git a/internal/endtoend/testdata/coalesce_as/sqlite/schema.sql b/internal/endtoend/testdata/coalesce_as/sqlite/schema.sql new file mode 100644 index 0000000000..eb1099a145 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_as/sqlite/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE foo ( + bar text, + baz integer +); + diff --git a/internal/endtoend/testdata/coalesce_as/sqlite/sqlc.json b/internal/endtoend/testdata/coalesce_as/sqlite/sqlc.json index fcb288cb35..d4963e751f 100644 --- a/internal/endtoend/testdata/coalesce_as/sqlite/sqlc.json +++ b/internal/endtoend/testdata/coalesce_as/sqlite/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "sqlite", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/coalesce_join/postgresql/go/db.go b/internal/endtoend/testdata/coalesce_join/postgresql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/coalesce_join/postgresql/go/db.go +++ b/internal/endtoend/testdata/coalesce_join/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/coalesce_join/postgresql/go/models.go b/internal/endtoend/testdata/coalesce_join/postgresql/go/models.go index 7a085ae7ff..d093635683 100644 --- a/internal/endtoend/testdata/coalesce_join/postgresql/go/models.go +++ b/internal/endtoend/testdata/coalesce_join/postgresql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int64 } diff --git a/internal/endtoend/testdata/coalesce_join/postgresql/go/query.sql.go b/internal/endtoend/testdata/coalesce_join/postgresql/go/query.sql.go index 94c95de3e3..4d0489e792 100644 --- a/internal/endtoend/testdata/coalesce_join/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce_join/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/coalesce_join/postgresql/query.sql b/internal/endtoend/testdata/coalesce_join/postgresql/query.sql index f2b6bfa352..d91add88e6 100644 --- a/internal/endtoend/testdata/coalesce_join/postgresql/query.sql +++ b/internal/endtoend/testdata/coalesce_join/postgresql/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE foo(id bigserial primary key); -CREATE TABLE bar(id bigserial primary key); - -- name: GetBar :many SELECT foo.*, COALESCE(bar.id, 0) AS bar_id FROM foo diff --git a/internal/endtoend/testdata/coalesce_join/postgresql/schema.sql b/internal/endtoend/testdata/coalesce_join/postgresql/schema.sql new file mode 100644 index 0000000000..ed9393c16f --- /dev/null +++ b/internal/endtoend/testdata/coalesce_join/postgresql/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo(id bigserial primary key); +CREATE TABLE bar(id bigserial primary key); + diff --git a/internal/endtoend/testdata/coalesce_join/postgresql/sqlc.json b/internal/endtoend/testdata/coalesce_join/postgresql/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/coalesce_join/postgresql/sqlc.json +++ b/internal/endtoend/testdata/coalesce_join/postgresql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/coalesce_params/issue.md b/internal/endtoend/testdata/coalesce_params/issue.md new file mode 100644 index 0000000000..ad6db4167a --- /dev/null +++ b/internal/endtoend/testdata/coalesce_params/issue.md @@ -0,0 +1,2 @@ +https://github.com/sqlc-dev/sqlc/issues/2748 +https://github.com/sqlc-dev/sqlc/issues/2786 diff --git a/internal/endtoend/testdata/coalesce_params/mysql/exec.json b/internal/endtoend/testdata/coalesce_params/mysql/exec.json new file mode 100644 index 0000000000..c85ca2dfa7 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_params/mysql/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["base"], + "meta": { + "invalid_schema": true + } +} diff --git a/internal/endtoend/testdata/coalesce_params/mysql/go/db.go b/internal/endtoend/testdata/coalesce_params/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_params/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/coalesce_params/mysql/go/models.go b/internal/endtoend/testdata/coalesce_params/mysql/go/models.go new file mode 100644 index 0000000000..39606e4aaf --- /dev/null +++ b/internal/endtoend/testdata/coalesce_params/mysql/go/models.go @@ -0,0 +1,87 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + "database/sql/driver" + "fmt" + "time" +) + +type CalendarMaincalendar string + +const ( + CalendarMaincalendarTrue CalendarMaincalendar = "true" + CalendarMaincalendarFalse CalendarMaincalendar = "false" +) + +func (e *CalendarMaincalendar) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = CalendarMaincalendar(s) + case string: + *e = CalendarMaincalendar(s) + default: + return fmt.Errorf("unsupported scan type for CalendarMaincalendar: %T", src) + } + return nil +} + +type NullCalendarMaincalendar struct { + CalendarMaincalendar CalendarMaincalendar + Valid bool // Valid is true if CalendarMaincalendar is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullCalendarMaincalendar) Scan(value interface{}) error { + if value == nil { + ns.CalendarMaincalendar, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.CalendarMaincalendar.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullCalendarMaincalendar) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.CalendarMaincalendar), nil +} + +type Author struct { + ID int64 + Address string + Name string + Bio string +} + +type Calendar struct { + ID uint64 + Relation uint64 + Calendarname []byte + Title []byte + Description []byte + Timezone string + Uniquekey string + Idkey string + Maincalendar CalendarMaincalendar + Createdate time.Time + Modifydate time.Time +} + +type Event struct { + ID uint64 + Relation uint64 + Calendarreference uint64 + Uniquekey string + Eventname []byte + Description []byte + Location string + Timezone string + Idkey sql.NullString +} diff --git a/internal/endtoend/testdata/coalesce_params/mysql/go/query.sql.go b/internal/endtoend/testdata/coalesce_params/mysql/go/query.sql.go new file mode 100644 index 0000000000..7bb5de9694 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_params/mysql/go/query.sql.go @@ -0,0 +1,57 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const addAuthor = `-- name: AddAuthor :execlastid +INSERT INTO authors ( + address, + name, + bio +) VALUES ( + ?, + COALESCE(?, ""), + COALESCE(?, "") +) +` + +type AddAuthorParams struct { + Address string + CalName interface{} + CalDescription interface{} +} + +func (q *Queries) AddAuthor(ctx context.Context, arg AddAuthorParams) (int64, error) { + result, err := q.db.ExecContext(ctx, addAuthor, arg.Address, arg.CalName, arg.CalDescription) + if err != nil { + return 0, err + } + return result.LastInsertId() +} + +const addEvent = `-- name: AddEvent :execlastid +INSERT INTO ` + "`" + `Event` + "`" + ` ( + Timezone +) VALUES ( + (CASE WHEN ? = "calendar" THEN (SELECT cal.Timezone FROM Calendar cal WHERE cal.IdKey = ?) ELSE ? END) +) +` + +type AddEventParams struct { + Timezone interface{} + CalendarIdKey string +} + +func (q *Queries) AddEvent(ctx context.Context, arg AddEventParams) (int64, error) { + result, err := q.db.ExecContext(ctx, addEvent, arg.Timezone, arg.CalendarIdKey, arg.Timezone) + if err != nil { + return 0, err + } + return result.LastInsertId() +} diff --git a/internal/endtoend/testdata/coalesce_params/mysql/query.sql b/internal/endtoend/testdata/coalesce_params/mysql/query.sql new file mode 100644 index 0000000000..f6df77d55d --- /dev/null +++ b/internal/endtoend/testdata/coalesce_params/mysql/query.sql @@ -0,0 +1,17 @@ +-- name: AddEvent :execlastid +INSERT INTO `Event` ( + Timezone +) VALUES ( + (CASE WHEN sqlc.arg("Timezone") = "calendar" THEN (SELECT cal.Timezone FROM Calendar cal WHERE cal.IdKey = sqlc.arg("calendarIdKey")) ELSE sqlc.arg("Timezone") END) +); + +-- name: AddAuthor :execlastid +INSERT INTO authors ( + address, + name, + bio +) VALUES ( + ?, + COALESCE(sqlc.narg("calName"), ""), + COALESCE(sqlc.narg("calDescription"), "") +); diff --git a/internal/endtoend/testdata/coalesce_params/mysql/schema.sql b/internal/endtoend/testdata/coalesce_params/mysql/schema.sql new file mode 100644 index 0000000000..0b1b34685c --- /dev/null +++ b/internal/endtoend/testdata/coalesce_params/mysql/schema.sql @@ -0,0 +1,43 @@ +CREATE TABLE `Calendar` ( + `Id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `Relation` bigint(20) unsigned NOT NULL, + `CalendarName` longblob NOT NULL, + `Title` longblob NOT NULL, + `Description` longblob NOT NULL, + `Timezone` varchar(50) NOT NULL, + `UniqueKey` varchar(50) NOT NULL, + `IdKey` varchar(50) NOT NULL, + `MainCalendar` enum('true','false') NOT NULL DEFAULT 'false', + `CreateDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `ModifyDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`Id`), + KEY `Relation` (`Relation`), + KEY `UniqueKey` (`UniqueKey`), + KEY `IdKey` (`IdKey`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + + +CREATE TABLE `Event` ( + `Id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `Relation` bigint(20) unsigned NOT NULL, + `CalendarReference` bigint(20) unsigned NOT NULL, + `UniqueKey` varchar(50) NOT NULL, + `EventName` longblob NOT NULL, + `Description` longblob NOT NULL, + `Location` varchar(500) NOT NULL, + `Timezone` varchar(50) NOT NULL, + `IdKey` varchar(48) DEFAULT NULL, + PRIMARY KEY (`Id`), + KEY `Relation` (`Relation`), + KEY `CalendarReference` (`CalendarReference`), + KEY `UniqueKey` (`UniqueKey`), + KEY `IdKey` (`IdKey`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + + +CREATE TABLE authors ( + id BIGINT AUTO_INCREMENT NOT NULL, + address VARCHAR(200) NOT NULL, + name VARCHAR(20) NOT NULL, + bio LONGTEXT NOT NULL +); diff --git a/internal/endtoend/testdata/coalesce_params/mysql/sqlc.yaml b/internal/endtoend/testdata/coalesce_params/mysql/sqlc.yaml new file mode 100644 index 0000000000..b843ef55e3 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_params/mysql/sqlc.yaml @@ -0,0 +1,9 @@ +version: "2" +sql: + - engine: "mysql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" diff --git a/internal/endtoend/testdata/codegen_json/exec.json b/internal/endtoend/testdata/codegen_json/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/codegen_json/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/codegen_json/gen/codegen.json b/internal/endtoend/testdata/codegen_json/gen/codegen.json index 9e8fb1a944..754d2af289 100644 --- a/internal/endtoend/testdata/codegen_json/gen/codegen.json +++ b/internal/endtoend/testdata/codegen_json/gen/codegen.json @@ -8,47 +8,13 @@ "queries": [ "postgresql/query.sql" ], - "rename": {}, - "overrides": [], "codegen": { "out": "", "plugin": "", - "options": "" - }, - "go": { - "emit_interface": false, - "emit_json_tags": false, - "emit_db_tags": false, - "emit_prepared_queries": false, - "emit_exact_table_names": false, - "emit_empty_slices": false, - "emit_exported_queries": false, - "emit_result_struct_pointers": false, - "emit_params_struct_pointers": false, - "emit_methods_with_db_argument": false, - "json_tags_case_style": "", - "package": "", - "out": "", - "sql_package": "", - "sql_driver": "", - "output_db_file_name": "", - "output_models_file_name": "", - "output_querier_file_name": "", - "output_copyfrom_file_name": "", - "output_files_suffix": "", - "emit_enum_valid_method": false, - "emit_all_enum_values": false, - "inflection_exclude_table_names": [], - "emit_pointers_for_null_types": false, - "query_parameter_limit": 1, - "output_batch_file_name": "", - "json_tags_id_uppercase": false, - "omit_unused_structs": false - }, - "json": { - "out": "gen", - "indent": " ", - "filename": "codegen.json" + "options": "", + "env": [], + "process": null, + "wasm": null } }, "catalog": { @@ -65397,6 +65363,7 @@ "insert_into_table": null } ], - "sqlc_version": "v1.22.0", - "plugin_options": "" + "sqlc_version": "v1.30.0", + "plugin_options": "eyJvdXQiOiJnZW4iLCJpbmRlbnQiOiIgICIsImZpbGVuYW1lIjoiY29kZWdlbi5qc29uIn0=", + "global_options": "" } diff --git a/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/db.go b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/db.go +++ b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/models.go b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/models.go index 084c445978..3dff0f3bae 100644 --- a/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/models.go +++ b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/query.sql.go b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/query.sql.go index 1cda1616eb..4d63368825 100644 --- a/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -10,7 +10,7 @@ import ( ) const test = `-- name: test :one -SELECT id, !!!nobody,_,-would-believe---this-...?!, parent id from bar limit 1 +SELECT id, "!!!nobody,_,-would-believe---this-...?!", "parent id" from bar limit 1 ` func (q *Queries) test(ctx context.Context) (Bar, error) { diff --git a/internal/endtoend/testdata/codegen_struct_field_names/stdlib/query.sql b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/query.sql index 853a207ad8..252d207821 100644 --- a/internal/endtoend/testdata/codegen_struct_field_names/stdlib/query.sql +++ b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/query.sql @@ -1,7 +1,2 @@ -CREATE TABLE bar ( - id INT NOT NULL, - "!!!nobody,_,-would-believe---this-...?!" INT, - "parent id" INT); - -- name: test :one SELECT * from bar limit 1; diff --git a/internal/endtoend/testdata/codegen_struct_field_names/stdlib/schema.sql b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/schema.sql new file mode 100644 index 0000000000..68a6c9bf04 --- /dev/null +++ b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE bar ( + id INT NOT NULL, + "!!!nobody,_,-would-believe---this-...?!" INT, + "parent id" INT); + diff --git a/internal/endtoend/testdata/codegen_struct_field_names/stdlib/sqlc.json b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/sqlc.json index bc05cb0384..4f08376b42 100644 --- a/internal/endtoend/testdata/codegen_struct_field_names/stdlib/sqlc.json +++ b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/column_alias/issue.md b/internal/endtoend/testdata/column_alias/issue.md new file mode 100644 index 0000000000..fc16c2a58a --- /dev/null +++ b/internal/endtoend/testdata/column_alias/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1739 diff --git a/internal/endtoend/testdata/column_alias/stdlib/exec.json b/internal/endtoend/testdata/column_alias/stdlib/exec.json new file mode 100644 index 0000000000..e5dfda7818 --- /dev/null +++ b/internal/endtoend/testdata/column_alias/stdlib/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/column_alias/stdlib/go/db.go b/internal/endtoend/testdata/column_alias/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/column_alias/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/column_alias/stdlib/go/models.go b/internal/endtoend/testdata/column_alias/stdlib/go/models.go new file mode 100644 index 0000000000..05352919de --- /dev/null +++ b/internal/endtoend/testdata/column_alias/stdlib/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "time" +) + +type User struct { + ID int32 + Fname string + Lname string + Email string + EncPasswd string + CreatedAt time.Time +} diff --git a/internal/endtoend/testdata/column_alias/stdlib/go/query.sql.go b/internal/endtoend/testdata/column_alias/stdlib/go/query.sql.go new file mode 100644 index 0000000000..9de0be747c --- /dev/null +++ b/internal/endtoend/testdata/column_alias/stdlib/go/query.sql.go @@ -0,0 +1,80 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" + "time" +) + +const getUsers = `-- name: GetUsers :many +SELECT + users.id, + users.fname, + users.lname, + users.email, + users.created_at, + rank_email, + rank_fname, + rank_lname, + similarity +FROM + users, + to_tsvector(users.email || users.fname || users.lname) document, + to_tsquery($1::TEXT) query, + NULLIF(ts_rank(to_tsvector(users.email), query), 0) rank_email, + NULLIF(ts_rank(to_tsvector(users.fname), query), 0) rank_fname, + NULLIF(ts_rank(to_tsvector(users.lname), query), 0) rank_lname, + SIMILARITY($1::TEXT, users.email || users.fname || users.lname) similarity +WHERE query @@ document OR similarity > 0 +ORDER BY rank_email, rank_lname, rank_fname, similarity DESC NULLS LAST +` + +type GetUsersRow struct { + ID int32 + Fname string + Lname string + Email string + CreatedAt time.Time + RankEmail sql.NullFloat64 + RankFname sql.NullFloat64 + RankLname sql.NullFloat64 + Similarity sql.NullFloat64 +} + +func (q *Queries) GetUsers(ctx context.Context, searchTerm string) ([]GetUsersRow, error) { + rows, err := q.db.QueryContext(ctx, getUsers, searchTerm) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetUsersRow + for rows.Next() { + var i GetUsersRow + if err := rows.Scan( + &i.ID, + &i.Fname, + &i.Lname, + &i.Email, + &i.CreatedAt, + &i.RankEmail, + &i.RankFname, + &i.RankLname, + &i.Similarity, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/column_alias/stdlib/query.sql b/internal/endtoend/testdata/column_alias/stdlib/query.sql new file mode 100644 index 0000000000..9877fadde6 --- /dev/null +++ b/internal/endtoend/testdata/column_alias/stdlib/query.sql @@ -0,0 +1,21 @@ +-- name: GetUsers :many +SELECT + users.id, + users.fname, + users.lname, + users.email, + users.created_at, + rank_email, + rank_fname, + rank_lname, + similarity +FROM + users, + to_tsvector(users.email || users.fname || users.lname) document, + to_tsquery(@search_term::TEXT) query, + NULLIF(ts_rank(to_tsvector(users.email), query), 0) rank_email, + NULLIF(ts_rank(to_tsvector(users.fname), query), 0) rank_fname, + NULLIF(ts_rank(to_tsvector(users.lname), query), 0) rank_lname, + SIMILARITY(@search_term::TEXT, users.email || users.fname || users.lname) similarity +WHERE query @@ document OR similarity > 0 +ORDER BY rank_email, rank_lname, rank_fname, similarity DESC NULLS LAST; diff --git a/internal/endtoend/testdata/column_alias/stdlib/schema.sql b/internal/endtoend/testdata/column_alias/stdlib/schema.sql new file mode 100644 index 0000000000..9205a149e3 --- /dev/null +++ b/internal/endtoend/testdata/column_alias/stdlib/schema.sql @@ -0,0 +1,12 @@ +CREATE EXTENSION pg_trgm; +CREATE EXTENSION pgcrypto; + +CREATE TABLE users( + id INT GENERATED ALWAYS AS IDENTITY NOT NULL, + fname VARCHAR(100) NOT NULL, + lname VARCHAR(100) NOT NULL, + email VARCHAR(100) NOT NULL UNIQUE, + enc_passwd TEXT NOT NULL, + created_at TIMESTAMP WITH TIME ZONE NOT NULL default (NOW() AT TIME ZONE 'utc'), + PRIMARY KEY(id) +); diff --git a/internal/endtoend/testdata/column_alias/stdlib/sqlc.yaml b/internal/endtoend/testdata/column_alias/stdlib/sqlc.yaml new file mode 100644 index 0000000000..8c68222b49 --- /dev/null +++ b/internal/endtoend/testdata/column_alias/stdlib/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "database/sql" diff --git a/internal/endtoend/testdata/column_as/mysql/go/db.go b/internal/endtoend/testdata/column_as/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/column_as/mysql/go/db.go +++ b/internal/endtoend/testdata/column_as/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/column_as/mysql/go/models.go b/internal/endtoend/testdata/column_as/mysql/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/column_as/mysql/go/models.go +++ b/internal/endtoend/testdata/column_as/mysql/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/column_as/mysql/go/query.sql.go b/internal/endtoend/testdata/column_as/mysql/go/query.sql.go index 3e772a1009..bb26fb91ca 100644 --- a/internal/endtoend/testdata/column_as/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/column_as/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/examples/python/src/authors/__init__.py b/internal/endtoend/testdata/column_as/mysql/schema.sql similarity index 100% rename from examples/python/src/authors/__init__.py rename to internal/endtoend/testdata/column_as/mysql/schema.sql diff --git a/internal/endtoend/testdata/column_as/mysql/sqlc.json b/internal/endtoend/testdata/column_as/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/column_as/mysql/sqlc.json +++ b/internal/endtoend/testdata/column_as/mysql/sqlc.json @@ -5,7 +5,7 @@ "engine": "mysql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/query.sql.go index 45fe1488f3..dd8604891b 100644 --- a/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/examples/python/src/booktest/__init__.py b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/schema.sql similarity index 100% rename from examples/python/src/booktest/__init__.py rename to internal/endtoend/testdata/column_as/postgresql/pgx/v4/schema.sql diff --git a/internal/endtoend/testdata/column_as/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/sqlc.json index 538c1e943a..4c0b2785b8 100644 --- a/internal/endtoend/testdata/column_as/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "sql_package": "pgx/v4", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/query.sql.go index 45fe1488f3..dd8604891b 100644 --- a/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/examples/python/src/dbtest/__init__.py b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/schema.sql similarity index 100% rename from examples/python/src/dbtest/__init__.py rename to internal/endtoend/testdata/column_as/postgresql/pgx/v5/schema.sql diff --git a/internal/endtoend/testdata/column_as/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/sqlc.json index 2fbef7e9b9..d12b82a6c6 100644 --- a/internal/endtoend/testdata/column_as/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "sql_package": "pgx/v5", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/column_as/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/column_as/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/column_as/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/column_as/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/column_as/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/column_as/postgresql/stdlib/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/column_as/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/column_as/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/column_as/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/column_as/postgresql/stdlib/go/query.sql.go index 3e772a1009..bb26fb91ca 100644 --- a/internal/endtoend/testdata/column_as/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/column_as/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/examples/python/src/jets/__init__.py b/internal/endtoend/testdata/column_as/postgresql/stdlib/schema.sql similarity index 100% rename from examples/python/src/jets/__init__.py rename to internal/endtoend/testdata/column_as/postgresql/stdlib/schema.sql diff --git a/internal/endtoend/testdata/column_as/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/column_as/postgresql/stdlib/sqlc.json index de427d069f..cd518671ac 100644 --- a/internal/endtoend/testdata/column_as/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/column_as/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "engine": "postgresql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/column_as/sqlite/go/db.go b/internal/endtoend/testdata/column_as/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/column_as/sqlite/go/db.go +++ b/internal/endtoend/testdata/column_as/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/column_as/sqlite/go/models.go b/internal/endtoend/testdata/column_as/sqlite/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/column_as/sqlite/go/models.go +++ b/internal/endtoend/testdata/column_as/sqlite/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/column_as/sqlite/go/query.sql.go b/internal/endtoend/testdata/column_as/sqlite/go/query.sql.go index 0196e2ce12..4c77f808c1 100644 --- a/internal/endtoend/testdata/column_as/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/column_as/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/examples/python/src/ondeck/__init__.py b/internal/endtoend/testdata/column_as/sqlite/schema.sql similarity index 100% rename from examples/python/src/ondeck/__init__.py rename to internal/endtoend/testdata/column_as/sqlite/schema.sql diff --git a/internal/endtoend/testdata/column_as/sqlite/sqlc.json b/internal/endtoend/testdata/column_as/sqlite/sqlc.json index 13e65f3ffd..f8e8051087 100644 --- a/internal/endtoend/testdata/column_as/sqlite/sqlc.json +++ b/internal/endtoend/testdata/column_as/sqlite/sqlc.json @@ -5,7 +5,7 @@ "engine": "sqlite", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/models.go index 353c2b0d63..92ddc7826f 100644 --- a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/query.sql.go index 58bad495ac..a31a016362 100644 --- a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -13,7 +13,7 @@ import ( ) const execFoo = `-- name: ExecFoo :exec -INSERT INTO foo (bar) VALUES ("bar") +INSERT INTO foo (bar) VALUES ('bar') ` // This function creates a Foo via :exec @@ -23,7 +23,7 @@ func (q *Queries) ExecFoo(ctx context.Context) error { } const execResultFoo = `-- name: ExecResultFoo :execresult -INSERT INTO foo (bar) VALUES ("bar") +INSERT INTO foo (bar) VALUES ('bar') ` // This function creates a Foo via :execresult @@ -32,7 +32,7 @@ func (q *Queries) ExecResultFoo(ctx context.Context) (pgconn.CommandTag, error) } const execRowFoo = `-- name: ExecRowFoo :execrows -INSERT INTO foo (bar) VALUES ("bar") +INSERT INTO foo (bar) VALUES ('bar') ` // This function creates a Foo via :execrows diff --git a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/query.sql index 0f5946b506..b5fab38de7 100644 --- a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/query.sql @@ -1,7 +1,3 @@ -CREATE TABLE foo ( - bar text -); - -- name: ManyFoo :many -- This function returns a list of Foos SELECT * FROM foo; @@ -12,12 +8,12 @@ SELECT * FROM foo; -- name: ExecFoo :exec -- This function creates a Foo via :exec -INSERT INTO foo (bar) VALUES ("bar"); +INSERT INTO foo (bar) VALUES ('bar'); -- name: ExecRowFoo :execrows -- This function creates a Foo via :execrows -INSERT INTO foo (bar) VALUES ("bar"); +INSERT INTO foo (bar) VALUES ('bar'); -- name: ExecResultFoo :execresult -- This function creates a Foo via :execresult -INSERT INTO foo (bar) VALUES ("bar"); +INSERT INTO foo (bar) VALUES ('bar'); diff --git a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..31bcf761e0 --- /dev/null +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE foo ( + bar text +); + diff --git a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/sqlc.json index b2a6a7cbd6..5ffafefc61 100644 --- a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "name": "querytest", "engine": "postgresql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "sql_package": "pgx/v4" } diff --git a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/models.go index a6fa331406..f2fbf9abf3 100644 --- a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/query.sql.go index f53a7bca4d..1bd9065b43 100644 --- a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -13,7 +13,7 @@ import ( ) const execFoo = `-- name: ExecFoo :exec -INSERT INTO foo (bar) VALUES ("bar") +INSERT INTO foo (bar) VALUES ('bar') ` // This function creates a Foo via :exec @@ -23,7 +23,7 @@ func (q *Queries) ExecFoo(ctx context.Context) error { } const execResultFoo = `-- name: ExecResultFoo :execresult -INSERT INTO foo (bar) VALUES ("bar") +INSERT INTO foo (bar) VALUES ('bar') ` // This function creates a Foo via :execresult @@ -32,7 +32,7 @@ func (q *Queries) ExecResultFoo(ctx context.Context) (pgconn.CommandTag, error) } const execRowFoo = `-- name: ExecRowFoo :execrows -INSERT INTO foo (bar) VALUES ("bar") +INSERT INTO foo (bar) VALUES ('bar') ` // This function creates a Foo via :execrows diff --git a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/query.sql index 0f5946b506..b5fab38de7 100644 --- a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/query.sql @@ -1,7 +1,3 @@ -CREATE TABLE foo ( - bar text -); - -- name: ManyFoo :many -- This function returns a list of Foos SELECT * FROM foo; @@ -12,12 +8,12 @@ SELECT * FROM foo; -- name: ExecFoo :exec -- This function creates a Foo via :exec -INSERT INTO foo (bar) VALUES ("bar"); +INSERT INTO foo (bar) VALUES ('bar'); -- name: ExecRowFoo :execrows -- This function creates a Foo via :execrows -INSERT INTO foo (bar) VALUES ("bar"); +INSERT INTO foo (bar) VALUES ('bar'); -- name: ExecResultFoo :execresult -- This function creates a Foo via :execresult -INSERT INTO foo (bar) VALUES ("bar"); +INSERT INTO foo (bar) VALUES ('bar'); diff --git a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..31bcf761e0 --- /dev/null +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE foo ( + bar text +); + diff --git a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/sqlc.json index 9b0a61e0a1..4905a64003 100644 --- a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "name": "querytest", "engine": "postgresql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "sql_package": "pgx/v5" } diff --git a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/db.go index baa9266939..7599fccb42 100644 --- a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/models.go index 353c2b0d63..92ddc7826f 100644 --- a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/query.sql.go index 463e30847b..a0358ab4ed 100644 --- a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -13,7 +13,7 @@ import ( ) const execFoo = `-- name: ExecFoo :exec -INSERT INTO foo (bar) VALUES ("bar") +INSERT INTO foo (bar) VALUES ('bar') ` // This function creates a Foo via :exec @@ -23,7 +23,7 @@ func (q *Queries) ExecFoo(ctx context.Context, db DBTX) error { } const execResultFoo = `-- name: ExecResultFoo :execresult -INSERT INTO foo (bar) VALUES ("bar") +INSERT INTO foo (bar) VALUES ('bar') ` // This function creates a Foo via :execresult @@ -32,7 +32,7 @@ func (q *Queries) ExecResultFoo(ctx context.Context, db DBTX) (pgconn.CommandTag } const execRowFoo = `-- name: ExecRowFoo :execrows -INSERT INTO foo (bar) VALUES ("bar") +INSERT INTO foo (bar) VALUES ('bar') ` // This function creates a Foo via :execrows diff --git a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/query.sql index 0f5946b506..b5fab38de7 100644 --- a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/query.sql @@ -1,7 +1,3 @@ -CREATE TABLE foo ( - bar text -); - -- name: ManyFoo :many -- This function returns a list of Foos SELECT * FROM foo; @@ -12,12 +8,12 @@ SELECT * FROM foo; -- name: ExecFoo :exec -- This function creates a Foo via :exec -INSERT INTO foo (bar) VALUES ("bar"); +INSERT INTO foo (bar) VALUES ('bar'); -- name: ExecRowFoo :execrows -- This function creates a Foo via :execrows -INSERT INTO foo (bar) VALUES ("bar"); +INSERT INTO foo (bar) VALUES ('bar'); -- name: ExecResultFoo :execresult -- This function creates a Foo via :execresult -INSERT INTO foo (bar) VALUES ("bar"); +INSERT INTO foo (bar) VALUES ('bar'); diff --git a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..31bcf761e0 --- /dev/null +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE foo ( + bar text +); + diff --git a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/sqlc.json index 9b628ed5ae..6b0b6cd07e 100644 --- a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "name": "querytest", "engine": "postgresql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "sql_package": "pgx/v4", "emit_methods_with_db_argument": true diff --git a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/db.go index 378f123111..166695c170 100644 --- a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/models.go index a6fa331406..f2fbf9abf3 100644 --- a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/query.sql.go index 89cb0e2d84..533edb506b 100644 --- a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -13,7 +13,7 @@ import ( ) const execFoo = `-- name: ExecFoo :exec -INSERT INTO foo (bar) VALUES ("bar") +INSERT INTO foo (bar) VALUES ('bar') ` // This function creates a Foo via :exec @@ -23,7 +23,7 @@ func (q *Queries) ExecFoo(ctx context.Context, db DBTX) error { } const execResultFoo = `-- name: ExecResultFoo :execresult -INSERT INTO foo (bar) VALUES ("bar") +INSERT INTO foo (bar) VALUES ('bar') ` // This function creates a Foo via :execresult @@ -32,7 +32,7 @@ func (q *Queries) ExecResultFoo(ctx context.Context, db DBTX) (pgconn.CommandTag } const execRowFoo = `-- name: ExecRowFoo :execrows -INSERT INTO foo (bar) VALUES ("bar") +INSERT INTO foo (bar) VALUES ('bar') ` // This function creates a Foo via :execrows diff --git a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/query.sql index 0f5946b506..b5fab38de7 100644 --- a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/query.sql @@ -1,7 +1,3 @@ -CREATE TABLE foo ( - bar text -); - -- name: ManyFoo :many -- This function returns a list of Foos SELECT * FROM foo; @@ -12,12 +8,12 @@ SELECT * FROM foo; -- name: ExecFoo :exec -- This function creates a Foo via :exec -INSERT INTO foo (bar) VALUES ("bar"); +INSERT INTO foo (bar) VALUES ('bar'); -- name: ExecRowFoo :execrows -- This function creates a Foo via :execrows -INSERT INTO foo (bar) VALUES ("bar"); +INSERT INTO foo (bar) VALUES ('bar'); -- name: ExecResultFoo :execresult -- This function creates a Foo via :execresult -INSERT INTO foo (bar) VALUES ("bar"); +INSERT INTO foo (bar) VALUES ('bar'); diff --git a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..31bcf761e0 --- /dev/null +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE foo ( + bar text +); + diff --git a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/sqlc.json index 263267041f..0e07b3a0de 100644 --- a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "name": "querytest", "engine": "postgresql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "sql_package": "pgx/v5", "emit_methods_with_db_argument": true diff --git a/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/models.go index a81b3a81cf..33105da087 100644 --- a/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/query.sql.go index b3b98a8213..33c4edd32e 100644 --- a/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/query.sql index d3d24a1ea5..cda102c5a2 100644 --- a/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/query.sql @@ -1,19 +1,3 @@ -CREATE SCHEMA foo; - -CREATE TABLE foo.bar ( - baz text NOT NULL -); - -CREATE VIEW foo.bat AS SELECT * FROM foo.bar; - -CREATE TYPE foo.mood AS ENUM ('sad', 'ok', 'happy'); - -COMMENT ON SCHEMA foo IS 'this is the foo schema'; -COMMENT ON TYPE foo.mood IS 'this is the mood type'; -COMMENT ON TABLE foo.bar IS 'this is the bar table'; -COMMENT ON COLUMN foo.bar.baz IS 'this is the baz column'; -COMMENT ON VIEW foo.bat IS 'this is the bat view '; - -- name: ListBar :many SELECT * FROM foo.bar; diff --git a/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..6e2052b167 --- /dev/null +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/schema.sql @@ -0,0 +1,16 @@ +CREATE SCHEMA foo; + +CREATE TABLE foo.bar ( + baz text NOT NULL +); + +CREATE VIEW foo.bat AS SELECT * FROM foo.bar; + +CREATE TYPE foo.mood AS ENUM ('sad', 'ok', 'happy'); + +COMMENT ON SCHEMA foo IS 'this is the foo schema'; +COMMENT ON TYPE foo.mood IS 'this is the mood type'; +COMMENT ON TABLE foo.bar IS 'this is the bar table'; +COMMENT ON COLUMN foo.bar.baz IS 'this is the baz column'; +COMMENT ON VIEW foo.bat IS 'this is the bat view '; + diff --git a/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/models.go index a81b3a81cf..33105da087 100644 --- a/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/query.sql.go index b3b98a8213..33c4edd32e 100644 --- a/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/query.sql index d3d24a1ea5..cda102c5a2 100644 --- a/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/query.sql @@ -1,19 +1,3 @@ -CREATE SCHEMA foo; - -CREATE TABLE foo.bar ( - baz text NOT NULL -); - -CREATE VIEW foo.bat AS SELECT * FROM foo.bar; - -CREATE TYPE foo.mood AS ENUM ('sad', 'ok', 'happy'); - -COMMENT ON SCHEMA foo IS 'this is the foo schema'; -COMMENT ON TYPE foo.mood IS 'this is the mood type'; -COMMENT ON TABLE foo.bar IS 'this is the bar table'; -COMMENT ON COLUMN foo.bar.baz IS 'this is the baz column'; -COMMENT ON VIEW foo.bat IS 'this is the bat view '; - -- name: ListBar :many SELECT * FROM foo.bar; diff --git a/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..6e2052b167 --- /dev/null +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/schema.sql @@ -0,0 +1,16 @@ +CREATE SCHEMA foo; + +CREATE TABLE foo.bar ( + baz text NOT NULL +); + +CREATE VIEW foo.bat AS SELECT * FROM foo.bar; + +CREATE TYPE foo.mood AS ENUM ('sad', 'ok', 'happy'); + +COMMENT ON SCHEMA foo IS 'this is the foo schema'; +COMMENT ON TYPE foo.mood IS 'this is the mood type'; +COMMENT ON TABLE foo.bar IS 'this is the bar table'; +COMMENT ON COLUMN foo.bar.baz IS 'this is the baz column'; +COMMENT ON VIEW foo.bat IS 'this is the bat view '; + diff --git a/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/models.go index a81b3a81cf..33105da087 100644 --- a/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/query.sql.go index 6939374ce9..8a65a0cb31 100644 --- a/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/comment_on/postgresql/stdlib/query.sql b/internal/endtoend/testdata/comment_on/postgresql/stdlib/query.sql index d3d24a1ea5..cda102c5a2 100644 --- a/internal/endtoend/testdata/comment_on/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/comment_on/postgresql/stdlib/query.sql @@ -1,19 +1,3 @@ -CREATE SCHEMA foo; - -CREATE TABLE foo.bar ( - baz text NOT NULL -); - -CREATE VIEW foo.bat AS SELECT * FROM foo.bar; - -CREATE TYPE foo.mood AS ENUM ('sad', 'ok', 'happy'); - -COMMENT ON SCHEMA foo IS 'this is the foo schema'; -COMMENT ON TYPE foo.mood IS 'this is the mood type'; -COMMENT ON TABLE foo.bar IS 'this is the bar table'; -COMMENT ON COLUMN foo.bar.baz IS 'this is the baz column'; -COMMENT ON VIEW foo.bat IS 'this is the bat view '; - -- name: ListBar :many SELECT * FROM foo.bar; diff --git a/internal/endtoend/testdata/comment_on/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/comment_on/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..6e2052b167 --- /dev/null +++ b/internal/endtoend/testdata/comment_on/postgresql/stdlib/schema.sql @@ -0,0 +1,16 @@ +CREATE SCHEMA foo; + +CREATE TABLE foo.bar ( + baz text NOT NULL +); + +CREATE VIEW foo.bat AS SELECT * FROM foo.bar; + +CREATE TYPE foo.mood AS ENUM ('sad', 'ok', 'happy'); + +COMMENT ON SCHEMA foo IS 'this is the foo schema'; +COMMENT ON TYPE foo.mood IS 'this is the mood type'; +COMMENT ON TABLE foo.bar IS 'this is the bar table'; +COMMENT ON COLUMN foo.bar.baz IS 'this is the baz column'; +COMMENT ON VIEW foo.bat IS 'this is the bat view '; + diff --git a/internal/endtoend/testdata/comment_on/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/comment_on/postgresql/stdlib/sqlc.json index ba0ecf07f3..3a3e2e510a 100644 --- a/internal/endtoend/testdata/comment_on/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/comment_on/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "name": "querytest", "engine": "postgresql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/comment_syntax/mysql/go/db.go b/internal/endtoend/testdata/comment_syntax/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/comment_syntax/mysql/go/db.go +++ b/internal/endtoend/testdata/comment_syntax/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comment_syntax/mysql/go/models.go b/internal/endtoend/testdata/comment_syntax/mysql/go/models.go index 353c2b0d63..92ddc7826f 100644 --- a/internal/endtoend/testdata/comment_syntax/mysql/go/models.go +++ b/internal/endtoend/testdata/comment_syntax/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comment_syntax/mysql/go/query.sql.go b/internal/endtoend/testdata/comment_syntax/mysql/go/query.sql.go index 7f4b916150..2e94b32488 100644 --- a/internal/endtoend/testdata/comment_syntax/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/comment_syntax/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -22,7 +22,6 @@ func (q *Queries) DoubleDash(ctx context.Context) (sql.NullString, error) { } const hash = `-- name: Hash :one -# name: Hash :one SELECT bar FROM foo LIMIT 1 ` diff --git a/internal/endtoend/testdata/comment_syntax/mysql/query.sql b/internal/endtoend/testdata/comment_syntax/mysql/query.sql index 1add2d737c..148327534c 100644 --- a/internal/endtoend/testdata/comment_syntax/mysql/query.sql +++ b/internal/endtoend/testdata/comment_syntax/mysql/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar text); - -- name: DoubleDash :one SELECT * FROM foo LIMIT 1; diff --git a/internal/endtoend/testdata/comment_syntax/mysql/schema.sql b/internal/endtoend/testdata/comment_syntax/mysql/schema.sql new file mode 100644 index 0000000000..bd55621dc2 --- /dev/null +++ b/internal/endtoend/testdata/comment_syntax/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); + diff --git a/internal/endtoend/testdata/comment_syntax/mysql/sqlc.json b/internal/endtoend/testdata/comment_syntax/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/comment_syntax/mysql/sqlc.json +++ b/internal/endtoend/testdata/comment_syntax/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/models.go index 353c2b0d63..92ddc7826f 100644 --- a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/query.sql.go index 316e13ab14..ac5869164a 100644 --- a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/query.sql index 2efd5e5a1c..ddf6f4b70c 100644 --- a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar text); - -- name: DoubleDash :one SELECT * FROM foo LIMIT 1; diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..bd55621dc2 --- /dev/null +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); + diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/sqlc.json index fbbda5cf31..afdff35e59 100644 --- a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "name": "querytest", "engine": "postgresql", "sql_package": "pgx/v4", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/models.go index a6fa331406..f2fbf9abf3 100644 --- a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/query.sql.go index 2ba49c21a7..752470ce02 100644 --- a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/query.sql index 2efd5e5a1c..ddf6f4b70c 100644 --- a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar text); - -- name: DoubleDash :one SELECT * FROM foo LIMIT 1; diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..bd55621dc2 --- /dev/null +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); + diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/sqlc.json index 61ba68f6b8..a690d83cb5 100644 --- a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "name": "querytest", "engine": "postgresql", "sql_package": "pgx/v5", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/models.go index 353c2b0d63..92ddc7826f 100644 --- a/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/query.sql.go index 843a34aeec..6e2a2003ab 100644 --- a/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/query.sql b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/query.sql index 2efd5e5a1c..ddf6f4b70c 100644 --- a/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar text); - -- name: DoubleDash :one SELECT * FROM foo LIMIT 1; diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..bd55621dc2 --- /dev/null +++ b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); + diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/comment_syntax/sqlite/go/db.go b/internal/endtoend/testdata/comment_syntax/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/comment_syntax/sqlite/go/db.go +++ b/internal/endtoend/testdata/comment_syntax/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comment_syntax/sqlite/go/models.go b/internal/endtoend/testdata/comment_syntax/sqlite/go/models.go index 353c2b0d63..92ddc7826f 100644 --- a/internal/endtoend/testdata/comment_syntax/sqlite/go/models.go +++ b/internal/endtoend/testdata/comment_syntax/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comment_syntax/sqlite/go/query.sql.go b/internal/endtoend/testdata/comment_syntax/sqlite/go/query.sql.go index 843a34aeec..6e2a2003ab 100644 --- a/internal/endtoend/testdata/comment_syntax/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/comment_syntax/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/comment_syntax/sqlite/query.sql b/internal/endtoend/testdata/comment_syntax/sqlite/query.sql index 2efd5e5a1c..ddf6f4b70c 100644 --- a/internal/endtoend/testdata/comment_syntax/sqlite/query.sql +++ b/internal/endtoend/testdata/comment_syntax/sqlite/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar text); - -- name: DoubleDash :one SELECT * FROM foo LIMIT 1; diff --git a/internal/endtoend/testdata/comment_syntax/sqlite/schema.sql b/internal/endtoend/testdata/comment_syntax/sqlite/schema.sql new file mode 100644 index 0000000000..bd55621dc2 --- /dev/null +++ b/internal/endtoend/testdata/comment_syntax/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text); + diff --git a/internal/endtoend/testdata/comment_syntax/sqlite/sqlc.json b/internal/endtoend/testdata/comment_syntax/sqlite/sqlc.json index fcb288cb35..d4963e751f 100644 --- a/internal/endtoend/testdata/comment_syntax/sqlite/sqlc.json +++ b/internal/endtoend/testdata/comment_syntax/sqlite/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "sqlite", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/comparisons/mysql/go/db.go b/internal/endtoend/testdata/comparisons/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/comparisons/mysql/go/db.go +++ b/internal/endtoend/testdata/comparisons/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comparisons/mysql/go/models.go b/internal/endtoend/testdata/comparisons/mysql/go/models.go index 40001531be..65820844a6 100644 --- a/internal/endtoend/testdata/comparisons/mysql/go/models.go +++ b/internal/endtoend/testdata/comparisons/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID uint64 } diff --git a/internal/endtoend/testdata/comparisons/mysql/go/query.sql.go b/internal/endtoend/testdata/comparisons/mysql/go/query.sql.go index 2eb41d45cc..4289448bd8 100644 --- a/internal/endtoend/testdata/comparisons/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/comparisons/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/comparisons/mysql/query.sql b/internal/endtoend/testdata/comparisons/mysql/query.sql index 73714ec749..468a74fdd9 100644 --- a/internal/endtoend/testdata/comparisons/mysql/query.sql +++ b/internal/endtoend/testdata/comparisons/mysql/query.sql @@ -1,8 +1,3 @@ --- Comparison Functions and Operators --- https://www.postgresql.org/docs/current/functions-comparison.html - -CREATE TABLE bar (id serial not null); - -- name: GreaterThan :many SELECT count(*) > 0 FROM bar; diff --git a/internal/endtoend/testdata/comparisons/mysql/schema.sql b/internal/endtoend/testdata/comparisons/mysql/schema.sql new file mode 100644 index 0000000000..45cfd620d0 --- /dev/null +++ b/internal/endtoend/testdata/comparisons/mysql/schema.sql @@ -0,0 +1,5 @@ +-- Comparison Functions and Operators +-- https://www.postgresql.org/docs/current/functions-comparison.html + +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/comparisons/mysql/sqlc.json b/internal/endtoend/testdata/comparisons/mysql/sqlc.json index c02fc9b4cb..b45b90329b 100644 --- a/internal/endtoend/testdata/comparisons/mysql/sqlc.json +++ b/internal/endtoend/testdata/comparisons/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "name": "querytest", "engine": "mysql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/query.sql.go index e10054c74b..2f19b196be 100644 --- a/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/query.sql index 3c609f4660..8763edaa62 100644 --- a/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/query.sql @@ -1,8 +1,3 @@ --- Comparison Functions and Operators --- https://www.postgresql.org/docs/current/functions-comparison.html - -CREATE TABLE bar (id serial not null); - -- name: GreaterThan :many SELECT count(*) > 0 FROM bar; diff --git a/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..45cfd620d0 --- /dev/null +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/schema.sql @@ -0,0 +1,5 @@ +-- Comparison Functions and Operators +-- https://www.postgresql.org/docs/current/functions-comparison.html + +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/sqlc.json index fbbda5cf31..afdff35e59 100644 --- a/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "name": "querytest", "engine": "postgresql", "sql_package": "pgx/v4", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/query.sql.go index e10054c74b..2f19b196be 100644 --- a/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/query.sql index 3c609f4660..8763edaa62 100644 --- a/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/query.sql @@ -1,8 +1,3 @@ --- Comparison Functions and Operators --- https://www.postgresql.org/docs/current/functions-comparison.html - -CREATE TABLE bar (id serial not null); - -- name: GreaterThan :many SELECT count(*) > 0 FROM bar; diff --git a/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..45cfd620d0 --- /dev/null +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/schema.sql @@ -0,0 +1,5 @@ +-- Comparison Functions and Operators +-- https://www.postgresql.org/docs/current/functions-comparison.html + +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/sqlc.json index 61ba68f6b8..a690d83cb5 100644 --- a/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "name": "querytest", "engine": "postgresql", "sql_package": "pgx/v5", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/query.sql.go index c521a3bf65..039e8ac630 100644 --- a/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/comparisons/postgresql/stdlib/query.sql b/internal/endtoend/testdata/comparisons/postgresql/stdlib/query.sql index 3c609f4660..8763edaa62 100644 --- a/internal/endtoend/testdata/comparisons/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/comparisons/postgresql/stdlib/query.sql @@ -1,8 +1,3 @@ --- Comparison Functions and Operators --- https://www.postgresql.org/docs/current/functions-comparison.html - -CREATE TABLE bar (id serial not null); - -- name: GreaterThan :many SELECT count(*) > 0 FROM bar; diff --git a/internal/endtoend/testdata/comparisons/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/comparisons/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..45cfd620d0 --- /dev/null +++ b/internal/endtoend/testdata/comparisons/postgresql/stdlib/schema.sql @@ -0,0 +1,5 @@ +-- Comparison Functions and Operators +-- https://www.postgresql.org/docs/current/functions-comparison.html + +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/comparisons/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/comparisons/postgresql/stdlib/sqlc.json index ba0ecf07f3..3a3e2e510a 100644 --- a/internal/endtoend/testdata/comparisons/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/comparisons/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "name": "querytest", "engine": "postgresql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/comparisons/sqlite/go/db.go b/internal/endtoend/testdata/comparisons/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/comparisons/sqlite/go/db.go +++ b/internal/endtoend/testdata/comparisons/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/comparisons/sqlite/go/models.go b/internal/endtoend/testdata/comparisons/sqlite/go/models.go index 214487814e..1344b5dab9 100644 --- a/internal/endtoend/testdata/comparisons/sqlite/go/models.go +++ b/internal/endtoend/testdata/comparisons/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int64 } diff --git a/internal/endtoend/testdata/comparisons/sqlite/go/query.sql.go b/internal/endtoend/testdata/comparisons/sqlite/go/query.sql.go index c521a3bf65..039e8ac630 100644 --- a/internal/endtoend/testdata/comparisons/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/comparisons/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/comparisons/sqlite/query.sql b/internal/endtoend/testdata/comparisons/sqlite/query.sql index 27d7741d02..8763edaa62 100644 --- a/internal/endtoend/testdata/comparisons/sqlite/query.sql +++ b/internal/endtoend/testdata/comparisons/sqlite/query.sql @@ -1,8 +1,3 @@ --- Comparison Functions and Operators --- https://www.postgresql.org/docs/current/functions-comparison.html - -CREATE TABLE bar (id integer not null primary key autoincrement); - -- name: GreaterThan :many SELECT count(*) > 0 FROM bar; diff --git a/internal/endtoend/testdata/comparisons/sqlite/schema.sql b/internal/endtoend/testdata/comparisons/sqlite/schema.sql new file mode 100644 index 0000000000..d45d58f0e0 --- /dev/null +++ b/internal/endtoend/testdata/comparisons/sqlite/schema.sql @@ -0,0 +1,5 @@ +-- Comparison Functions and Operators +-- https://www.postgresql.org/docs/current/functions-comparison.html + +CREATE TABLE bar (id integer not null primary key autoincrement); + diff --git a/internal/endtoend/testdata/comparisons/sqlite/sqlc.json b/internal/endtoend/testdata/comparisons/sqlite/sqlc.json index 9820cf723f..2c041d7765 100644 --- a/internal/endtoend/testdata/comparisons/sqlite/sqlc.json +++ b/internal/endtoend/testdata/comparisons/sqlite/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "name": "querytest", "engine": "sqlite", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/composite_type/pgx/v4/go/db.go b/internal/endtoend/testdata/composite_type/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/composite_type/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/composite_type/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/composite_type/pgx/v4/go/models.go b/internal/endtoend/testdata/composite_type/pgx/v4/go/models.go index a48b06e650..6ed24d1fa0 100644 --- a/internal/endtoend/testdata/composite_type/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/composite_type/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/composite_type/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/composite_type/pgx/v4/go/query.sql.go index 1d72161575..1c12c60296 100644 --- a/internal/endtoend/testdata/composite_type/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/composite_type/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/composite_type/pgx/v4/query.sql b/internal/endtoend/testdata/composite_type/pgx/v4/query.sql index 8e053a61a2..dc1cf9ed54 100644 --- a/internal/endtoend/testdata/composite_type/pgx/v4/query.sql +++ b/internal/endtoend/testdata/composite_type/pgx/v4/query.sql @@ -1,19 +1,2 @@ -CREATE SCHEMA foo; - -CREATE TYPE point_type AS ( - x integer, - y integer -); - -CREATE TYPE foo.point_type AS ( - x integer, - y integer -); - -CREATE TABLE foo.paths ( - point_one point_type, - point_two foo.point_type -); - -- name: ListPaths :many SELECT * FROM foo.paths; diff --git a/internal/endtoend/testdata/composite_type/pgx/v4/schema.sql b/internal/endtoend/testdata/composite_type/pgx/v4/schema.sql new file mode 100644 index 0000000000..e2d26b7d7b --- /dev/null +++ b/internal/endtoend/testdata/composite_type/pgx/v4/schema.sql @@ -0,0 +1,17 @@ +CREATE SCHEMA foo; + +CREATE TYPE point_type AS ( + x integer, + y integer +); + +CREATE TYPE foo.point_type AS ( + x integer, + y integer +); + +CREATE TABLE foo.paths ( + point_one point_type, + point_two foo.point_type +); + diff --git a/internal/endtoend/testdata/composite_type/pgx/v4/sqlc.json b/internal/endtoend/testdata/composite_type/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/composite_type/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/composite_type/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/composite_type/pgx/v5/go/db.go b/internal/endtoend/testdata/composite_type/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/composite_type/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/composite_type/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/composite_type/pgx/v5/go/models.go b/internal/endtoend/testdata/composite_type/pgx/v5/go/models.go index a48b06e650..6ed24d1fa0 100644 --- a/internal/endtoend/testdata/composite_type/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/composite_type/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/composite_type/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/composite_type/pgx/v5/go/query.sql.go index 1d72161575..1c12c60296 100644 --- a/internal/endtoend/testdata/composite_type/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/composite_type/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/composite_type/pgx/v5/query.sql b/internal/endtoend/testdata/composite_type/pgx/v5/query.sql index 8e053a61a2..dc1cf9ed54 100644 --- a/internal/endtoend/testdata/composite_type/pgx/v5/query.sql +++ b/internal/endtoend/testdata/composite_type/pgx/v5/query.sql @@ -1,19 +1,2 @@ -CREATE SCHEMA foo; - -CREATE TYPE point_type AS ( - x integer, - y integer -); - -CREATE TYPE foo.point_type AS ( - x integer, - y integer -); - -CREATE TABLE foo.paths ( - point_one point_type, - point_two foo.point_type -); - -- name: ListPaths :many SELECT * FROM foo.paths; diff --git a/internal/endtoend/testdata/composite_type/pgx/v5/schema.sql b/internal/endtoend/testdata/composite_type/pgx/v5/schema.sql new file mode 100644 index 0000000000..e2d26b7d7b --- /dev/null +++ b/internal/endtoend/testdata/composite_type/pgx/v5/schema.sql @@ -0,0 +1,17 @@ +CREATE SCHEMA foo; + +CREATE TYPE point_type AS ( + x integer, + y integer +); + +CREATE TYPE foo.point_type AS ( + x integer, + y integer +); + +CREATE TABLE foo.paths ( + point_one point_type, + point_two foo.point_type +); + diff --git a/internal/endtoend/testdata/composite_type/pgx/v5/sqlc.json b/internal/endtoend/testdata/composite_type/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/composite_type/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/composite_type/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/composite_type/stdlib/go/db.go b/internal/endtoend/testdata/composite_type/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/composite_type/stdlib/go/db.go +++ b/internal/endtoend/testdata/composite_type/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/composite_type/stdlib/go/models.go b/internal/endtoend/testdata/composite_type/stdlib/go/models.go index a48b06e650..6ed24d1fa0 100644 --- a/internal/endtoend/testdata/composite_type/stdlib/go/models.go +++ b/internal/endtoend/testdata/composite_type/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/composite_type/stdlib/go/query.sql.go b/internal/endtoend/testdata/composite_type/stdlib/go/query.sql.go index c7480ac53d..a21cb4bfdb 100644 --- a/internal/endtoend/testdata/composite_type/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/composite_type/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/composite_type/stdlib/query.sql b/internal/endtoend/testdata/composite_type/stdlib/query.sql index 8e053a61a2..dc1cf9ed54 100644 --- a/internal/endtoend/testdata/composite_type/stdlib/query.sql +++ b/internal/endtoend/testdata/composite_type/stdlib/query.sql @@ -1,19 +1,2 @@ -CREATE SCHEMA foo; - -CREATE TYPE point_type AS ( - x integer, - y integer -); - -CREATE TYPE foo.point_type AS ( - x integer, - y integer -); - -CREATE TABLE foo.paths ( - point_one point_type, - point_two foo.point_type -); - -- name: ListPaths :many SELECT * FROM foo.paths; diff --git a/internal/endtoend/testdata/composite_type/stdlib/schema.sql b/internal/endtoend/testdata/composite_type/stdlib/schema.sql new file mode 100644 index 0000000000..e2d26b7d7b --- /dev/null +++ b/internal/endtoend/testdata/composite_type/stdlib/schema.sql @@ -0,0 +1,17 @@ +CREATE SCHEMA foo; + +CREATE TYPE point_type AS ( + x integer, + y integer +); + +CREATE TYPE foo.point_type AS ( + x integer, + y integer +); + +CREATE TABLE foo.paths ( + point_one point_type, + point_two foo.point_type +); + diff --git a/internal/endtoend/testdata/composite_type/stdlib/sqlc.json b/internal/endtoend/testdata/composite_type/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/composite_type/stdlib/sqlc.json +++ b/internal/endtoend/testdata/composite_type/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/db.go b/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/db.go index 3d2b5bf3a3..cd5bbb8e08 100644 --- a/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/db.go +++ b/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/models.go b/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/models.go index 4ad5e263e1..5b44f5b1ae 100644 --- a/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/models.go +++ b/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/query.sql.go b/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/query.sql.go index 47f689c354..85ba941f35 100644 --- a/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/query.sql.go +++ b/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package db diff --git a/internal/endtoend/testdata/conflicted_arg_name/postgresql/query.sql b/internal/endtoend/testdata/conflicted_arg_name/postgresql/query.sql index db97e5f333..d9e4446876 100644 --- a/internal/endtoend/testdata/conflicted_arg_name/postgresql/query.sql +++ b/internal/endtoend/testdata/conflicted_arg_name/postgresql/query.sql @@ -1,10 +1,3 @@ -CREATE TABLE foo ( - time date NOT NULL, - time2 date NOT NULL, - uuid uuid NOT NULL, - uuid2 uuid NOT NULL -); - -- name: Time2ByTime :one SELECT time2 FROM foo WHERE time=$1; diff --git a/internal/endtoend/testdata/conflicted_arg_name/postgresql/schema.sql b/internal/endtoend/testdata/conflicted_arg_name/postgresql/schema.sql new file mode 100644 index 0000000000..2d3521f784 --- /dev/null +++ b/internal/endtoend/testdata/conflicted_arg_name/postgresql/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE foo ( + time date NOT NULL, + time2 date NOT NULL, + uuid uuid NOT NULL, + uuid2 uuid NOT NULL +); + diff --git a/internal/endtoend/testdata/conflicted_arg_name/postgresql/sqlc.json b/internal/endtoend/testdata/conflicted_arg_name/postgresql/sqlc.json index ff443fe1b9..2a46100899 100644 --- a/internal/endtoend/testdata/conflicted_arg_name/postgresql/sqlc.json +++ b/internal/endtoend/testdata/conflicted_arg_name/postgresql/sqlc.json @@ -4,7 +4,7 @@ { "path": "db", "engine": "postgresql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/copyfrom/mysql/go/copyfrom.go b/internal/endtoend/testdata/copyfrom/mysql/go/copyfrom.go index eb7e68e2d6..7011f902d0 100644 --- a/internal/endtoend/testdata/copyfrom/mysql/go/copyfrom.go +++ b/internal/endtoend/testdata/copyfrom/mysql/go/copyfrom.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: copyfrom.go package querytest diff --git a/internal/endtoend/testdata/copyfrom/mysql/go/db.go b/internal/endtoend/testdata/copyfrom/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/copyfrom/mysql/go/db.go +++ b/internal/endtoend/testdata/copyfrom/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/copyfrom/mysql/go/models.go b/internal/endtoend/testdata/copyfrom/mysql/go/models.go index f7e87d8292..f8aabf5067 100644 --- a/internal/endtoend/testdata/copyfrom/mysql/go/models.go +++ b/internal/endtoend/testdata/copyfrom/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/copyfrom/mysql/go/query.sql.go b/internal/endtoend/testdata/copyfrom/mysql/go/query.sql.go index 9b22bfba47..730ffecd49 100644 --- a/internal/endtoend/testdata/copyfrom/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/copyfrom/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/copyfrom/mysql/query.sql b/internal/endtoend/testdata/copyfrom/mysql/query.sql index 577655c4aa..4c5fd5f54c 100644 --- a/internal/endtoend/testdata/copyfrom/mysql/query.sql +++ b/internal/endtoend/testdata/copyfrom/mysql/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (a text, b integer, c DATETIME, d DATE); - -- name: InsertValues :copyfrom INSERT INTO foo (a, b, c, d) VALUES (?, ?, ?, ?); diff --git a/internal/endtoend/testdata/copyfrom/mysql/schema.sql b/internal/endtoend/testdata/copyfrom/mysql/schema.sql new file mode 100644 index 0000000000..e447086c56 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b integer, c DATETIME, d DATE); + diff --git a/internal/endtoend/testdata/copyfrom/mysql/sqlc.json b/internal/endtoend/testdata/copyfrom/mysql/sqlc.json index 5ae94271b1..7dabfeef72 100644 --- a/internal/endtoend/testdata/copyfrom/mysql/sqlc.json +++ b/internal/endtoend/testdata/copyfrom/mysql/sqlc.json @@ -7,7 +7,7 @@ "sql_driver": "github.com/go-sql-driver/mysql", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/copyfrom.go b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/copyfrom.go index 137f0823ec..62f36b2dd4 100644 --- a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/copyfrom.go +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/copyfrom.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: copyfrom.go package querytest diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/db.go index e3dd1539f0..060bdb6aa5 100644 --- a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/models.go index ee9c9d3d4e..f0e5a24373 100644 --- a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/querier.go b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/querier.go index f20d745bbe..bd6afe1e9f 100644 --- a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/querier.go +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/query.sql.go index e481424c5e..b48a3b26eb 100644 --- a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/query.sql index 850248cda6..8c9aa00ee8 100644 --- a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/query.sql @@ -1,6 +1,3 @@ -CREATE SCHEMA myschema; -CREATE TABLE myschema.foo (a text, b integer); - -- name: InsertValues :copyfrom -- InsertValues inserts multiple values using copy. INSERT INTO myschema.foo (a, b) VALUES ($1, $2); diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..e53abe57ad --- /dev/null +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA myschema; +CREATE TABLE myschema.foo (a text, b integer); + diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/sqlc.json index 2ec707567a..e0530db353 100644 --- a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_interface": true } diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/copyfrom.go b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/copyfrom.go index 54d4aa9193..d013e204cf 100644 --- a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/copyfrom.go +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/copyfrom.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: copyfrom.go package querytest diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/db.go index ed7b7f5f9a..9243b4b89a 100644 --- a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/models.go index 219b82bdc2..7226216da5 100644 --- a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/querier.go b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/querier.go index 5b24dd55e1..e64286494d 100644 --- a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/querier.go +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/query.sql.go index 0d46a845df..9f474061dd 100644 --- a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/query.sql index 850248cda6..8c9aa00ee8 100644 --- a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/query.sql @@ -1,6 +1,3 @@ -CREATE SCHEMA myschema; -CREATE TABLE myschema.foo (a text, b integer); - -- name: InsertValues :copyfrom -- InsertValues inserts multiple values using copy. INSERT INTO myschema.foo (a, b) VALUES ($1, $2); diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..e53abe57ad --- /dev/null +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA myschema; +CREATE TABLE myschema.foo (a text, b integer); + diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/sqlc.json index 170791aa85..007fb8530f 100644 --- a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_interface": true } diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/copyfrom.go b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/copyfrom.go index 279a25d83a..3d0ea89eb3 100644 --- a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/copyfrom.go +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/copyfrom.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: copyfrom.go package querytest diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/db.go index e3dd1539f0..060bdb6aa5 100644 --- a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/models.go index ee9c9d3d4e..f0e5a24373 100644 --- a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/query.sql.go index 226971a5a5..69714fb64d 100644 --- a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/query.sql index 6260910cf1..7b7f2bbe90 100644 --- a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/query.sql @@ -1,6 +1,3 @@ -CREATE SCHEMA myschema; -CREATE TABLE myschema.foo (a text, b integer); - -- name: InsertValues :copyfrom INSERT INTO myschema.foo (a, b) VALUES ($1, $2); diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..e53abe57ad --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA myschema; +CREATE TABLE myschema.foo (a text, b integer); + diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/copyfrom.go b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/copyfrom.go index 279a25d83a..3d0ea89eb3 100644 --- a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/copyfrom.go +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/copyfrom.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: copyfrom.go package querytest diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/db.go index ed7b7f5f9a..9243b4b89a 100644 --- a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/models.go index 219b82bdc2..7226216da5 100644 --- a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/query.sql.go index 722967a951..33ce4a1458 100644 --- a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/query.sql index 6260910cf1..7b7f2bbe90 100644 --- a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/query.sql @@ -1,6 +1,3 @@ -CREATE SCHEMA myschema; -CREATE TABLE myschema.foo (a text, b integer); - -- name: InsertValues :copyfrom INSERT INTO myschema.foo (a, b) VALUES ($1, $2); diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..e53abe57ad --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA myschema; +CREATE TABLE myschema.foo (a text, b integer); + diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/go/copyfrom.go b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/go/copyfrom.go new file mode 100644 index 0000000000..7baf05c8ab --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/go/copyfrom.go @@ -0,0 +1,51 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: copyfrom.go + +package querytest + +import ( + "context" + "fmt" + "io" + "sync/atomic" + + "github.com/go-sql-driver/mysql" + "github.com/hexon/mysqltsv" +) + +var readerHandlerSequenceForInsertMultipleValues uint32 = 1 + +func convertRowsForInsertMultipleValues(w *io.PipeWriter, arg []InsertMultipleValuesParams) { + e := mysqltsv.NewEncoder(w, 2, nil) + for _, row := range arg { + e.AppendValue(row.A) + e.AppendValue(row.B) + } + w.CloseWithError(e.Close()) +} + +// InsertMultipleValues uses MySQL's LOAD DATA LOCAL INFILE and is not atomic. +// +// Errors and duplicate keys are treated as warnings and insertion will +// continue, even without an error for some cases. Use this in a transaction +// and use SHOW WARNINGS to check for any problems and roll back if you want to. +// +// Check the documentation for more information: +// https://dev.mysql.com/doc/refman/8.0/en/load-data.html#load-data-error-handling +func (q *Queries) InsertMultipleValues(ctx context.Context, arg []InsertMultipleValuesParams) (int64, error) { + pr, pw := io.Pipe() + defer pr.Close() + rh := fmt.Sprintf("InsertMultipleValues_%d", atomic.AddUint32(&readerHandlerSequenceForInsertMultipleValues, 1)) + mysql.RegisterReaderHandler(rh, func() io.Reader { return pr }) + defer mysql.DeregisterReaderHandler(rh) + go convertRowsForInsertMultipleValues(pw, arg) + // The string interpolation is necessary because LOAD DATA INFILE requires + // the file name to be given as a literal string. + result, err := q.db.ExecContext(ctx, fmt.Sprintf("LOAD DATA LOCAL INFILE '%s' INTO TABLE `foo` %s (a, b)", "Reader::"+rh, mysqltsv.Escaping)) + if err != nil { + return 0, err + } + return result.RowsAffected() +} diff --git a/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/go/db.go b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/go/models.go b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/go/models.go new file mode 100644 index 0000000000..de35bade9f --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A sql.NullString + B sql.NullString +} diff --git a/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/go/query.sql.go b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/go/query.sql.go new file mode 100644 index 0000000000..987547dff5 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "database/sql" +) + +const insertMultipleValues = `-- name: InsertMultipleValues :copyfrom +INSERT INTO foo (a, b) VALUES (?, ?) +` + +type InsertMultipleValuesParams struct { + A sql.NullString + B sql.NullString +} diff --git a/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/query.sql b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/query.sql new file mode 100644 index 0000000000..18a13f88e6 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/query.sql @@ -0,0 +1,2 @@ +-- name: InsertMultipleValues :copyfrom +INSERT INTO foo (a, b) VALUES (?, ?); diff --git a/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/schema.sql b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/schema.sql new file mode 100644 index 0000000000..dd2f6b6b50 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (a text, b text); diff --git a/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/sqlc.json b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/sqlc.json new file mode 100644 index 0000000000..0990bc2fef --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/sqlc.json @@ -0,0 +1,15 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "sql_package": "database/sql", + "sql_driver": "github.com/go-sql-driver/mysql", + "engine": "mysql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "query_parameter_limit": 4 + } + ] +} diff --git a/internal/endtoend/testdata/copyfrom_named_params/issue.md b/internal/endtoend/testdata/copyfrom_named_params/issue.md new file mode 100644 index 0000000000..6d030f18f9 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_named_params/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/2833 diff --git a/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/copyfrom.go b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/copyfrom.go new file mode 100644 index 0000000000..99466c2d2e --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/copyfrom.go @@ -0,0 +1,43 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: copyfrom.go + +package querytest + +import ( + "context" +) + +// iteratorForStageUserData implements pgx.CopyFromSource. +type iteratorForStageUserData struct { + rows []StageUserDataParams + skippedFirstNextCall bool +} + +func (r *iteratorForStageUserData) Next() bool { + if len(r.rows) == 0 { + return false + } + if !r.skippedFirstNextCall { + r.skippedFirstNextCall = true + return true + } + r.rows = r.rows[1:] + return len(r.rows) > 0 +} + +func (r iteratorForStageUserData) Values() ([]interface{}, error) { + return []interface{}{ + r.rows[0].IDParam, + r.rows[0].UserParam, + }, nil +} + +func (r iteratorForStageUserData) Err() error { + return nil +} + +func (q *Queries) StageUserData(ctx context.Context, arg []StageUserDataParams) (int64, error) { + return q.db.CopyFrom(ctx, []string{"user_data"}, []string{"id", "user"}, &iteratorForStageUserData{rows: arg}) +} diff --git a/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/db.go b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..9243b4b89a --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/db.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row + CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error) +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/models.go b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..f19c58e317 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type UserDatum struct { + ID string + User string +} diff --git a/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..94994f8fe9 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/query.sql.go @@ -0,0 +1,11 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +type StageUserDataParams struct { + IDParam string + UserParam string +} diff --git a/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/query.sql b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/query.sql new file mode 100644 index 0000000000..0a2c750845 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/query.sql @@ -0,0 +1,6 @@ +-- name: StageUserData :copyfrom +insert into "user_data" ("id", "user") +values ( + sqlc.arg('id_param'), + sqlc.arg('user_param') +); diff --git a/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/schema.sql b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..87d16b404b --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/schema.sql @@ -0,0 +1,5 @@ +create table "user_data" ( + "id" varchar not null, + "user" varchar not null, + primary key ("id") +); diff --git a/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/copyfrom.go b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/copyfrom.go index 91864086a3..76754b4c2f 100644 --- a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/copyfrom.go +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/copyfrom.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: copyfrom.go package querytest diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/db.go index e3dd1539f0..060bdb6aa5 100644 --- a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/models.go index dd5cd552d2..188bf74be1 100644 --- a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Author struct { AuthorID int32 } diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/querier.go b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/querier.go index 7f195bbee9..c7d4e8c0f8 100644 --- a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/querier.go +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/query.sql.go index ddc6c6534c..a80cdbd2f0 100644 --- a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/query.sql.go @@ -1,8 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest - -import () diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/query.sql index b505b6b265..77f99802ec 100644 --- a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/query.sql @@ -1,6 +1,2 @@ -CREATE TABLE authors ( - author_id SERIAL PRIMARY KEY -); - -- name: CreateAuthors :copyfrom INSERT INTO authors (author_id) VALUES ($1); diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..634d49230f --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE authors ( + author_id SERIAL PRIMARY KEY +); + diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/sqlc.json index 2ec707567a..e0530db353 100644 --- a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_interface": true } diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/copyfrom.go b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/copyfrom.go index 91864086a3..76754b4c2f 100644 --- a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/copyfrom.go +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/copyfrom.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: copyfrom.go package querytest diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/db.go index ed7b7f5f9a..9243b4b89a 100644 --- a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/models.go index dd5cd552d2..188bf74be1 100644 --- a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Author struct { AuthorID int32 } diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/querier.go b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/querier.go index 7f195bbee9..c7d4e8c0f8 100644 --- a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/querier.go +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/query.sql.go index ddc6c6534c..a80cdbd2f0 100644 --- a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/query.sql.go @@ -1,8 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest - -import () diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/query.sql index b505b6b265..77f99802ec 100644 --- a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/query.sql @@ -1,6 +1,2 @@ -CREATE TABLE authors ( - author_id SERIAL PRIMARY KEY -); - -- name: CreateAuthors :copyfrom INSERT INTO authors (author_id) VALUES ($1); diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..634d49230f --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE authors ( + author_id SERIAL PRIMARY KEY +); + diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/sqlc.json index 170791aa85..007fb8530f 100644 --- a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_interface": true } diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/issue.md b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/issue.md new file mode 100644 index 0000000000..4838ed77c2 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/3443 \ No newline at end of file diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/go/copyfrom.go b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/go/copyfrom.go new file mode 100644 index 0000000000..7b5e8e4a32 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/go/copyfrom.go @@ -0,0 +1,50 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: copyfrom.go + +package querytest + +import ( + "context" + "fmt" + "io" + "sync/atomic" + + "github.com/go-sql-driver/mysql" + "github.com/hexon/mysqltsv" +) + +var readerHandlerSequenceForInsertSingleValue uint32 = 1 + +func convertRowsForInsertSingleValue(w *io.PipeWriter, arg []InsertSingleValueParams) { + e := mysqltsv.NewEncoder(w, 1, nil) + for _, row := range arg { + e.AppendValue(row.A) + } + w.CloseWithError(e.Close()) +} + +// InsertSingleValue uses MySQL's LOAD DATA LOCAL INFILE and is not atomic. +// +// Errors and duplicate keys are treated as warnings and insertion will +// continue, even without an error for some cases. Use this in a transaction +// and use SHOW WARNINGS to check for any problems and roll back if you want to. +// +// Check the documentation for more information: +// https://dev.mysql.com/doc/refman/8.0/en/load-data.html#load-data-error-handling +func (q *Queries) InsertSingleValue(ctx context.Context, arg []InsertSingleValueParams) (int64, error) { + pr, pw := io.Pipe() + defer pr.Close() + rh := fmt.Sprintf("InsertSingleValue_%d", atomic.AddUint32(&readerHandlerSequenceForInsertSingleValue, 1)) + mysql.RegisterReaderHandler(rh, func() io.Reader { return pr }) + defer mysql.DeregisterReaderHandler(rh) + go convertRowsForInsertSingleValue(pw, arg) + // The string interpolation is necessary because LOAD DATA INFILE requires + // the file name to be given as a literal string. + result, err := q.db.ExecContext(ctx, fmt.Sprintf("LOAD DATA LOCAL INFILE '%s' INTO TABLE `foo` %s (a)", "Reader::"+rh, mysqltsv.Escaping)) + if err != nil { + return 0, err + } + return result.RowsAffected() +} diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/go/db.go b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/go/models.go b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/go/models.go new file mode 100644 index 0000000000..ef22c3818c --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A sql.NullString +} diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/go/query.sql.go b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/go/query.sql.go new file mode 100644 index 0000000000..133d1b64ed --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/go/query.sql.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "database/sql" +) + +const insertSingleValue = `-- name: InsertSingleValue :copyfrom +INSERT INTO foo (a) VALUES (?) +` + +type InsertSingleValueParams struct { + A sql.NullString +} diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/query.sql b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/query.sql new file mode 100644 index 0000000000..091c90316b --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/query.sql @@ -0,0 +1,2 @@ +-- name: InsertSingleValue :copyfrom +INSERT INTO foo (a) VALUES (?); diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/schema.sql b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/schema.sql new file mode 100644 index 0000000000..022bbd6f91 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (a text); diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/sqlc.json b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/sqlc.json new file mode 100644 index 0000000000..4a4d43c146 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/sqlc.json @@ -0,0 +1,15 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "sql_package": "database/sql", + "sql_driver": "github.com/go-sql-driver/mysql", + "engine": "mysql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "query_parameter_limit": 0 + } + ] +} diff --git a/internal/endtoend/testdata/count_star/mysql/go/db.go b/internal/endtoend/testdata/count_star/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/count_star/mysql/go/db.go +++ b/internal/endtoend/testdata/count_star/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/count_star/mysql/go/models.go b/internal/endtoend/testdata/count_star/mysql/go/models.go index 40001531be..65820844a6 100644 --- a/internal/endtoend/testdata/count_star/mysql/go/models.go +++ b/internal/endtoend/testdata/count_star/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID uint64 } diff --git a/internal/endtoend/testdata/count_star/mysql/go/query.sql.go b/internal/endtoend/testdata/count_star/mysql/go/query.sql.go index b6d5b041c7..de91b29d08 100644 --- a/internal/endtoend/testdata/count_star/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/count_star/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/count_star/mysql/query.sql b/internal/endtoend/testdata/count_star/mysql/query.sql index 5f608a69b5..6cba4363c5 100644 --- a/internal/endtoend/testdata/count_star/mysql/query.sql +++ b/internal/endtoend/testdata/count_star/mysql/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id serial not null); - -- name: CountStarLower :one SELECT count(*) FROM bar; diff --git a/internal/endtoend/testdata/count_star/mysql/schema.sql b/internal/endtoend/testdata/count_star/mysql/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/count_star/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/count_star/mysql/sqlc.json b/internal/endtoend/testdata/count_star/mysql/sqlc.json index c02fc9b4cb..b45b90329b 100644 --- a/internal/endtoend/testdata/count_star/mysql/sqlc.json +++ b/internal/endtoend/testdata/count_star/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "name": "querytest", "engine": "mysql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/query.sql.go index e9976577ee..2f3daa3ac0 100644 --- a/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/count_star/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/query.sql index 5f608a69b5..6cba4363c5 100644 --- a/internal/endtoend/testdata/count_star/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id serial not null); - -- name: CountStarLower :one SELECT count(*) FROM bar; diff --git a/internal/endtoend/testdata/count_star/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/count_star/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/sqlc.json index fbbda5cf31..afdff35e59 100644 --- a/internal/endtoend/testdata/count_star/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "name": "querytest", "engine": "postgresql", "sql_package": "pgx/v4", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/query.sql.go index e9976577ee..2f3daa3ac0 100644 --- a/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/count_star/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/query.sql index 5f608a69b5..6cba4363c5 100644 --- a/internal/endtoend/testdata/count_star/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id serial not null); - -- name: CountStarLower :one SELECT count(*) FROM bar; diff --git a/internal/endtoend/testdata/count_star/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/count_star/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/sqlc.json index 61ba68f6b8..a690d83cb5 100644 --- a/internal/endtoend/testdata/count_star/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "name": "querytest", "engine": "postgresql", "sql_package": "pgx/v5", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/count_star/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/count_star/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/count_star/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/count_star/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/count_star/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/count_star/postgresql/stdlib/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/count_star/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/count_star/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/count_star/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/count_star/postgresql/stdlib/go/query.sql.go index b6d5b041c7..de91b29d08 100644 --- a/internal/endtoend/testdata/count_star/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/count_star/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/count_star/postgresql/stdlib/query.sql b/internal/endtoend/testdata/count_star/postgresql/stdlib/query.sql index 5f608a69b5..6cba4363c5 100644 --- a/internal/endtoend/testdata/count_star/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/count_star/postgresql/stdlib/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id serial not null); - -- name: CountStarLower :one SELECT count(*) FROM bar; diff --git a/internal/endtoend/testdata/count_star/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/count_star/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/count_star/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/count_star/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/count_star/postgresql/stdlib/sqlc.json index ba0ecf07f3..3a3e2e510a 100644 --- a/internal/endtoend/testdata/count_star/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/count_star/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "name": "querytest", "engine": "postgresql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/count_star/sqlite/go/db.go b/internal/endtoend/testdata/count_star/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/count_star/sqlite/go/db.go +++ b/internal/endtoend/testdata/count_star/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/count_star/sqlite/go/models.go b/internal/endtoend/testdata/count_star/sqlite/go/models.go index 214487814e..1344b5dab9 100644 --- a/internal/endtoend/testdata/count_star/sqlite/go/models.go +++ b/internal/endtoend/testdata/count_star/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int64 } diff --git a/internal/endtoend/testdata/count_star/sqlite/go/query.sql.go b/internal/endtoend/testdata/count_star/sqlite/go/query.sql.go index b6d5b041c7..de91b29d08 100644 --- a/internal/endtoend/testdata/count_star/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/count_star/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/create_materialized_view/postgresql/go/db.go b/internal/endtoend/testdata/create_materialized_view/postgresql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/create_materialized_view/postgresql/go/db.go +++ b/internal/endtoend/testdata/create_materialized_view/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/create_materialized_view/postgresql/go/models.go b/internal/endtoend/testdata/create_materialized_view/postgresql/go/models.go index a262a56ba8..ef71ea2fe9 100644 --- a/internal/endtoend/testdata/create_materialized_view/postgresql/go/models.go +++ b/internal/endtoend/testdata/create_materialized_view/postgresql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Val string } diff --git a/internal/endtoend/testdata/create_materialized_view/postgresql/go/query.sql.go b/internal/endtoend/testdata/create_materialized_view/postgresql/go/query.sql.go index f1e261b912..4e81626c20 100644 --- a/internal/endtoend/testdata/create_materialized_view/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/create_materialized_view/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/create_table_as/postgresql/go/db.go b/internal/endtoend/testdata/create_table_as/postgresql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/create_table_as/postgresql/go/db.go +++ b/internal/endtoend/testdata/create_table_as/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/create_table_as/postgresql/go/models.go b/internal/endtoend/testdata/create_table_as/postgresql/go/models.go index 3fe9c3f89e..342b0365d1 100644 --- a/internal/endtoend/testdata/create_table_as/postgresql/go/models.go +++ b/internal/endtoend/testdata/create_table_as/postgresql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Val string } diff --git a/internal/endtoend/testdata/create_table_as/postgresql/go/query.sql.go b/internal/endtoend/testdata/create_table_as/postgresql/go/query.sql.go index 003e87736b..e5b7ce3617 100644 --- a/internal/endtoend/testdata/create_table_as/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/create_table_as/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/create_table_like/mysql/go/db.go b/internal/endtoend/testdata/create_table_like/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/create_table_like/mysql/go/db.go +++ b/internal/endtoend/testdata/create_table_like/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/create_table_like/mysql/go/models.go b/internal/endtoend/testdata/create_table_like/mysql/go/models.go index 3c19fcb0cf..6bf0efbef0 100644 --- a/internal/endtoend/testdata/create_table_like/mysql/go/models.go +++ b/internal/endtoend/testdata/create_table_like/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/create_table_like/mysql/go/query.sql.go b/internal/endtoend/testdata/create_table_like/mysql/go/query.sql.go index f9c35e648b..850a585294 100644 --- a/internal/endtoend/testdata/create_table_like/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/create_table_like/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/create_table_like/postgresql/go/db.go b/internal/endtoend/testdata/create_table_like/postgresql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/create_table_like/postgresql/go/db.go +++ b/internal/endtoend/testdata/create_table_like/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/create_table_like/postgresql/go/models.go b/internal/endtoend/testdata/create_table_like/postgresql/go/models.go index 3c19fcb0cf..6bf0efbef0 100644 --- a/internal/endtoend/testdata/create_table_like/postgresql/go/models.go +++ b/internal/endtoend/testdata/create_table_like/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/create_table_like/postgresql/go/query.sql.go b/internal/endtoend/testdata/create_table_like/postgresql/go/query.sql.go index f9c35e648b..850a585294 100644 --- a/internal/endtoend/testdata/create_table_like/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/create_table_like/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/create_view/mysql/go/db.go b/internal/endtoend/testdata/create_view/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/create_view/mysql/go/db.go +++ b/internal/endtoend/testdata/create_view/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/create_view/mysql/go/models.go b/internal/endtoend/testdata/create_view/mysql/go/models.go index 505685e64c..ff7893834a 100644 --- a/internal/endtoend/testdata/create_view/mysql/go/models.go +++ b/internal/endtoend/testdata/create_view/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/create_view/mysql/go/query.sql.go b/internal/endtoend/testdata/create_view/mysql/go/query.sql.go index cd1727bf88..8f9c3c7c1a 100644 --- a/internal/endtoend/testdata/create_view/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/create_view/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/create_view/postgresql/go/db.go b/internal/endtoend/testdata/create_view/postgresql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/create_view/postgresql/go/db.go +++ b/internal/endtoend/testdata/create_view/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/create_view/postgresql/go/models.go b/internal/endtoend/testdata/create_view/postgresql/go/models.go index 505685e64c..ff7893834a 100644 --- a/internal/endtoend/testdata/create_view/postgresql/go/models.go +++ b/internal/endtoend/testdata/create_view/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/create_view/postgresql/go/query.sql.go b/internal/endtoend/testdata/create_view/postgresql/go/query.sql.go index 3c667cae75..65aa0b1479 100644 --- a/internal/endtoend/testdata/create_view/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/create_view/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/create_view/sqlite/go/db.go b/internal/endtoend/testdata/create_view/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/create_view/sqlite/go/db.go +++ b/internal/endtoend/testdata/create_view/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/create_view/sqlite/go/models.go b/internal/endtoend/testdata/create_view/sqlite/go/models.go index b48f0c9e12..681d1840a6 100644 --- a/internal/endtoend/testdata/create_view/sqlite/go/models.go +++ b/internal/endtoend/testdata/create_view/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/create_view/sqlite/go/query.sql.go b/internal/endtoend/testdata/create_view/sqlite/go/query.sql.go index 2aff222c28..f7b6baa8db 100644 --- a/internal/endtoend/testdata/create_view/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/create_view/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_count/mysql/go/db.go b/internal/endtoend/testdata/cte_count/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/cte_count/mysql/go/db.go +++ b/internal/endtoend/testdata/cte_count/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cte_count/mysql/go/models.go b/internal/endtoend/testdata/cte_count/mysql/go/models.go index 118ea0385c..4dc79596a7 100644 --- a/internal/endtoend/testdata/cte_count/mysql/go/models.go +++ b/internal/endtoend/testdata/cte_count/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { Ready bool } diff --git a/internal/endtoend/testdata/cte_count/mysql/go/query.sql.go b/internal/endtoend/testdata/cte_count/mysql/go/query.sql.go index c56a05901e..02370c4c8f 100644 --- a/internal/endtoend/testdata/cte_count/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/cte_count/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_count/mysql/query.sql b/internal/endtoend/testdata/cte_count/mysql/query.sql index 677f2ed559..9afd2e4935 100644 --- a/internal/endtoend/testdata/cte_count/mysql/query.sql +++ b/internal/endtoend/testdata/cte_count/mysql/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (ready bool not null); - -- name: CTECount :many WITH all_count AS ( SELECT count(*) FROM bar diff --git a/internal/endtoend/testdata/cte_count/mysql/schema.sql b/internal/endtoend/testdata/cte_count/mysql/schema.sql new file mode 100644 index 0000000000..1a17eee167 --- /dev/null +++ b/internal/endtoend/testdata/cte_count/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (ready bool not null); + diff --git a/internal/endtoend/testdata/cte_count/mysql/sqlc.json b/internal/endtoend/testdata/cte_count/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/cte_count/mysql/sqlc.json +++ b/internal/endtoend/testdata/cte_count/mysql/sqlc.json @@ -5,7 +5,7 @@ "engine": "mysql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/cte_count/pgx/v4/go/db.go b/internal/endtoend/testdata/cte_count/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/cte_count/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/cte_count/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cte_count/pgx/v4/go/models.go b/internal/endtoend/testdata/cte_count/pgx/v4/go/models.go index 118ea0385c..4dc79596a7 100644 --- a/internal/endtoend/testdata/cte_count/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/cte_count/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { Ready bool } diff --git a/internal/endtoend/testdata/cte_count/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/cte_count/pgx/v4/go/query.sql.go index c8ccf33afe..e8af35fbd1 100644 --- a/internal/endtoend/testdata/cte_count/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/cte_count/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_count/pgx/v4/query.sql b/internal/endtoend/testdata/cte_count/pgx/v4/query.sql index 677f2ed559..9afd2e4935 100644 --- a/internal/endtoend/testdata/cte_count/pgx/v4/query.sql +++ b/internal/endtoend/testdata/cte_count/pgx/v4/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (ready bool not null); - -- name: CTECount :many WITH all_count AS ( SELECT count(*) FROM bar diff --git a/internal/endtoend/testdata/cte_count/pgx/v4/schema.sql b/internal/endtoend/testdata/cte_count/pgx/v4/schema.sql new file mode 100644 index 0000000000..1a17eee167 --- /dev/null +++ b/internal/endtoend/testdata/cte_count/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (ready bool not null); + diff --git a/internal/endtoend/testdata/cte_count/pgx/v4/sqlc.json b/internal/endtoend/testdata/cte_count/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/cte_count/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/cte_count/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/cte_count/pgx/v5/go/db.go b/internal/endtoend/testdata/cte_count/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/cte_count/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/cte_count/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cte_count/pgx/v5/go/models.go b/internal/endtoend/testdata/cte_count/pgx/v5/go/models.go index 118ea0385c..4dc79596a7 100644 --- a/internal/endtoend/testdata/cte_count/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/cte_count/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { Ready bool } diff --git a/internal/endtoend/testdata/cte_count/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/cte_count/pgx/v5/go/query.sql.go index c8ccf33afe..e8af35fbd1 100644 --- a/internal/endtoend/testdata/cte_count/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/cte_count/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_count/pgx/v5/query.sql b/internal/endtoend/testdata/cte_count/pgx/v5/query.sql index 677f2ed559..9afd2e4935 100644 --- a/internal/endtoend/testdata/cte_count/pgx/v5/query.sql +++ b/internal/endtoend/testdata/cte_count/pgx/v5/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (ready bool not null); - -- name: CTECount :many WITH all_count AS ( SELECT count(*) FROM bar diff --git a/internal/endtoend/testdata/cte_count/pgx/v5/schema.sql b/internal/endtoend/testdata/cte_count/pgx/v5/schema.sql new file mode 100644 index 0000000000..1a17eee167 --- /dev/null +++ b/internal/endtoend/testdata/cte_count/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (ready bool not null); + diff --git a/internal/endtoend/testdata/cte_count/pgx/v5/sqlc.json b/internal/endtoend/testdata/cte_count/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/cte_count/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/cte_count/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/cte_count/stdlib/go/db.go b/internal/endtoend/testdata/cte_count/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/cte_count/stdlib/go/db.go +++ b/internal/endtoend/testdata/cte_count/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cte_count/stdlib/go/models.go b/internal/endtoend/testdata/cte_count/stdlib/go/models.go index 118ea0385c..4dc79596a7 100644 --- a/internal/endtoend/testdata/cte_count/stdlib/go/models.go +++ b/internal/endtoend/testdata/cte_count/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { Ready bool } diff --git a/internal/endtoend/testdata/cte_count/stdlib/go/query.sql.go b/internal/endtoend/testdata/cte_count/stdlib/go/query.sql.go index c56a05901e..02370c4c8f 100644 --- a/internal/endtoend/testdata/cte_count/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/cte_count/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_count/stdlib/query.sql b/internal/endtoend/testdata/cte_count/stdlib/query.sql index 677f2ed559..9afd2e4935 100644 --- a/internal/endtoend/testdata/cte_count/stdlib/query.sql +++ b/internal/endtoend/testdata/cte_count/stdlib/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (ready bool not null); - -- name: CTECount :many WITH all_count AS ( SELECT count(*) FROM bar diff --git a/internal/endtoend/testdata/cte_count/stdlib/schema.sql b/internal/endtoend/testdata/cte_count/stdlib/schema.sql new file mode 100644 index 0000000000..1a17eee167 --- /dev/null +++ b/internal/endtoend/testdata/cte_count/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (ready bool not null); + diff --git a/internal/endtoend/testdata/cte_count/stdlib/sqlc.json b/internal/endtoend/testdata/cte_count/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/cte_count/stdlib/sqlc.json +++ b/internal/endtoend/testdata/cte_count/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/cte_filter/mysql/go/db.go b/internal/endtoend/testdata/cte_filter/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/cte_filter/mysql/go/db.go +++ b/internal/endtoend/testdata/cte_filter/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cte_filter/mysql/go/models.go b/internal/endtoend/testdata/cte_filter/mysql/go/models.go index 118ea0385c..4dc79596a7 100644 --- a/internal/endtoend/testdata/cte_filter/mysql/go/models.go +++ b/internal/endtoend/testdata/cte_filter/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { Ready bool } diff --git a/internal/endtoend/testdata/cte_filter/mysql/go/query.sql.go b/internal/endtoend/testdata/cte_filter/mysql/go/query.sql.go index 1bb00d4a8f..fd0e7ce6b2 100644 --- a/internal/endtoend/testdata/cte_filter/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/cte_filter/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_filter/mysql/query.sql b/internal/endtoend/testdata/cte_filter/mysql/query.sql index c1c56d6f96..6fdc7006f9 100644 --- a/internal/endtoend/testdata/cte_filter/mysql/query.sql +++ b/internal/endtoend/testdata/cte_filter/mysql/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (ready bool not null); - -- name: CTEFilter :many WITH filter_count AS ( SELECT count(*) FROM bar WHERE ready = ? diff --git a/internal/endtoend/testdata/cte_filter/mysql/schema.sql b/internal/endtoend/testdata/cte_filter/mysql/schema.sql new file mode 100644 index 0000000000..1a17eee167 --- /dev/null +++ b/internal/endtoend/testdata/cte_filter/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (ready bool not null); + diff --git a/internal/endtoend/testdata/cte_filter/mysql/sqlc.json b/internal/endtoend/testdata/cte_filter/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/cte_filter/mysql/sqlc.json +++ b/internal/endtoend/testdata/cte_filter/mysql/sqlc.json @@ -5,7 +5,7 @@ "engine": "mysql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/cte_filter/pgx/v4/go/db.go b/internal/endtoend/testdata/cte_filter/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/cte_filter/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/cte_filter/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cte_filter/pgx/v4/go/models.go b/internal/endtoend/testdata/cte_filter/pgx/v4/go/models.go index 118ea0385c..4dc79596a7 100644 --- a/internal/endtoend/testdata/cte_filter/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/cte_filter/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { Ready bool } diff --git a/internal/endtoend/testdata/cte_filter/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/cte_filter/pgx/v4/go/query.sql.go index 8e1f15cb64..e4c0e1929f 100644 --- a/internal/endtoend/testdata/cte_filter/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/cte_filter/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_filter/pgx/v4/query.sql b/internal/endtoend/testdata/cte_filter/pgx/v4/query.sql index b2ad9c3c0b..3965e432d7 100644 --- a/internal/endtoend/testdata/cte_filter/pgx/v4/query.sql +++ b/internal/endtoend/testdata/cte_filter/pgx/v4/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (ready bool not null); - -- name: CTEFilter :many WITH filter_count AS ( SELECT count(*) FROM bar WHERE ready = $1 diff --git a/internal/endtoend/testdata/cte_filter/pgx/v4/schema.sql b/internal/endtoend/testdata/cte_filter/pgx/v4/schema.sql new file mode 100644 index 0000000000..1a17eee167 --- /dev/null +++ b/internal/endtoend/testdata/cte_filter/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (ready bool not null); + diff --git a/internal/endtoend/testdata/cte_filter/pgx/v4/sqlc.json b/internal/endtoend/testdata/cte_filter/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/cte_filter/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/cte_filter/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/cte_filter/pgx/v5/go/db.go b/internal/endtoend/testdata/cte_filter/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/cte_filter/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/cte_filter/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cte_filter/pgx/v5/go/models.go b/internal/endtoend/testdata/cte_filter/pgx/v5/go/models.go index 118ea0385c..4dc79596a7 100644 --- a/internal/endtoend/testdata/cte_filter/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/cte_filter/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { Ready bool } diff --git a/internal/endtoend/testdata/cte_filter/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/cte_filter/pgx/v5/go/query.sql.go index 8e1f15cb64..e4c0e1929f 100644 --- a/internal/endtoend/testdata/cte_filter/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/cte_filter/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_filter/pgx/v5/query.sql b/internal/endtoend/testdata/cte_filter/pgx/v5/query.sql index b2ad9c3c0b..3965e432d7 100644 --- a/internal/endtoend/testdata/cte_filter/pgx/v5/query.sql +++ b/internal/endtoend/testdata/cte_filter/pgx/v5/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (ready bool not null); - -- name: CTEFilter :many WITH filter_count AS ( SELECT count(*) FROM bar WHERE ready = $1 diff --git a/internal/endtoend/testdata/cte_filter/pgx/v5/schema.sql b/internal/endtoend/testdata/cte_filter/pgx/v5/schema.sql new file mode 100644 index 0000000000..1a17eee167 --- /dev/null +++ b/internal/endtoend/testdata/cte_filter/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (ready bool not null); + diff --git a/internal/endtoend/testdata/cte_filter/pgx/v5/sqlc.json b/internal/endtoend/testdata/cte_filter/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/cte_filter/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/cte_filter/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/cte_filter/stdlib/go/db.go b/internal/endtoend/testdata/cte_filter/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/cte_filter/stdlib/go/db.go +++ b/internal/endtoend/testdata/cte_filter/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cte_filter/stdlib/go/models.go b/internal/endtoend/testdata/cte_filter/stdlib/go/models.go index 118ea0385c..4dc79596a7 100644 --- a/internal/endtoend/testdata/cte_filter/stdlib/go/models.go +++ b/internal/endtoend/testdata/cte_filter/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { Ready bool } diff --git a/internal/endtoend/testdata/cte_filter/stdlib/go/query.sql.go b/internal/endtoend/testdata/cte_filter/stdlib/go/query.sql.go index 89ed958d37..9901a70cda 100644 --- a/internal/endtoend/testdata/cte_filter/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/cte_filter/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_filter/stdlib/query.sql b/internal/endtoend/testdata/cte_filter/stdlib/query.sql index b2ad9c3c0b..3965e432d7 100644 --- a/internal/endtoend/testdata/cte_filter/stdlib/query.sql +++ b/internal/endtoend/testdata/cte_filter/stdlib/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (ready bool not null); - -- name: CTEFilter :many WITH filter_count AS ( SELECT count(*) FROM bar WHERE ready = $1 diff --git a/internal/endtoend/testdata/cte_filter/stdlib/schema.sql b/internal/endtoend/testdata/cte_filter/stdlib/schema.sql new file mode 100644 index 0000000000..1a17eee167 --- /dev/null +++ b/internal/endtoend/testdata/cte_filter/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (ready bool not null); + diff --git a/internal/endtoend/testdata/cte_filter/stdlib/sqlc.json b/internal/endtoend/testdata/cte_filter/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/cte_filter/stdlib/sqlc.json +++ b/internal/endtoend/testdata/cte_filter/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/cte_in_delete/mysql/go/db.go b/internal/endtoend/testdata/cte_in_delete/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/cte_in_delete/mysql/go/db.go +++ b/internal/endtoend/testdata/cte_in_delete/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cte_in_delete/mysql/go/models.go b/internal/endtoend/testdata/cte_in_delete/mysql/go/models.go index d5b46701f3..6561330c86 100644 --- a/internal/endtoend/testdata/cte_in_delete/mysql/go/models.go +++ b/internal/endtoend/testdata/cte_in_delete/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 Ready bool diff --git a/internal/endtoend/testdata/cte_in_delete/mysql/go/query.sql.go b/internal/endtoend/testdata/cte_in_delete/mysql/go/query.sql.go index 64b0d46cae..2c4020efb7 100644 --- a/internal/endtoend/testdata/cte_in_delete/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/cte_in_delete/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_in_delete/mysql/query.sql b/internal/endtoend/testdata/cte_in_delete/mysql/query.sql index 4cbed16e64..fd3db485a5 100644 --- a/internal/endtoend/testdata/cte_in_delete/mysql/query.sql +++ b/internal/endtoend/testdata/cte_in_delete/mysql/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id integer NOT NULL AUTO_INCREMENT PRIMARY KEY, ready bool not null); - -- name: DeleteReadyWithCTE :exec WITH ready_ids AS ( SELECT id FROM bar WHERE ready diff --git a/internal/endtoend/testdata/cte_in_delete/mysql/schema.sql b/internal/endtoend/testdata/cte_in_delete/mysql/schema.sql new file mode 100644 index 0000000000..ba1fd0f1ae --- /dev/null +++ b/internal/endtoend/testdata/cte_in_delete/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id integer NOT NULL AUTO_INCREMENT PRIMARY KEY, ready bool not null); + diff --git a/internal/endtoend/testdata/cte_in_delete/mysql/sqlc.json b/internal/endtoend/testdata/cte_in_delete/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/cte_in_delete/mysql/sqlc.json +++ b/internal/endtoend/testdata/cte_in_delete/mysql/sqlc.json @@ -5,7 +5,7 @@ "engine": "mysql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/db.go b/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/models.go b/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/models.go index d5b46701f3..6561330c86 100644 --- a/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 Ready bool diff --git a/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/query.sql.go index 7f81cc86ce..9a208d5a93 100644 --- a/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_in_delete/pgx/v4/query.sql b/internal/endtoend/testdata/cte_in_delete/pgx/v4/query.sql index 2696c27bc0..6a7a16dbfb 100644 --- a/internal/endtoend/testdata/cte_in_delete/pgx/v4/query.sql +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v4/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id serial primary key not null, ready bool not null); - -- name: DeleteReadyWithCTE :many WITH ready_ids AS ( SELECT id FROM bar WHERE ready diff --git a/internal/endtoend/testdata/cte_in_delete/pgx/v4/schema.sql b/internal/endtoend/testdata/cte_in_delete/pgx/v4/schema.sql new file mode 100644 index 0000000000..96e5fbb6fa --- /dev/null +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial primary key not null, ready bool not null); + diff --git a/internal/endtoend/testdata/cte_in_delete/pgx/v4/sqlc.json b/internal/endtoend/testdata/cte_in_delete/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/cte_in_delete/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/db.go b/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/models.go b/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/models.go index d5b46701f3..6561330c86 100644 --- a/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 Ready bool diff --git a/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/query.sql.go index 7f81cc86ce..9a208d5a93 100644 --- a/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_in_delete/pgx/v5/query.sql b/internal/endtoend/testdata/cte_in_delete/pgx/v5/query.sql index 2696c27bc0..6a7a16dbfb 100644 --- a/internal/endtoend/testdata/cte_in_delete/pgx/v5/query.sql +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v5/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id serial primary key not null, ready bool not null); - -- name: DeleteReadyWithCTE :many WITH ready_ids AS ( SELECT id FROM bar WHERE ready diff --git a/internal/endtoend/testdata/cte_in_delete/pgx/v5/schema.sql b/internal/endtoend/testdata/cte_in_delete/pgx/v5/schema.sql new file mode 100644 index 0000000000..96e5fbb6fa --- /dev/null +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial primary key not null, ready bool not null); + diff --git a/internal/endtoend/testdata/cte_in_delete/pgx/v5/sqlc.json b/internal/endtoend/testdata/cte_in_delete/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/cte_in_delete/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/cte_in_delete/stdlib/go/db.go b/internal/endtoend/testdata/cte_in_delete/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/cte_in_delete/stdlib/go/db.go +++ b/internal/endtoend/testdata/cte_in_delete/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cte_in_delete/stdlib/go/models.go b/internal/endtoend/testdata/cte_in_delete/stdlib/go/models.go index d5b46701f3..6561330c86 100644 --- a/internal/endtoend/testdata/cte_in_delete/stdlib/go/models.go +++ b/internal/endtoend/testdata/cte_in_delete/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 Ready bool diff --git a/internal/endtoend/testdata/cte_in_delete/stdlib/go/query.sql.go b/internal/endtoend/testdata/cte_in_delete/stdlib/go/query.sql.go index e88fdf618f..80518dd3f6 100644 --- a/internal/endtoend/testdata/cte_in_delete/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/cte_in_delete/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_in_delete/stdlib/query.sql b/internal/endtoend/testdata/cte_in_delete/stdlib/query.sql index 2696c27bc0..6a7a16dbfb 100644 --- a/internal/endtoend/testdata/cte_in_delete/stdlib/query.sql +++ b/internal/endtoend/testdata/cte_in_delete/stdlib/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id serial primary key not null, ready bool not null); - -- name: DeleteReadyWithCTE :many WITH ready_ids AS ( SELECT id FROM bar WHERE ready diff --git a/internal/endtoend/testdata/cte_in_delete/stdlib/schema.sql b/internal/endtoend/testdata/cte_in_delete/stdlib/schema.sql new file mode 100644 index 0000000000..96e5fbb6fa --- /dev/null +++ b/internal/endtoend/testdata/cte_in_delete/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial primary key not null, ready bool not null); + diff --git a/internal/endtoend/testdata/cte_in_delete/stdlib/sqlc.json b/internal/endtoend/testdata/cte_in_delete/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/cte_in_delete/stdlib/sqlc.json +++ b/internal/endtoend/testdata/cte_in_delete/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/cte_join_self/issue.md b/internal/endtoend/testdata/cte_join_self/issue.md new file mode 100644 index 0000000000..7dcb76baed --- /dev/null +++ b/internal/endtoend/testdata/cte_join_self/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/2132 diff --git a/internal/endtoend/testdata/cte_join_self/postgresql/pgx/exec.json b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/cte_join_self/postgresql/pgx/go/db.go b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/cte_join_self/postgresql/pgx/go/models.go b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest diff --git a/internal/endtoend/testdata/cte_join_self/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..5af8af896a --- /dev/null +++ b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listItems = `-- name: ListItems :one +WITH + items1 AS (SELECT 'id'::TEXT AS id, 'name'::TEXT AS name), + items2 AS (SELECT 'id'::TEXT AS id, 'name'::TEXT AS name) +SELECT + i1.id AS id1, + i2.id AS id2 +FROM + items1 i1 + JOIN items1 i2 ON 1 = 1 +` + +type ListItemsRow struct { + Id1 string + Id2 string +} + +func (q *Queries) ListItems(ctx context.Context) (ListItemsRow, error) { + row := q.db.QueryRow(ctx, listItems) + var i ListItemsRow + err := row.Scan(&i.Id1, &i.Id2) + return i, err +} diff --git a/internal/endtoend/testdata/cte_join_self/postgresql/pgx/query.sql b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/query.sql new file mode 100644 index 0000000000..972d8bf0d3 --- /dev/null +++ b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/query.sql @@ -0,0 +1,10 @@ +-- name: ListItems :one +WITH + items1 AS (SELECT 'id'::TEXT AS id, 'name'::TEXT AS name), + items2 AS (SELECT 'id'::TEXT AS id, 'name'::TEXT AS name) +SELECT + i1.id AS id1, + i2.id AS id2 +FROM + items1 i1 + JOIN items1 i2 ON 1 = 1; diff --git a/internal/endtoend/testdata/cte_join_self/postgresql/pgx/schema.sql b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..af3b9497d9 --- /dev/null +++ b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/schema.sql @@ -0,0 +1 @@ +-- TODO \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_join_self/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/cte_left_join/issue.md b/internal/endtoend/testdata/cte_left_join/issue.md new file mode 100644 index 0000000000..6027f3c6a8 --- /dev/null +++ b/internal/endtoend/testdata/cte_left_join/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1236 \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_left_join/postgresql/pgx/exec.json b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/db.go b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/models.go b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..c419896180 --- /dev/null +++ b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/models.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Author struct { + ID int64 + Name string + Bio pgtype.Text +} + +type Fake struct { + ID int64 + Name string + Bio pgtype.Text +} diff --git a/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..564b33b190 --- /dev/null +++ b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const badQuery = `-- name: BadQuery :exec +WITH + q + AS ( + SELECT + authors.name, authors.bio + FROM + authors + LEFT JOIN fake ON authors.name = fake.name + ) +SELECT + name, bio +FROM + q AS c1 +WHERE c1.name = $1 +` + +func (q *Queries) BadQuery(ctx context.Context, dollar_1 pgtype.Text) error { + _, err := q.db.Exec(ctx, badQuery, dollar_1) + return err +} diff --git a/internal/endtoend/testdata/cte_left_join/postgresql/pgx/query.sql b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/query.sql new file mode 100644 index 0000000000..d201807360 --- /dev/null +++ b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/query.sql @@ -0,0 +1,15 @@ +-- name: BadQuery :exec +WITH + q + AS ( + SELECT + authors.name, authors.bio + FROM + authors + LEFT JOIN fake ON authors.name = fake.name + ) +SELECT + * +FROM + q AS c1 +WHERE c1.name = $1; \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_left_join/postgresql/pgx/schema.sql b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..3d2f5be610 --- /dev/null +++ b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/schema.sql @@ -0,0 +1,11 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + +CREATE TABLE fake ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_left_join/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..01489e0ffc --- /dev/null +++ b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_multiple_alias/issue.md b/internal/endtoend/testdata/cte_multiple_alias/issue.md new file mode 100644 index 0000000000..5e4ec565bb --- /dev/null +++ b/internal/endtoend/testdata/cte_multiple_alias/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1237 \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/go/db.go b/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/go/models.go b/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..c419896180 --- /dev/null +++ b/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/go/models.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Author struct { + ID int64 + Name string + Bio pgtype.Text +} + +type Fake struct { + ID int64 + Name string + Bio pgtype.Text +} diff --git a/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..58da3af00e --- /dev/null +++ b/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/go/query.sql.go @@ -0,0 +1,48 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const badQuery = `-- name: BadQuery :one +WITH + q + AS ( + SELECT + authors.name, authors.bio + FROM + authors + LEFT JOIN fake ON authors.name = fake.name + ) +SELECT + c1.name, c1.bio, c2.name, c2.bio +FROM + q AS c1, + q as c2 +` + +type BadQueryRow struct { + Name string + Bio pgtype.Text + Name_2 string + Bio_2 pgtype.Text +} + +func (q *Queries) BadQuery(ctx context.Context) (BadQueryRow, error) { + row := q.db.QueryRow(ctx, badQuery) + var i BadQueryRow + err := row.Scan( + &i.Name, + &i.Bio, + &i.Name_2, + &i.Bio_2, + ) + return i, err +} diff --git a/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/query.sql b/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/query.sql new file mode 100644 index 0000000000..75d770582f --- /dev/null +++ b/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/query.sql @@ -0,0 +1,15 @@ +-- name: BadQuery :one +WITH + q + AS ( + SELECT + authors.name, authors.bio + FROM + authors + LEFT JOIN fake ON authors.name = fake.name + ) +SELECT + * +FROM + q AS c1, + q as c2; \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/schema.sql b/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..3d2f5be610 --- /dev/null +++ b/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/schema.sql @@ -0,0 +1,11 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + +CREATE TABLE fake ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..01489e0ffc --- /dev/null +++ b/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_nested_with/issue.md b/internal/endtoend/testdata/cte_nested_with/issue.md new file mode 100644 index 0000000000..40300c9c0a --- /dev/null +++ b/internal/endtoend/testdata/cte_nested_with/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/2226 diff --git a/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/exec.json b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/go/db.go b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/go/models.go b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..e4cf9d17ae --- /dev/null +++ b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Author struct { + ID int64 + Name string + Bio pgtype.Text +} diff --git a/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..638f195915 --- /dev/null +++ b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/go/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const getAuthor = `-- name: GetAuthor :one +WITH person AS( + WITH summary AS( + WITH mb AS( + select + id, name, bio + from authors + ) + SELECT + bio + FROM mb + ) + SELECT + count(*) as total + FROM summary +) +select total from person +` + +func (q *Queries) GetAuthor(ctx context.Context) (pgtype.Int8, error) { + row := q.db.QueryRow(ctx, getAuthor) + var total pgtype.Int8 + err := row.Scan(&total) + return total, err +} diff --git a/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/query.sql b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/query.sql new file mode 100644 index 0000000000..947cdc2496 --- /dev/null +++ b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/query.sql @@ -0,0 +1,17 @@ +-- name: GetAuthor :one +WITH person AS( + WITH summary AS( + WITH mb AS( + select + id, name, bio + from authors + ) + SELECT + bio + FROM mb + ) + SELECT + count(*) as total + FROM summary +) +select total from person; diff --git a/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/schema.sql b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..69b607d902 --- /dev/null +++ b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/cte_recursive/mysql/go/db.go b/internal/endtoend/testdata/cte_recursive/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/cte_recursive/mysql/go/db.go +++ b/internal/endtoend/testdata/cte_recursive/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cte_recursive/mysql/go/models.go b/internal/endtoend/testdata/cte_recursive/mysql/go/models.go index 8565bbc555..66712f9d55 100644 --- a/internal/endtoend/testdata/cte_recursive/mysql/go/models.go +++ b/internal/endtoend/testdata/cte_recursive/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cte_recursive/mysql/go/query.sql.go b/internal/endtoend/testdata/cte_recursive/mysql/go/query.sql.go index 34625ec456..ffbdb1c99e 100644 --- a/internal/endtoend/testdata/cte_recursive/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/cte_recursive/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_recursive/mysql/query.sql b/internal/endtoend/testdata/cte_recursive/mysql/query.sql index fbbf214b03..a2fa30663c 100644 --- a/internal/endtoend/testdata/cte_recursive/mysql/query.sql +++ b/internal/endtoend/testdata/cte_recursive/mysql/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id INT NOT NULL, parent_id INT); - -- name: CTERecursive :many WITH RECURSIVE cte AS ( SELECT b.* FROM bar AS b diff --git a/internal/endtoend/testdata/cte_recursive/mysql/schema.sql b/internal/endtoend/testdata/cte_recursive/mysql/schema.sql new file mode 100644 index 0000000000..ccb09e1ccd --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id INT NOT NULL, parent_id INT); + diff --git a/internal/endtoend/testdata/cte_recursive/mysql/sqlc.json b/internal/endtoend/testdata/cte_recursive/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/cte_recursive/mysql/sqlc.json +++ b/internal/endtoend/testdata/cte_recursive/mysql/sqlc.json @@ -5,7 +5,7 @@ "engine": "mysql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/cte_recursive/pgx/v4/go/db.go b/internal/endtoend/testdata/cte_recursive/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/cte_recursive/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/cte_recursive/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cte_recursive/pgx/v4/go/models.go b/internal/endtoend/testdata/cte_recursive/pgx/v4/go/models.go index 8565bbc555..66712f9d55 100644 --- a/internal/endtoend/testdata/cte_recursive/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/cte_recursive/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cte_recursive/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/cte_recursive/pgx/v4/go/query.sql.go index e96cbd6adc..39bff8ef3c 100644 --- a/internal/endtoend/testdata/cte_recursive/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/cte_recursive/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_recursive/pgx/v4/query.sql b/internal/endtoend/testdata/cte_recursive/pgx/v4/query.sql index 2b1acde317..c18d216d0e 100644 --- a/internal/endtoend/testdata/cte_recursive/pgx/v4/query.sql +++ b/internal/endtoend/testdata/cte_recursive/pgx/v4/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id INT NOT NULL, parent_id INT); - -- name: CTERecursive :many WITH RECURSIVE cte AS ( SELECT b.* FROM bar AS b diff --git a/internal/endtoend/testdata/cte_recursive/pgx/v4/schema.sql b/internal/endtoend/testdata/cte_recursive/pgx/v4/schema.sql new file mode 100644 index 0000000000..ccb09e1ccd --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id INT NOT NULL, parent_id INT); + diff --git a/internal/endtoend/testdata/cte_recursive/pgx/v4/sqlc.json b/internal/endtoend/testdata/cte_recursive/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/cte_recursive/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/cte_recursive/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/cte_recursive/pgx/v5/go/db.go b/internal/endtoend/testdata/cte_recursive/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/cte_recursive/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/cte_recursive/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cte_recursive/pgx/v5/go/models.go b/internal/endtoend/testdata/cte_recursive/pgx/v5/go/models.go index 43df80226a..e9542cf1ee 100644 --- a/internal/endtoend/testdata/cte_recursive/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/cte_recursive/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cte_recursive/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/cte_recursive/pgx/v5/go/query.sql.go index 6edb407444..84d8605338 100644 --- a/internal/endtoend/testdata/cte_recursive/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/cte_recursive/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_recursive/pgx/v5/query.sql b/internal/endtoend/testdata/cte_recursive/pgx/v5/query.sql index 2b1acde317..c18d216d0e 100644 --- a/internal/endtoend/testdata/cte_recursive/pgx/v5/query.sql +++ b/internal/endtoend/testdata/cte_recursive/pgx/v5/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id INT NOT NULL, parent_id INT); - -- name: CTERecursive :many WITH RECURSIVE cte AS ( SELECT b.* FROM bar AS b diff --git a/internal/endtoend/testdata/cte_recursive/pgx/v5/schema.sql b/internal/endtoend/testdata/cte_recursive/pgx/v5/schema.sql new file mode 100644 index 0000000000..ccb09e1ccd --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id INT NOT NULL, parent_id INT); + diff --git a/internal/endtoend/testdata/cte_recursive/pgx/v5/sqlc.json b/internal/endtoend/testdata/cte_recursive/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/cte_recursive/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/cte_recursive/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/cte_recursive/stdlib/go/db.go b/internal/endtoend/testdata/cte_recursive/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/cte_recursive/stdlib/go/db.go +++ b/internal/endtoend/testdata/cte_recursive/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cte_recursive/stdlib/go/models.go b/internal/endtoend/testdata/cte_recursive/stdlib/go/models.go index 8565bbc555..66712f9d55 100644 --- a/internal/endtoend/testdata/cte_recursive/stdlib/go/models.go +++ b/internal/endtoend/testdata/cte_recursive/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/cte_recursive/stdlib/go/query.sql.go b/internal/endtoend/testdata/cte_recursive/stdlib/go/query.sql.go index 18224d94bd..696ebde8f8 100644 --- a/internal/endtoend/testdata/cte_recursive/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/cte_recursive/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_recursive/stdlib/query.sql b/internal/endtoend/testdata/cte_recursive/stdlib/query.sql index 2b1acde317..c18d216d0e 100644 --- a/internal/endtoend/testdata/cte_recursive/stdlib/query.sql +++ b/internal/endtoend/testdata/cte_recursive/stdlib/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id INT NOT NULL, parent_id INT); - -- name: CTERecursive :many WITH RECURSIVE cte AS ( SELECT b.* FROM bar AS b diff --git a/internal/endtoend/testdata/cte_recursive/stdlib/schema.sql b/internal/endtoend/testdata/cte_recursive/stdlib/schema.sql new file mode 100644 index 0000000000..ccb09e1ccd --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id INT NOT NULL, parent_id INT); + diff --git a/internal/endtoend/testdata/cte_recursive/stdlib/sqlc.json b/internal/endtoend/testdata/cte_recursive/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/cte_recursive/stdlib/sqlc.json +++ b/internal/endtoend/testdata/cte_recursive/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/cte_recursive_employees/issue.md b/internal/endtoend/testdata/cte_recursive_employees/issue.md new file mode 100644 index 0000000000..11f5771fd8 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_employees/issue.md @@ -0,0 +1,2 @@ +https://github.com/sqlc-dev/sqlc/issues/1219 +https://github.com/sqlc-dev/sqlc/issues/1912 diff --git a/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/exec.json b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/go/db.go b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/go/models.go b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..eae1c96e75 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Employee struct { + ID int64 + Name string + Manager pgtype.Text +} diff --git a/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..50ffa78909 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/go/query.sql.go @@ -0,0 +1,56 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const getSubordinates = `-- name: GetSubordinates :many +WITH RECURSIVE subordinates(name, manager) AS ( + SELECT + NULL, $1::TEXT + UNION + SELECT + s.manager, e.name + FROM + subordinates AS s + LEFT OUTER JOIN + employees AS e + ON + e.manager = s.manager + WHERE + s.manager IS NOT NULL +) +SELECT + s.name +FROM + subordinates AS s +WHERE + s.name != $1 +` + +func (q *Queries) GetSubordinates(ctx context.Context, name pgtype.Text) ([]pgtype.Text, error) { + rows, err := q.db.Query(ctx, getSubordinates, name) + if err != nil { + return nil, err + } + defer rows.Close() + var items []pgtype.Text + for rows.Next() { + var name pgtype.Text + if err := rows.Scan(&name); err != nil { + return nil, err + } + items = append(items, name) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/query.sql b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/query.sql new file mode 100644 index 0000000000..00d490a4b9 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/query.sql @@ -0,0 +1,22 @@ +-- name: GetSubordinates :many +WITH RECURSIVE subordinates(name, manager) AS ( + SELECT + NULL, sqlc.arg(name)::TEXT + UNION + SELECT + s.manager, e.name + FROM + subordinates AS s + LEFT OUTER JOIN + employees AS e + ON + e.manager = s.manager + WHERE + s.manager IS NOT NULL +) +SELECT + s.name +FROM + subordinates AS s +WHERE + s.name != sqlc.arg(name); \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/schema.sql b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..b95effb369 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE employees ( + id BIGSERIAL PRIMARY KEY, + name text UNIQUE NOT NULL, + manager text REFERENCES employees(name) +); \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..01489e0ffc --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_recursive_star/issue.md b/internal/endtoend/testdata/cte_recursive_star/issue.md new file mode 100644 index 0000000000..2bc033582e --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_star/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1219 \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/exec.json b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/go/db.go b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/go/models.go b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..cfa14619bf --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/go/models.go @@ -0,0 +1,27 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Dict struct { + ID string + AppID string + Code pgtype.Text + ParentCode string + Label string + Value pgtype.Text + Weight int32 + IsDefault bool + IsVirtual bool + Status int16 + CreateAt pgtype.Timestamptz + CreateBy string + UpdateAt pgtype.Timestamptz + UpdateBy pgtype.Text + IsDelete bool +} diff --git a/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..871349d074 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/go/query.sql.go @@ -0,0 +1,59 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const getDictTree = `-- name: GetDictTree :many +with recursive dictTree(id, code, parent_code, label, value, path, depth) AS ( + select id, code, parent_code, label, value, ARRAY[COALESCE((select id from dict where code=''),'virtual_root'), id], 1 as depth from dict where app_id = '1' and parent_code = '' and is_delete=false + union + select d.id, d.code, d.parent_code, d.label, d.value, t.path || ARRAY[d.id], t.depth+1 as depth from dict d join dictTree t on d.parent_code = t.code and not d.id = ANY(t.path) and d.is_delete=false +) +select id, code, parent_code, label, value, path, depth from dictTree d order by depth, parent_code +` + +type GetDictTreeRow struct { + ID string + Code pgtype.Text + ParentCode string + Label string + Value pgtype.Text + Path []string + Depth int32 +} + +func (q *Queries) GetDictTree(ctx context.Context) ([]GetDictTreeRow, error) { + rows, err := q.db.Query(ctx, getDictTree) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetDictTreeRow + for rows.Next() { + var i GetDictTreeRow + if err := rows.Scan( + &i.ID, + &i.Code, + &i.ParentCode, + &i.Label, + &i.Value, + &i.Path, + &i.Depth, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/query.sql b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/query.sql new file mode 100644 index 0000000000..a48253d0ab --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/query.sql @@ -0,0 +1,7 @@ +-- name: GetDictTree :many +with recursive dictTree(id, code, parent_code, label, value, path, depth) AS ( + select id, code, parent_code, label, value, ARRAY[COALESCE((select id from dict where code=''),'virtual_root'), id], 1 as depth from dict where app_id = '1' and parent_code = '' and is_delete=false + union + select d.id, d.code, d.parent_code, d.label, d.value, t.path || ARRAY[d.id], t.depth+1 as depth from dict d join dictTree t on d.parent_code = t.code and not d.id = ANY(t.path) and d.is_delete=false +) +select * from dictTree d order by depth, parent_code; \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/schema.sql b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..c4257ab8bb --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/schema.sql @@ -0,0 +1,17 @@ +create table dict( + id VARCHAR(36) PRIMARY KEY DEFAULT gen_random_uuid(), + app_id VARCHAR(36) NOT NULL, + code VARCHAR(64), + parent_code VARCHAR(64) NOT NULL, + label TEXT NOT NULL DEFAULT '', + value TEXT NULL, + weight INT NOT NULL DEFAULT 0, + is_default BOOLEAN NOT NULL DEFAULT false, + is_virtual BOOLEAN NOT NULL DEFAULT false, + status SMALLINT NOT NULL DEFAULT 1, + create_at TIMESTAMPTZ(0) NOT NULL DEFAULT now(), + create_by VARCHAR(36) NOT NULL DEFAULT '', + update_at TIMESTAMPTZ(0), + update_by VARCHAR(36), + is_delete BOOLEAN NOT NULL DEFAULT false +); diff --git a/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..01489e0ffc --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_recursive_subquery/issue.md b/internal/endtoend/testdata/cte_recursive_subquery/issue.md new file mode 100644 index 0000000000..98c00da500 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_subquery/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/2644 diff --git a/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/exec.json b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/go/db.go b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/go/models.go b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..53c5c498a6 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Version struct { + ID int64 + Name pgtype.Text + PreviousVersionID int64 +} diff --git a/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..e6b4cbafa5 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/go/query.sql.go @@ -0,0 +1,60 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getLatestVersion = `-- name: GetLatestVersion :one +WITH RECURSIVE search_tree(id, chain_id, chain_counter) AS ( + SELECT base.id, base.id AS chain_id, 0 as chain_counter + FROM versions AS base + WHERE base.previous_version_id IS NULL + UNION ALL + SELECT v.id, search_tree.chain_id, search_tree.chain_counter + 1 + FROM versions AS v + INNER JOIN search_tree ON search_tree.id = v.previous_version_id +) +SELECT DISTINCT ON (search_tree.chain_id) + search_tree.id +FROM search_tree +ORDER BY search_tree.chain_id, chain_counter DESC +` + +func (q *Queries) GetLatestVersion(ctx context.Context) (int64, error) { + row := q.db.QueryRow(ctx, getLatestVersion) + var id int64 + err := row.Scan(&id) + return id, err +} + +const getLatestVersionWithSubquery = `-- name: GetLatestVersionWithSubquery :one +SELECT id +FROM versions +WHERE versions.id IN ( + WITH RECURSIVE search_tree(id, chain_id, chain_counter) AS ( + SELECT base.id, base.id AS chain_id, 0 as chain_counter + FROM versions AS base + WHERE versions.previous_version_id IS NULL + UNION ALL + SELECT v.id, search_tree.chain_id, search_tree.chain_counter + 1 + FROM versions AS v + INNER JOIN search_tree ON search_tree.id = v.previous_version_id + ) + SELECT DISTINCT ON (search_tree.chain_id) + search_tree.id + FROM search_tree + ORDER BY search_tree.chain_id, chain_counter DESC +) +` + +func (q *Queries) GetLatestVersionWithSubquery(ctx context.Context) (int64, error) { + row := q.db.QueryRow(ctx, getLatestVersionWithSubquery) + var id int64 + err := row.Scan(&id) + return id, err +} diff --git a/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/query.sql b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/query.sql new file mode 100644 index 0000000000..021d493d84 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/query.sql @@ -0,0 +1,33 @@ +-- name: GetLatestVersion :one +WITH RECURSIVE search_tree(id, chain_id, chain_counter) AS ( + SELECT base.id, base.id AS chain_id, 0 as chain_counter + FROM versions AS base + WHERE base.previous_version_id IS NULL + UNION ALL + SELECT v.id, search_tree.chain_id, search_tree.chain_counter + 1 + FROM versions AS v + INNER JOIN search_tree ON search_tree.id = v.previous_version_id +) +SELECT DISTINCT ON (search_tree.chain_id) + search_tree.id +FROM search_tree +ORDER BY search_tree.chain_id, chain_counter DESC; + +-- name: GetLatestVersionWithSubquery :one +SELECT id +FROM versions +WHERE versions.id IN ( + WITH RECURSIVE search_tree(id, chain_id, chain_counter) AS ( + SELECT base.id, base.id AS chain_id, 0 as chain_counter + FROM versions AS base + WHERE versions.previous_version_id IS NULL + UNION ALL + SELECT v.id, search_tree.chain_id, search_tree.chain_counter + 1 + FROM versions AS v + INNER JOIN search_tree ON search_tree.id = v.previous_version_id + ) + SELECT DISTINCT ON (search_tree.chain_id) + search_tree.id + FROM search_tree + ORDER BY search_tree.chain_id, chain_counter DESC +); diff --git a/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/schema.sql b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..766adb01a8 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE versions ( + id BIGSERIAL PRIMARY KEY, + name TEXT, + previous_version_id bigint NOT NULL +); diff --git a/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..2f12715923 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/sqlc.yaml @@ -0,0 +1,14 @@ +version: "2" +cloud: + project: "01HAQMMECEYQYKFJN8MP16QC41" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" + database: + managed: true diff --git a/internal/endtoend/testdata/cte_recursive_union/issue.md b/internal/endtoend/testdata/cte_recursive_union/issue.md new file mode 100644 index 0000000000..f87f5c14cb --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_union/issue.md @@ -0,0 +1 @@ +# TODO \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/exec.json b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/go/db.go b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/go/models.go b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..09908991ae --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/go/models.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type CaseIntent struct { + ID int32 + CaseIntentString string + Description string + Author string +} + +type CaseIntentParentJoin struct { + CaseIntentID int64 + CaseIntentParentID int64 +} + +type CaseIntentVersion struct { + VersionID int32 + Reviewer string + CreatedAt pgtype.Timestamptz +} + +type CaseIntentVersionJoin struct { + CaseIntentID int64 + CaseIntentVersionID int32 +} diff --git a/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..690a024aed --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/go/query.sql.go @@ -0,0 +1,57 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const listCaseIntentHistory = `-- name: ListCaseIntentHistory :many +WITH RECURSIVE descendants AS + ( SELECT case_intent_parent_id AS parent, case_intent_id AS child, 1 AS lvl + FROM case_intent_parent_join + UNION ALL + SELECT d.parent as parent, p.case_intent_id as child, d.lvl + 1 as lvl + FROM descendants d + JOIN case_intent_parent_join p + ON d.child = p.case_intent_parent_id + ) +select distinct child, 'child' group_ +from descendants +where parent = $1 +union +select distinct parent, 'parent' group_ +from descendants +where child = $1 +ORDER BY child +` + +type ListCaseIntentHistoryRow struct { + Child int64 + Group string +} + +func (q *Queries) ListCaseIntentHistory(ctx context.Context, caseIntentID pgtype.Int8) ([]ListCaseIntentHistoryRow, error) { + rows, err := q.db.Query(ctx, listCaseIntentHistory, caseIntentID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListCaseIntentHistoryRow + for rows.Next() { + var i ListCaseIntentHistoryRow + if err := rows.Scan(&i.Child, &i.Group); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/query.sql b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/query.sql new file mode 100644 index 0000000000..dce099df39 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/query.sql @@ -0,0 +1,18 @@ +-- name: ListCaseIntentHistory :many +WITH RECURSIVE descendants AS + ( SELECT case_intent_parent_id AS parent, case_intent_id AS child, 1 AS lvl + FROM case_intent_parent_join + UNION ALL + SELECT d.parent as parent, p.case_intent_id as child, d.lvl + 1 as lvl + FROM descendants d + JOIN case_intent_parent_join p + ON d.child = p.case_intent_parent_id + ) +select distinct child, 'child' group_ +from descendants +where parent = @case_intent_id +union +select distinct parent, 'parent' group_ +from descendants +where child = @case_intent_id +ORDER BY child; diff --git a/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/schema.sql b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..a2c3a682e0 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/schema.sql @@ -0,0 +1,27 @@ +CREATE TABLE case_intent_version +( + version_id SERIAL NOT NULL PRIMARY KEY, + reviewer TEXT NOT NULL, + created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW() +); +CREATE TABLE case_intent +( + id SERIAL NOT NULL PRIMARY KEY, + case_intent_string TEXT NOT NULL, + description TEXT NOT NULL, + author TEXT NOT NULL +); +CREATE TABLE case_intent_parent_join +( + case_intent_id BIGINT NOT NULL, + case_intent_parent_id BIGINT NOT NULL, + constraint fk_case_intent_id foreign key (case_intent_id) references case_intent(id), + constraint fk_case_intent_parent_id foreign key (case_intent_parent_id) references case_intent(id) +); +CREATE TABLE case_intent_version_join +( + case_intent_id BIGINT NOT NULL, + case_intent_version_id INT NOT NULL, + constraint fk_case_intent_id foreign key (case_intent_id) references case_intent(id), + constraint fk_case_intent_version_id foreign key (case_intent_version_id) references case_intent_version(version_id) +); diff --git a/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/cte_select_one/issue.md b/internal/endtoend/testdata/cte_select_one/issue.md new file mode 100644 index 0000000000..f87f5c14cb --- /dev/null +++ b/internal/endtoend/testdata/cte_select_one/issue.md @@ -0,0 +1 @@ +# TODO \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_select_one/postgresql/pgx/go/db.go b/internal/endtoend/testdata/cte_select_one/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/cte_select_one/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/cte_select_one/postgresql/pgx/go/models.go b/internal/endtoend/testdata/cte_select_one/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/cte_select_one/postgresql/pgx/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest diff --git a/internal/endtoend/testdata/cte_select_one/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_select_one/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..867481daf8 --- /dev/null +++ b/internal/endtoend/testdata/cte_select_one/postgresql/pgx/go/query.sql.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const testRecursive = `-- name: TestRecursive :one +WITH t1 AS ( + select 1 as foo +) +SELECT foo FROM t1 +` + +func (q *Queries) TestRecursive(ctx context.Context) (int32, error) { + row := q.db.QueryRow(ctx, testRecursive) + var foo int32 + err := row.Scan(&foo) + return foo, err +} diff --git a/internal/endtoend/testdata/cte_select_one/postgresql/pgx/query.sql b/internal/endtoend/testdata/cte_select_one/postgresql/pgx/query.sql new file mode 100644 index 0000000000..9f4fdf08de --- /dev/null +++ b/internal/endtoend/testdata/cte_select_one/postgresql/pgx/query.sql @@ -0,0 +1,5 @@ +-- name: TestRecursive :one +WITH t1 AS ( + select 1 as foo +) +SELECT * FROM t1; \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_select_one/postgresql/pgx/schema.sql b/internal/endtoend/testdata/cte_select_one/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..af3b9497d9 --- /dev/null +++ b/internal/endtoend/testdata/cte_select_one/postgresql/pgx/schema.sql @@ -0,0 +1 @@ +-- TODO \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_select_one/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/cte_select_one/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..01489e0ffc --- /dev/null +++ b/internal/endtoend/testdata/cte_select_one/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_update/issue.md b/internal/endtoend/testdata/cte_update/issue.md new file mode 100644 index 0000000000..5f1a5921ed --- /dev/null +++ b/internal/endtoend/testdata/cte_update/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1515 diff --git a/internal/endtoend/testdata/cte_update/postgresql/pgx/exec.json b/internal/endtoend/testdata/cte_update/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/cte_update/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/cte_update/postgresql/pgx/go/db.go b/internal/endtoend/testdata/cte_update/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/cte_update/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/cte_update/postgresql/pgx/go/models.go b/internal/endtoend/testdata/cte_update/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..f5d93f6f97 --- /dev/null +++ b/internal/endtoend/testdata/cte_update/postgresql/pgx/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Attribute struct { + ID int64 + Name string +} + +type AttributeValue struct { + ID int64 + Val string + Attribute int64 +} diff --git a/internal/endtoend/testdata/cte_update/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_update/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..61ba601b90 --- /dev/null +++ b/internal/endtoend/testdata/cte_update/postgresql/pgx/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const updateAttribute = `-- name: UpdateAttribute :one +with updated_attribute as (UPDATE attribute_value + SET + val = CASE WHEN $1::bool THEN $2 ELSE val END + WHERE attribute_value.id = $3 + RETURNING id,attribute,val) +select updated_attribute.id, val, name +from updated_attribute + left join attribute on updated_attribute.attribute = attribute.id +` + +type UpdateAttributeParams struct { + FilterValue pgtype.Bool + Value pgtype.Text + ID pgtype.Int8 +} + +type UpdateAttributeRow struct { + ID int64 + Val string + Name pgtype.Text +} + +func (q *Queries) UpdateAttribute(ctx context.Context, arg UpdateAttributeParams) (UpdateAttributeRow, error) { + row := q.db.QueryRow(ctx, updateAttribute, arg.FilterValue, arg.Value, arg.ID) + var i UpdateAttributeRow + err := row.Scan(&i.ID, &i.Val, &i.Name) + return i, err +} diff --git a/internal/endtoend/testdata/cte_update/postgresql/pgx/query.sql b/internal/endtoend/testdata/cte_update/postgresql/pgx/query.sql new file mode 100644 index 0000000000..6ba9aa4e7a --- /dev/null +++ b/internal/endtoend/testdata/cte_update/postgresql/pgx/query.sql @@ -0,0 +1,9 @@ +-- name: UpdateAttribute :one +with updated_attribute as (UPDATE attribute_value + SET + val = CASE WHEN @filter_value::bool THEN @value ELSE val END + WHERE attribute_value.id = @id + RETURNING id,attribute,val) +select updated_attribute.id, val, name +from updated_attribute + left join attribute on updated_attribute.attribute = attribute.id; diff --git a/internal/endtoend/testdata/cte_update/postgresql/pgx/schema.sql b/internal/endtoend/testdata/cte_update/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..6273c9a7e0 --- /dev/null +++ b/internal/endtoend/testdata/cte_update/postgresql/pgx/schema.sql @@ -0,0 +1,12 @@ +create table attribute_value +( + id bigserial not null, + val text not null, + attribute bigint not null +); + +create table attribute +( + id bigserial not null, + name text not null +); diff --git a/internal/endtoend/testdata/cte_update/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/cte_update/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/cte_update/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/cte_update_multiple/issue.md b/internal/endtoend/testdata/cte_update_multiple/issue.md new file mode 100644 index 0000000000..fc662de1ea --- /dev/null +++ b/internal/endtoend/testdata/cte_update_multiple/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1916 diff --git a/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/exec.json b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/go/db.go b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/go/models.go b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..b82677933d --- /dev/null +++ b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/go/models.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Address struct { + ID int64 + AddressLine string + Region string + City string + CreatedAt pgtype.Timestamptz + UpdatedAt pgtype.Timestamptz +} + +type User struct { + ID int64 + Username string + Email string + Password string + Telephone int32 + DefaultPayment pgtype.Int8 + CreatedAt pgtype.Timestamptz + UpdatedAt pgtype.Timestamptz +} + +type UserAddress struct { + UserID int64 + AddressID int64 + DefaultAddress pgtype.Int8 + CreatedAt pgtype.Timestamptz + UpdatedAt pgtype.Timestamptz +} diff --git a/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..15890aef3f --- /dev/null +++ b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/go/query.sql.go @@ -0,0 +1,83 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const updateUserAddressWithAddress = `-- name: UpdateUserAddressWithAddress :one +WITH t1 AS ( + UPDATE "address" as a + SET + address_line = COALESCE($1,address_line), + region = COALESCE($2,region), + city= COALESCE($3,city) + WHERE id = COALESCE($4,id) + RETURNING a.id, a.address_line, a.region, a.city + ), + + t2 AS ( + UPDATE "user_address" + SET + default_address = COALESCE($5,default_address) + WHERE + user_id = COALESCE($6,user_id) + AND address_id = COALESCE($7,address_id) + RETURNING user_id, address_id, default_address + ) + +SELECT +user_id, +address_id, +default_address, +address_line, +region, +city From t1,t2 +` + +type UpdateUserAddressWithAddressParams struct { + AddressLine pgtype.Text + Region pgtype.Text + City pgtype.Text + ID pgtype.Int8 + DefaultAddress pgtype.Int8 + UserID pgtype.Int8 + AddressID pgtype.Int8 +} + +type UpdateUserAddressWithAddressRow struct { + UserID int64 + AddressID int64 + DefaultAddress pgtype.Int8 + AddressLine string + Region string + City string +} + +func (q *Queries) UpdateUserAddressWithAddress(ctx context.Context, arg UpdateUserAddressWithAddressParams) (UpdateUserAddressWithAddressRow, error) { + row := q.db.QueryRow(ctx, updateUserAddressWithAddress, + arg.AddressLine, + arg.Region, + arg.City, + arg.ID, + arg.DefaultAddress, + arg.UserID, + arg.AddressID, + ) + var i UpdateUserAddressWithAddressRow + err := row.Scan( + &i.UserID, + &i.AddressID, + &i.DefaultAddress, + &i.AddressLine, + &i.Region, + &i.City, + ) + return i, err +} diff --git a/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/query.sql b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/query.sql new file mode 100644 index 0000000000..9cb15e5b69 --- /dev/null +++ b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/query.sql @@ -0,0 +1,28 @@ +-- name: UpdateUserAddressWithAddress :one +WITH t1 AS ( + UPDATE "address" as a + SET + address_line = COALESCE(sqlc.narg(address_line),address_line), + region = COALESCE(sqlc.narg(region),region), + city= COALESCE(sqlc.narg(city),city) + WHERE id = COALESCE(sqlc.arg(id),id) + RETURNING a.id, a.address_line, a.region, a.city + ), + + t2 AS ( + UPDATE "user_address" + SET + default_address = COALESCE(sqlc.narg(default_address),default_address) + WHERE + user_id = COALESCE(sqlc.arg(user_id),user_id) + AND address_id = COALESCE(sqlc.arg(address_id),address_id) + RETURNING user_id, address_id, default_address + ) + +SELECT +user_id, +address_id, +default_address, +address_line, +region, +city From t1,t2; diff --git a/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/schema.sql b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..7ec7b1a82c --- /dev/null +++ b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/schema.sql @@ -0,0 +1,27 @@ +CREATE TABLE "user" ( + "id" bigserial PRIMARY KEY NOT NULL, + "username" varchar NOT NULL, + "email" varchar UNIQUE NOT NULL, + "password" varchar NOT NULL, + "telephone" int NOT NULL DEFAULT 0, + "default_payment" bigint, + "created_at" timestamptz NOT NULL DEFAULT (now()), + "updated_at" timestamptz NOT NULL DEFAULT '0001-01-01 00:00:00Z' +); + +CREATE TABLE "address" ( + "id" bigserial PRIMARY KEY NOT NULL, + "address_line" varchar NOT NULL, + "region" varchar NOT NULL, + "city" varchar NOT NULL, + "created_at" timestamptz NOT NULL DEFAULT (now()), + "updated_at" timestamptz NOT NULL DEFAULT '0001-01-01 00:00:00Z' +); + +CREATE TABLE "user_address" ( + "user_id" bigint NOT NULL, + "address_id" bigint UNIQUE NOT NULL, + "default_address" bigint, + "created_at" timestamptz NOT NULL DEFAULT (now()), + "updated_at" timestamptz NOT NULL DEFAULT '0001-01-01 00:00:00Z' +); diff --git a/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/cte_with_in/issue.md b/internal/endtoend/testdata/cte_with_in/issue.md new file mode 100644 index 0000000000..34fccd51ff --- /dev/null +++ b/internal/endtoend/testdata/cte_with_in/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/2153 diff --git a/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/exec.json b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/go/db.go b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/go/models.go b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/go/models.go new file mode 100644 index 0000000000..e95830d5ab --- /dev/null +++ b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/go/models.go @@ -0,0 +1,20 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type L struct { + ID int64 + ParentID pgtype.Int4 +} + +type T struct { + ID int64 + LID pgtype.Int4 + F pgtype.Text +} diff --git a/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/go/query.sql.go b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/go/query.sql.go new file mode 100644 index 0000000000..a743dd6e3b --- /dev/null +++ b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/go/query.sql.go @@ -0,0 +1,164 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const getAll = `-- name: GetAll :many +SELECT id, parent_id FROM L +` + +func (q *Queries) GetAll(ctx context.Context) ([]L, error) { + rows, err := q.db.Query(ctx, getAll) + if err != nil { + return nil, err + } + defer rows.Close() + var items []L + for rows.Next() { + var i L + if err := rows.Scan(&i.ID, &i.ParentID); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getAll1 = `-- name: GetAll1 :many +with recursive cte as ( + select id, L_ID, F from T + union all + select c.id, c.L_ID, c.F from T as c where c.L_ID = $1 +) select id, l_id, f from cte +` + +type GetAll1Row struct { + ID int64 + LID pgtype.Int4 + F pgtype.Text +} + +func (q *Queries) GetAll1(ctx context.Context, lID pgtype.Int4) ([]GetAll1Row, error) { + rows, err := q.db.Query(ctx, getAll1, lID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetAll1Row + for rows.Next() { + var i GetAll1Row + if err := rows.Scan(&i.ID, &i.LID, &i.F); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getAll2 = `-- name: GetAll2 :many +with recursive cte as ( + select id, L_ID, F from T where T.ID=2 + union all + select c.id, c.L_ID, c.F from T as c where c.L_ID = $1 +) select id, l_id, f from cte +` + +type GetAll2Row struct { + ID int64 + LID pgtype.Int4 + F pgtype.Text +} + +func (q *Queries) GetAll2(ctx context.Context, lID pgtype.Int4) ([]GetAll2Row, error) { + rows, err := q.db.Query(ctx, getAll2, lID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetAll2Row + for rows.Next() { + var i GetAll2Row + if err := rows.Scan(&i.ID, &i.LID, &i.F); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getAll3 = `-- name: GetAll3 :many +select id from T where L_ID in( + with recursive cte as ( + select id, L_ID, F from T where T.ID =2 + union all + select c.id, c.L_ID, c.F from T as c where c.L_ID = $1 + ) select l_id from cte +) +` + +func (q *Queries) GetAll3(ctx context.Context, dollar_1 pgtype.Int4) ([]int64, error) { + rows, err := q.db.Query(ctx, getAll3, dollar_1) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int64 + for rows.Next() { + var id int64 + if err := rows.Scan(&id); err != nil { + return nil, err + } + items = append(items, id) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getAll4 = `-- name: GetAll4 :many +select id from T where L_ID in( + with recursive L as ( + select id, L_ID, F from T where T.ID =2 + union all + select c.id, c.L_ID, c.F from T as c where c.L_ID = $1 + ) select l_id from L +) +` + +func (q *Queries) GetAll4(ctx context.Context, lID pgtype.Int4) ([]int64, error) { + rows, err := q.db.Query(ctx, getAll4, lID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int64 + for rows.Next() { + var id int64 + if err := rows.Scan(&id); err != nil { + return nil, err + } + items = append(items, id) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/query.sql b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/query.sql new file mode 100644 index 0000000000..4a27713beb --- /dev/null +++ b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/query.sql @@ -0,0 +1,34 @@ +-- name: GetAll :many +SELECT * FROM L; + +-- name: GetAll1 :many +with recursive cte as ( + select id, L_ID, F from T + union all + select c.id, c.L_ID, c.F from T as c where c.L_ID = $1 +) select id, l_id, f from cte; + +-- name: GetAll2 :many +with recursive cte as ( + select id, L_ID, F from T where T.ID=2 + union all + select c.id, c.L_ID, c.F from T as c where c.L_ID = $1 +) select id, l_id, f from cte; + +-- name: GetAll4 :many +select id from T where L_ID in( + with recursive L as ( + select id, L_ID, F from T where T.ID =2 + union all + select c.id, c.L_ID, c.F from T as c where c.L_ID = $1 + ) select l_id from L +); + +-- name: GetAll3 :many +select id from T where L_ID in( + with recursive cte as ( + select id, L_ID, F from T where T.ID =2 + union all + select c.id, c.L_ID, c.F from T as c where c.L_ID = $1 + ) select l_id from cte +); diff --git a/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/schema.sql b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/schema.sql new file mode 100644 index 0000000000..cf970e3331 --- /dev/null +++ b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/schema.sql @@ -0,0 +1,12 @@ +-- https://github.com/sqlc-dev/sqlc/issues/2153 + +CREATE TABLE L ( + id BIGSERIAL PRIMARY KEY, + parent_id int null +); + +CREATE TABLE T ( + id BIGSERIAL PRIMARY KEY, + L_ID int, + F varchar(256) +); diff --git a/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/sqlc.json b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/sqlc.json new file mode 100644 index 0000000000..4905a64003 --- /dev/null +++ b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql", + "sql_package": "pgx/v5" + } + ] +} + diff --git a/internal/endtoend/testdata/data_type_boolean/mysql/db/db.go b/internal/endtoend/testdata/data_type_boolean/mysql/db/db.go index 3d2b5bf3a3..cd5bbb8e08 100644 --- a/internal/endtoend/testdata/data_type_boolean/mysql/db/db.go +++ b/internal/endtoend/testdata/data_type_boolean/mysql/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/data_type_boolean/mysql/db/models.go b/internal/endtoend/testdata/data_type_boolean/mysql/db/models.go index 3b575df5dc..2b50ab0e55 100644 --- a/internal/endtoend/testdata/data_type_boolean/mysql/db/models.go +++ b/internal/endtoend/testdata/data_type_boolean/mysql/db/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/data_type_boolean/mysql/db/query.sql.go b/internal/endtoend/testdata/data_type_boolean/mysql/db/query.sql.go index 5c0c0faeae..d591b51676 100644 --- a/internal/endtoend/testdata/data_type_boolean/mysql/db/query.sql.go +++ b/internal/endtoend/testdata/data_type_boolean/mysql/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package db diff --git a/internal/endtoend/testdata/data_type_boolean/mysql/query.sql b/internal/endtoend/testdata/data_type_boolean/mysql/query.sql index 210488ceac..c0adc5c5c5 100644 --- a/internal/endtoend/testdata/data_type_boolean/mysql/query.sql +++ b/internal/endtoend/testdata/data_type_boolean/mysql/query.sql @@ -1,19 +1,5 @@ -CREATE TABLE foo -( - col_a BOOL NOT NULL, - col_b BOOLEAN NOT NULL, - col_c TINYINT(1) NOT NULL -); - -- name: ListFoo :many SELECT * FROM foo; -CREATE TABLE bar -( - col_a BOOL, - col_b BOOLEAN, - col_c TINYINT(1) -); - -- name: ListBar :many SELECT * FROM bar; diff --git a/internal/endtoend/testdata/data_type_boolean/mysql/schema.sql b/internal/endtoend/testdata/data_type_boolean/mysql/schema.sql new file mode 100644 index 0000000000..8289125b96 --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/mysql/schema.sql @@ -0,0 +1,13 @@ +CREATE TABLE foo +( + col_a BOOL NOT NULL, + col_b BOOLEAN NOT NULL, + col_c TINYINT(1) NOT NULL +); + +CREATE TABLE bar +( + col_a BOOL, + col_b BOOLEAN, + col_c TINYINT(1) +); diff --git a/internal/endtoend/testdata/data_type_boolean/mysql/sqlc.json b/internal/endtoend/testdata/data_type_boolean/mysql/sqlc.json index a279d21f99..d98ee6f1a2 100644 --- a/internal/endtoend/testdata/data_type_boolean/mysql/sqlc.json +++ b/internal/endtoend/testdata/data_type_boolean/mysql/sqlc.json @@ -4,7 +4,7 @@ { "path": "db", "engine": "mysql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/models.go index 3b05ae17d3..dfbf6aeb32 100644 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/query.sql.go index 32b258513b..9d705cd685 100644 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/query.sql index 53ad078373..c0adc5c5c5 100644 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/query.sql @@ -1,17 +1,5 @@ -CREATE TABLE foo -( - col_a BOOL NOT NULL, - col_b BOOLEAN NOT NULL -); - -- name: ListFoo :many SELECT * FROM foo; -CREATE TABLE bar -( - col_a BOOL, - col_b BOOLEAN -); - -- name: ListBar :many SELECT * FROM bar; diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..735b66f09d --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/schema.sql @@ -0,0 +1,11 @@ +CREATE TABLE foo +( + col_a BOOL NOT NULL, + col_b BOOLEAN NOT NULL +); + +CREATE TABLE bar +( + col_a BOOL, + col_b BOOLEAN +); diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/sqlc.json index 345a7931d0..d5697fa2bf 100644 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/models.go index 09f37abcb8..8473f52a9e 100644 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/query.sql.go index 32b258513b..9d705cd685 100644 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/query.sql index 53ad078373..c0adc5c5c5 100644 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/query.sql @@ -1,17 +1,5 @@ -CREATE TABLE foo -( - col_a BOOL NOT NULL, - col_b BOOLEAN NOT NULL -); - -- name: ListFoo :many SELECT * FROM foo; -CREATE TABLE bar -( - col_a BOOL, - col_b BOOLEAN -); - -- name: ListBar :many SELECT * FROM bar; diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..735b66f09d --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/schema.sql @@ -0,0 +1,11 @@ +CREATE TABLE foo +( + col_a BOOL NOT NULL, + col_b BOOLEAN NOT NULL +); + +CREATE TABLE bar +( + col_a BOOL, + col_b BOOLEAN +); diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/sqlc.json index 78ba57848f..59a4822f0b 100644 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/models.go index 3b05ae17d3..dfbf6aeb32 100644 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/query.sql.go index 5f24651f81..9527500b60 100644 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/query.sql b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/query.sql index 53ad078373..c0adc5c5c5 100644 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/query.sql @@ -1,17 +1,5 @@ -CREATE TABLE foo -( - col_a BOOL NOT NULL, - col_b BOOLEAN NOT NULL -); - -- name: ListFoo :many SELECT * FROM foo; -CREATE TABLE bar -( - col_a BOOL, - col_b BOOLEAN -); - -- name: ListBar :many SELECT * FROM bar; diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..735b66f09d --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/schema.sql @@ -0,0 +1,11 @@ +CREATE TABLE foo +( + col_a BOOL NOT NULL, + col_b BOOLEAN NOT NULL +); + +CREATE TABLE bar +( + col_a BOOL, + col_b BOOLEAN +); diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/sqlc.json index 158ef7ec62..84cf1bb5aa 100644 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/data_type_boolean/sqlite/db/db.go b/internal/endtoend/testdata/data_type_boolean/sqlite/db/db.go index 3d2b5bf3a3..cd5bbb8e08 100644 --- a/internal/endtoend/testdata/data_type_boolean/sqlite/db/db.go +++ b/internal/endtoend/testdata/data_type_boolean/sqlite/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/data_type_boolean/sqlite/db/models.go b/internal/endtoend/testdata/data_type_boolean/sqlite/db/models.go index abb030e634..7cd3cb8dce 100644 --- a/internal/endtoend/testdata/data_type_boolean/sqlite/db/models.go +++ b/internal/endtoend/testdata/data_type_boolean/sqlite/db/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/data_type_boolean/sqlite/db/query.sql.go b/internal/endtoend/testdata/data_type_boolean/sqlite/db/query.sql.go index 90954d51e4..b76767679c 100644 --- a/internal/endtoend/testdata/data_type_boolean/sqlite/db/query.sql.go +++ b/internal/endtoend/testdata/data_type_boolean/sqlite/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package db diff --git a/internal/endtoend/testdata/data_type_boolean/sqlite/query.sql b/internal/endtoend/testdata/data_type_boolean/sqlite/query.sql index 53ad078373..c0adc5c5c5 100644 --- a/internal/endtoend/testdata/data_type_boolean/sqlite/query.sql +++ b/internal/endtoend/testdata/data_type_boolean/sqlite/query.sql @@ -1,17 +1,5 @@ -CREATE TABLE foo -( - col_a BOOL NOT NULL, - col_b BOOLEAN NOT NULL -); - -- name: ListFoo :many SELECT * FROM foo; -CREATE TABLE bar -( - col_a BOOL, - col_b BOOLEAN -); - -- name: ListBar :many SELECT * FROM bar; diff --git a/internal/endtoend/testdata/data_type_boolean/sqlite/schema.sql b/internal/endtoend/testdata/data_type_boolean/sqlite/schema.sql new file mode 100644 index 0000000000..735b66f09d --- /dev/null +++ b/internal/endtoend/testdata/data_type_boolean/sqlite/schema.sql @@ -0,0 +1,11 @@ +CREATE TABLE foo +( + col_a BOOL NOT NULL, + col_b BOOLEAN NOT NULL +); + +CREATE TABLE bar +( + col_a BOOL, + col_b BOOLEAN +); diff --git a/internal/endtoend/testdata/data_type_boolean/sqlite/sqlc.json b/internal/endtoend/testdata/data_type_boolean/sqlite/sqlc.json index fab734aaef..8dc788d7cd 100644 --- a/internal/endtoend/testdata/data_type_boolean/sqlite/sqlc.json +++ b/internal/endtoend/testdata/data_type_boolean/sqlite/sqlc.json @@ -4,7 +4,7 @@ { "path": "db", "engine": "sqlite", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/datatype/mysql/go/db.go b/internal/endtoend/testdata/datatype/mysql/go/db.go index f280f77116..0a639a6476 100644 --- a/internal/endtoend/testdata/datatype/mysql/go/db.go +++ b/internal/endtoend/testdata/datatype/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package datatype diff --git a/internal/endtoend/testdata/datatype/mysql/go/models.go b/internal/endtoend/testdata/datatype/mysql/go/models.go index e4b55a42fa..8e15cde168 100644 --- a/internal/endtoend/testdata/datatype/mysql/go/models.go +++ b/internal/endtoend/testdata/datatype/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package datatype @@ -54,8 +54,8 @@ type DtDatetimeNotNull struct { type DtNumeric struct { A sql.NullInt32 B sql.NullInt32 - C sql.NullInt32 - D sql.NullInt32 + C sql.NullInt16 + D sql.NullInt16 E sql.NullInt32 F sql.NullInt64 G interface{} @@ -69,8 +69,8 @@ type DtNumeric struct { type DtNumericNotNull struct { A int32 B int32 - C int32 - D int32 + C int8 + D int16 E int32 F int64 G interface{} @@ -84,8 +84,8 @@ type DtNumericNotNull struct { type DtNumericUnsigned struct { A sql.NullInt32 B sql.NullInt32 - C sql.NullInt32 - D sql.NullInt32 + C sql.NullInt16 + D sql.NullInt16 E sql.NullInt32 F sql.NullInt64 } diff --git a/internal/endtoend/testdata/datatype/mysql/go/query.sql.go b/internal/endtoend/testdata/datatype/mysql/go/query.sql.go new file mode 100644 index 0000000000..4720927d0a --- /dev/null +++ b/internal/endtoend/testdata/datatype/mysql/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package datatype + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/datatype/mysql/sql/query.sql b/internal/endtoend/testdata/datatype/mysql/sql/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/datatype/mysql/sql/query.sql +++ b/internal/endtoend/testdata/datatype/mysql/sql/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/datatype/pgx/v4/go/db.go b/internal/endtoend/testdata/datatype/pgx/v4/go/db.go index 819b76a2d8..4e47262b7d 100644 --- a/internal/endtoend/testdata/datatype/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/datatype/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package datatype diff --git a/internal/endtoend/testdata/datatype/pgx/v4/go/models.go b/internal/endtoend/testdata/datatype/pgx/v4/go/models.go index 6e6cd4181f..6069c4a25c 100644 --- a/internal/endtoend/testdata/datatype/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/datatype/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package datatype diff --git a/internal/endtoend/testdata/datatype/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/datatype/pgx/v4/go/query.sql.go new file mode 100644 index 0000000000..3a1b6bccec --- /dev/null +++ b/internal/endtoend/testdata/datatype/pgx/v4/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package datatype + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRow(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/datatype/pgx/v4/sql/query.sql b/internal/endtoend/testdata/datatype/pgx/v4/sql/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/datatype/pgx/v4/sql/query.sql +++ b/internal/endtoend/testdata/datatype/pgx/v4/sql/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/datatype/pgx/v5/go/db.go b/internal/endtoend/testdata/datatype/pgx/v5/go/db.go index 628fe9c96b..2853d5f77e 100644 --- a/internal/endtoend/testdata/datatype/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/datatype/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package datatype diff --git a/internal/endtoend/testdata/datatype/pgx/v5/go/models.go b/internal/endtoend/testdata/datatype/pgx/v5/go/models.go index a1b7649a58..49a90357c5 100644 --- a/internal/endtoend/testdata/datatype/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/datatype/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package datatype diff --git a/internal/endtoend/testdata/datatype/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/datatype/pgx/v5/go/query.sql.go new file mode 100644 index 0000000000..3a1b6bccec --- /dev/null +++ b/internal/endtoend/testdata/datatype/pgx/v5/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package datatype + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRow(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/datatype/pgx/v5/sql/query.sql b/internal/endtoend/testdata/datatype/pgx/v5/sql/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/datatype/pgx/v5/sql/query.sql +++ b/internal/endtoend/testdata/datatype/pgx/v5/sql/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/datatype/sqlite/go/db.go b/internal/endtoend/testdata/datatype/sqlite/go/db.go index f280f77116..0a639a6476 100644 --- a/internal/endtoend/testdata/datatype/sqlite/go/db.go +++ b/internal/endtoend/testdata/datatype/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package datatype diff --git a/internal/endtoend/testdata/datatype/sqlite/go/models.go b/internal/endtoend/testdata/datatype/sqlite/go/models.go index f3eb95ff73..277f6abedf 100644 --- a/internal/endtoend/testdata/datatype/sqlite/go/models.go +++ b/internal/endtoend/testdata/datatype/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package datatype diff --git a/internal/endtoend/testdata/datatype/sqlite/go/query.sql.go b/internal/endtoend/testdata/datatype/sqlite/go/query.sql.go new file mode 100644 index 0000000000..a92313d1a7 --- /dev/null +++ b/internal/endtoend/testdata/datatype/sqlite/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package datatype + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int64 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/datatype/sqlite/sql/query.sql b/internal/endtoend/testdata/datatype/sqlite/sql/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/datatype/sqlite/sql/query.sql +++ b/internal/endtoend/testdata/datatype/sqlite/sql/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/datatype/stdlib/go/db.go b/internal/endtoend/testdata/datatype/stdlib/go/db.go index f280f77116..0a639a6476 100644 --- a/internal/endtoend/testdata/datatype/stdlib/go/db.go +++ b/internal/endtoend/testdata/datatype/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package datatype diff --git a/internal/endtoend/testdata/datatype/stdlib/go/models.go b/internal/endtoend/testdata/datatype/stdlib/go/models.go index c9f87be871..691793cbdd 100644 --- a/internal/endtoend/testdata/datatype/stdlib/go/models.go +++ b/internal/endtoend/testdata/datatype/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package datatype diff --git a/internal/endtoend/testdata/datatype/stdlib/go/query.sql.go b/internal/endtoend/testdata/datatype/stdlib/go/query.sql.go new file mode 100644 index 0000000000..4720927d0a --- /dev/null +++ b/internal/endtoend/testdata/datatype/stdlib/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package datatype + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/datatype/stdlib/sql/query.sql b/internal/endtoend/testdata/datatype/stdlib/sql/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/datatype/stdlib/sql/query.sql +++ b/internal/endtoend/testdata/datatype/stdlib/sql/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/issue.md b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/issue.md new file mode 100644 index 0000000000..c51bd7f6d4 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1519 diff --git a/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/go/db.go b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/go/models.go b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..bbb0117133 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/go/models.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type ComputedTablesSomething struct { + ID pgtype.Int4 + EventType string + CreatedAt pgtype.Timestamptz +} + +type Event struct { + ID pgtype.Int4 + EventType string + CreatedAt pgtype.Timestamptz +} diff --git a/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..b5390d928e --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/go/query.sql.go @@ -0,0 +1,36 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const someQuery = `-- name: SomeQuery :many +select id from "computed_tables"."something" +` + +func (q *Queries) SomeQuery(ctx context.Context) ([]pgtype.Int4, error) { + rows, err := q.db.Query(ctx, someQuery) + if err != nil { + return nil, err + } + defer rows.Close() + var items []pgtype.Int4 + for rows.Next() { + var id pgtype.Int4 + if err := rows.Scan(&id); err != nil { + return nil, err + } + items = append(items, id) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/query.sql b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/query.sql new file mode 100644 index 0000000000..24dafea7ed --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/query.sql @@ -0,0 +1,2 @@ +-- name: SomeQuery :many +select id from "computed_tables"."something"; diff --git a/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/schema.sql b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..2b788e0976 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/schema.sql @@ -0,0 +1,13 @@ +create table events ( + id int, + event_type text not null, + created_at timestamptz +); + +CREATE MATERIALIZED VIEW something AS +select * from events +where event_type = 'sale' +order by created_at desc; + +create schema computed_tables; +alter materialized view something set schema computed_tables; diff --git a/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/models.go index 9629795bcd..b7e6d70cba 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/models.go index 46527b502b..2ac3331027 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/models.go index 58ada23032..acf9e070a2 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/models.go index 46527b502b..2ac3331027 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/db.go b/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/models.go b/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/models.go index 7c2a1538a6..ba83d3d792 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/query.sql.go index 48abdeca1d..c388865458 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/models.go index a8b9e9c97e..115508d2bc 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Bar string Baz string diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/models.go index a8b9e9c97e..115508d2bc 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Bar string Baz string diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/models.go index a8b9e9c97e..115508d2bc 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Bar string Baz string diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/models.go index 4730871b4c..15660dccd1 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/models.go index bf6ebcb39d..957c613690 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Bar []string } diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/models.go index bf6ebcb39d..957c613690 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Bar []string } diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/models.go index bf6ebcb39d..957c613690 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Bar []string } diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/go/db.go b/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/go/models.go b/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/go/models.go new file mode 100644 index 0000000000..3ec65a53d1 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + ID int64 + FullName sql.NullString + EmailAddress sql.NullString + CreatedAt sql.NullString +} diff --git a/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/go/query.sql.go new file mode 100644 index 0000000000..610c92c218 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/go/query.sql.go @@ -0,0 +1,60 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const insertUser = `-- name: InsertUser :exec +INSERT INTO Users (full_name, "EmailAddress", created_at) +VALUES (?, ?, ?) +` + +type InsertUserParams struct { + FullName sql.NullString + EmailAddress sql.NullString + CreatedAt sql.NullString +} + +func (q *Queries) InsertUser(ctx context.Context, arg InsertUserParams) error { + _, err := q.db.ExecContext(ctx, insertUser, arg.FullName, arg.EmailAddress, arg.CreatedAt) + return err +} + +const selectUsers = `-- name: SelectUsers :many +SELECT id, full_name, "EmailAddress", created_at +FROM Users +` + +func (q *Queries) SelectUsers(ctx context.Context) ([]User, error) { + rows, err := q.db.QueryContext(ctx, selectUsers) + if err != nil { + return nil, err + } + defer rows.Close() + var items []User + for rows.Next() { + var i User + if err := rows.Scan( + &i.ID, + &i.FullName, + &i.EmailAddress, + &i.CreatedAt, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/query.sql b/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/query.sql new file mode 100644 index 0000000000..79989697e8 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/query.sql @@ -0,0 +1,7 @@ +-- name: InsertUser :exec +INSERT INTO Users (full_name, "EmailAddress", created_at) +VALUES (?, ?, ?); + +-- name: SelectUsers :many +SELECT id, full_name, "EmailAddress", created_at +FROM Users; diff --git a/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/schema.sql b/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/schema.sql new file mode 100644 index 0000000000..5b8af0ac35 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/schema.sql @@ -0,0 +1,10 @@ +-- Test ALTER TABLE operations with mixed case table and column names +-- Verifies consistent handling of case sensitivity in DDL operations +CREATE TABLE Users (id integer primary key, name text, "Email" text); + +-- Test renaming columns with different case formats +ALTER TABLE Users RENAME COLUMN name TO full_name; +ALTER TABLE Users RENAME COLUMN "Email" TO "EmailAddress"; + +-- Test adding a simple column +ALTER TABLE Users ADD COLUMN created_at text; diff --git a/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/sqlc.json new file mode 100644 index 0000000000..cd66df063b --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/models.go index e2e54f4289..67a0efc68c 100644 --- a/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/models.go index e1e25d4f9f..59658163a8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Baz string } diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/models.go index e1e25d4f9f..59658163a8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Baz string } diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/models.go index e1e25d4f9f..59658163a8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Baz string } diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/mysql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/mysql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/mysql/go/models.go index 8354a335ab..4a41234e03 100644 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/mysql/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/models.go index 8354a335ab..4a41234e03 100644 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/models.go index 2eae5b9f1f..e662ac1daa 100644 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/models.go index 8354a335ab..4a41234e03 100644 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/mysql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/mysql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/mysql/go/models.go index e2e54f4289..67a0efc68c 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/mysql/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/models.go index e2e54f4289..67a0efc68c 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/models.go index 2ad82f7bd8..09cfadd9e7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/models.go index e2e54f4289..67a0efc68c 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/models.go index e2e54f4289..67a0efc68c 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/query.sql.go index f1f74ca4ae..da6e0a8d41 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/exec.json b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/exec.json new file mode 100644 index 0000000000..c85ca2dfa7 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["base"], + "meta": { + "invalid_schema": true + } +} diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/go/models.go index c3e4850f4f..d0184b2aec 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/go/models.go @@ -1,10 +1,8 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/models.go index c3e4850f4f..d0184b2aec 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/models.go @@ -1,10 +1,8 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/models.go index c3e4850f4f..d0184b2aec 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/models.go @@ -1,10 +1,8 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/models.go index c3e4850f4f..d0184b2aec 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/models.go @@ -1,10 +1,8 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/exec.json b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/exec.json new file mode 100644 index 0000000000..c85ca2dfa7 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["base"], + "meta": { + "invalid_schema": true + } +} diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/go/models.go index 7a6692ee43..de9a55960a 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Venue struct { ID uint64 } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/models.go index 5b6fa88c9a..1944ccee84 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Venue struct { ID int32 } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/models.go index 5b6fa88c9a..1944ccee84 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Venue struct { ID int32 } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/models.go index 5b6fa88c9a..1944ccee84 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Venue struct { ID int32 } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/models.go index 72f6b62d08..8a05f10ef2 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/models.go index eee6a6d496..37aa1e6042 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/models.go index 72f6b62d08..8a05f10ef2 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/mysql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_rename/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/mysql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_rename/mysql/go/models.go index 21861aedbd..fef18087e2 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename/mysql/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/models.go index ca7f329592..019c765b19 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/models.go index 0c5fbe7fa1..c3cac35296 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/models.go index ca7f329592..019c765b19 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/db.go b/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/models.go b/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/models.go index ca7f329592..019c765b19 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/query.sql.go index 6cf0ba887a..f224de356f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/mysql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/mysql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/mysql/go/models.go index e2e54f4289..67a0efc68c 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/mysql/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/models.go index e2e54f4289..67a0efc68c 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/models.go index 2ad82f7bd8..09cfadd9e7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/models.go index e2e54f4289..67a0efc68c 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/db.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/models.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/models.go index a2b34bef24..927fff0f36 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/query.sql.go index cb79b21683..c9e55c9583 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/mysql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/mysql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/mysql/go/models.go index 9e06e62360..06e143d2bd 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/mysql/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/models.go index 97b1844235..33e41a2fea 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/models.go index 8d0eeaf2f3..8a716e4f7a 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/models.go index 97b1844235..33e41a2fea 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/mysql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/mysql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/mysql/go/models.go index 3f44f8fd63..0cd442222e 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Bar string } diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/mysql/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/models.go index 3f44f8fd63..0cd442222e 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Bar string } diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/models.go index 3f44f8fd63..0cd442222e 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Bar string } diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/models.go index 3f44f8fd63..0cd442222e 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Bar string } diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/models.go index ad6d3d32ce..3d7be3b20f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/query.sql.go index 2fac817075..9e6b8735c7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/models.go index 3b18903a63..8e1f8559b0 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/query.sql.go index 6dab12b204..01336b0e2f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/models.go index ad6d3d32ce..3d7be3b20f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/query.sql.go index 5629e049b3..fbff09c49d 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/models.go index 64c1a45a19..f539efec15 100644 --- a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/models.go index 64c1a45a19..f539efec15 100644 --- a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/models.go index 64c1a45a19..f539efec15 100644 --- a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/models.go index 3d3ddaa7f1..34a1484113 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/query.sql.go index a2cc27a171..01b4373918 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/query.sql index 82b8659b52..92575af773 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/query.sql @@ -1,11 +1,2 @@ -CREATE TYPE event AS enum ('START', 'STOP'); - -ALTER TYPE event RENAME TO "new_event"; - -CREATE TABLE log_lines ( - id BIGSERIAL PRIMARY KEY, - status "new_event" NOT NULL -); - -- name: ListAuthors :many SELECT * FROM log_lines; diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..44a3b2873f --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/schema.sql @@ -0,0 +1,9 @@ +CREATE TYPE event AS enum ('START', 'STOP'); + +ALTER TYPE event RENAME TO "new_event"; + +CREATE TABLE log_lines ( + id BIGSERIAL PRIMARY KEY, + status "new_event" NOT NULL +); + diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/models.go index 3d3ddaa7f1..34a1484113 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/query.sql.go index a2cc27a171..01b4373918 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/query.sql index 82b8659b52..92575af773 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/query.sql @@ -1,11 +1,2 @@ -CREATE TYPE event AS enum ('START', 'STOP'); - -ALTER TYPE event RENAME TO "new_event"; - -CREATE TABLE log_lines ( - id BIGSERIAL PRIMARY KEY, - status "new_event" NOT NULL -); - -- name: ListAuthors :many SELECT * FROM log_lines; diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..44a3b2873f --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/schema.sql @@ -0,0 +1,9 @@ +CREATE TYPE event AS enum ('START', 'STOP'); + +ALTER TYPE event RENAME TO "new_event"; + +CREATE TABLE log_lines ( + id BIGSERIAL PRIMARY KEY, + status "new_event" NOT NULL +); + diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/models.go index 3d3ddaa7f1..34a1484113 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/query.sql.go index 397388e073..89a510acd2 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/query.sql index 82b8659b52..92575af773 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/query.sql @@ -1,11 +1,2 @@ -CREATE TYPE event AS enum ('START', 'STOP'); - -ALTER TYPE event RENAME TO "new_event"; - -CREATE TABLE log_lines ( - id BIGSERIAL PRIMARY KEY, - status "new_event" NOT NULL -); - -- name: ListAuthors :many SELECT * FROM log_lines; diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..44a3b2873f --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/schema.sql @@ -0,0 +1,9 @@ +CREATE TYPE event AS enum ('START', 'STOP'); + +ALTER TYPE event RENAME TO "new_event"; + +CREATE TABLE log_lines ( + id BIGSERIAL PRIMARY KEY, + status "new_event" NOT NULL +); + diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/models.go index 3d3ddaa7f1..34a1484113 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/query.sql.go index a2cc27a171..01b4373918 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/query.sql index f5a6891f91..92575af773 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/query.sql @@ -1,11 +1,2 @@ -CREATE TYPE event AS enum ('START', 'STOP'); - -CREATE TABLE log_lines ( - id BIGSERIAL PRIMARY KEY, - status "event" NOT NULL -); - -ALTER TYPE event RENAME TO "new_event"; - -- name: ListAuthors :many SELECT * FROM log_lines; diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..eb9ec7d533 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/schema.sql @@ -0,0 +1,9 @@ +CREATE TYPE event AS enum ('START', 'STOP'); + +CREATE TABLE log_lines ( + id BIGSERIAL PRIMARY KEY, + status "event" NOT NULL +); + +ALTER TYPE event RENAME TO "new_event"; + diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/models.go index 3d3ddaa7f1..34a1484113 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/query.sql.go index a2cc27a171..01b4373918 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/query.sql index f5a6891f91..92575af773 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/query.sql @@ -1,11 +1,2 @@ -CREATE TYPE event AS enum ('START', 'STOP'); - -CREATE TABLE log_lines ( - id BIGSERIAL PRIMARY KEY, - status "event" NOT NULL -); - -ALTER TYPE event RENAME TO "new_event"; - -- name: ListAuthors :many SELECT * FROM log_lines; diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..eb9ec7d533 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/schema.sql @@ -0,0 +1,9 @@ +CREATE TYPE event AS enum ('START', 'STOP'); + +CREATE TABLE log_lines ( + id BIGSERIAL PRIMARY KEY, + status "event" NOT NULL +); + +ALTER TYPE event RENAME TO "new_event"; + diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/models.go index 3d3ddaa7f1..34a1484113 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/query.sql.go index 397388e073..89a510acd2 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/query.sql index f5a6891f91..92575af773 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/query.sql @@ -1,11 +1,2 @@ -CREATE TYPE event AS enum ('START', 'STOP'); - -CREATE TABLE log_lines ( - id BIGSERIAL PRIMARY KEY, - status "event" NOT NULL -); - -ALTER TYPE event RENAME TO "new_event"; - -- name: ListAuthors :many SELECT * FROM log_lines; diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..eb9ec7d533 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/schema.sql @@ -0,0 +1,9 @@ +CREATE TYPE event AS enum ('START', 'STOP'); + +CREATE TABLE log_lines ( + id BIGSERIAL PRIMARY KEY, + status "event" NOT NULL +); + +ALTER TYPE event RENAME TO "new_event"; + diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/models.go index fa6aab4565..3b2d5ea724 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/models.go index fa6aab4565..3b2d5ea724 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/models.go index fa6aab4565..3b2d5ea724 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/models.go index 7fa9c3c7d0..01922dfc08 100644 --- a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/query.sql.go index ee28f7d924..6ad1109d83 100644 --- a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/query.sql index 06d156849a..92575af773 100644 --- a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/query.sql @@ -1,17 +1,2 @@ -CREATE SCHEMA old; -CREATE SCHEMA new; - -CREATE TYPE event AS enum ('START', 'STOP'); -CREATE TYPE old.level AS enum ('DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL'); - -CREATE TABLE log_lines ( - id BIGSERIAL PRIMARY KEY, - status event NOT NULL, - level old.level NOT NULL -); - -ALTER TYPE event SET SCHEMA new; -ALTER TYPE old.level SET SCHEMA public; - -- name: ListAuthors :many SELECT * FROM log_lines; diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..c2f0effd98 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/schema.sql @@ -0,0 +1,15 @@ +CREATE SCHEMA old; +CREATE SCHEMA new; + +CREATE TYPE event AS enum ('START', 'STOP'); +CREATE TYPE old.level AS enum ('DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL'); + +CREATE TABLE log_lines ( + id BIGSERIAL PRIMARY KEY, + status event NOT NULL, + level old.level NOT NULL +); + +ALTER TYPE event SET SCHEMA new; +ALTER TYPE old.level SET SCHEMA public; + diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/models.go index 7fa9c3c7d0..01922dfc08 100644 --- a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/query.sql.go index ee28f7d924..6ad1109d83 100644 --- a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/query.sql index 06d156849a..92575af773 100644 --- a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/query.sql @@ -1,17 +1,2 @@ -CREATE SCHEMA old; -CREATE SCHEMA new; - -CREATE TYPE event AS enum ('START', 'STOP'); -CREATE TYPE old.level AS enum ('DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL'); - -CREATE TABLE log_lines ( - id BIGSERIAL PRIMARY KEY, - status event NOT NULL, - level old.level NOT NULL -); - -ALTER TYPE event SET SCHEMA new; -ALTER TYPE old.level SET SCHEMA public; - -- name: ListAuthors :many SELECT * FROM log_lines; diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..c2f0effd98 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/schema.sql @@ -0,0 +1,15 @@ +CREATE SCHEMA old; +CREATE SCHEMA new; + +CREATE TYPE event AS enum ('START', 'STOP'); +CREATE TYPE old.level AS enum ('DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL'); + +CREATE TABLE log_lines ( + id BIGSERIAL PRIMARY KEY, + status event NOT NULL, + level old.level NOT NULL +); + +ALTER TYPE event SET SCHEMA new; +ALTER TYPE old.level SET SCHEMA public; + diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/models.go index 7fa9c3c7d0..01922dfc08 100644 --- a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/query.sql.go index 76a39e43cd..991a72e41c 100644 --- a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/query.sql b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/query.sql index 06d156849a..92575af773 100644 --- a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/query.sql @@ -1,17 +1,2 @@ -CREATE SCHEMA old; -CREATE SCHEMA new; - -CREATE TYPE event AS enum ('START', 'STOP'); -CREATE TYPE old.level AS enum ('DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL'); - -CREATE TABLE log_lines ( - id BIGSERIAL PRIMARY KEY, - status event NOT NULL, - level old.level NOT NULL -); - -ALTER TYPE event SET SCHEMA new; -ALTER TYPE old.level SET SCHEMA public; - -- name: ListAuthors :many SELECT * FROM log_lines; diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..c2f0effd98 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/schema.sql @@ -0,0 +1,15 @@ +CREATE SCHEMA old; +CREATE SCHEMA new; + +CREATE TYPE event AS enum ('START', 'STOP'); +CREATE TYPE old.level AS enum ('DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL'); + +CREATE TABLE log_lines ( + id BIGSERIAL PRIMARY KEY, + status event NOT NULL, + level old.level NOT NULL +); + +ALTER TYPE event SET SCHEMA new; +ALTER TYPE old.level SET SCHEMA public; + diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/ddl_comment/mysql/go/db.go b/internal/endtoend/testdata/ddl_comment/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_comment/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_comment/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_comment/mysql/go/models.go b/internal/endtoend/testdata/ddl_comment/mysql/go/models.go index af1424acd8..f81de56f8a 100644 --- a/internal/endtoend/testdata/ddl_comment/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_comment/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_comment/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_comment/mysql/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_comment/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_comment/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/models.go index 179acb7630..21fb81be1d 100644 --- a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/models.go index d89c7240ac..7a69cf3252 100644 --- a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/models.go index 179acb7630..21fb81be1d 100644 --- a/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_enum/mysql/go/db.go b/internal/endtoend/testdata/ddl_create_enum/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_create_enum/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_create_enum/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_enum/mysql/go/models.go b/internal/endtoend/testdata/ddl_create_enum/mysql/go/models.go index 44ff83236c..bceedb5629 100644 --- a/internal/endtoend/testdata/ddl_create_enum/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_create_enum/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_enum/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_create_enum/mysql/go/query.sql.go index 8bd1cc3339..279c549bd6 100644 --- a/internal/endtoend/testdata/ddl_create_enum/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_enum/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/models.go index f56bbc4c4a..6a0cfe3560 100644 --- a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/query.sql.go index c1e55527b6..3cbd273217 100644 --- a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/models.go index f56bbc4c4a..6a0cfe3560 100644 --- a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/query.sql.go index c1e55527b6..3cbd273217 100644 --- a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/models.go index f56bbc4c4a..6a0cfe3560 100644 --- a/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/query.sql.go index fb52339618..620055c43c 100644 --- a/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_func_exists/exec.json b/internal/endtoend/testdata/ddl_create_func_exists/exec.json new file mode 100644 index 0000000000..c85ca2dfa7 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_func_exists/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["base"], + "meta": { + "invalid_schema": true + } +} diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_procedure/mysql/go/db.go b/internal/endtoend/testdata/ddl_create_procedure/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_create_procedure/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_create_procedure/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_procedure/mysql/go/models.go b/internal/endtoend/testdata/ddl_create_procedure/mysql/go/models.go index bc7405df4a..f4ed97c5d2 100644 --- a/internal/endtoend/testdata/ddl_create_procedure/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_create_procedure/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_procedure/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_create_procedure/mysql/go/query.sql.go index b9d37effdf..bf5b8f5890 100644 --- a/internal/endtoend/testdata/ddl_create_procedure/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_procedure/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/models.go index bc7405df4a..f4ed97c5d2 100644 --- a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/query.sql.go index db689f1419..3b04c9af76 100644 --- a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/models.go index 21e01b8039..aeb0ffd1ff 100644 --- a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/query.sql.go index db689f1419..3b04c9af76 100644 --- a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/models.go index bc7405df4a..f4ed97c5d2 100644 --- a/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/query.sql.go index fb298cbe34..b7059b0a78 100644 --- a/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table/mysql/go/db.go b/internal/endtoend/testdata/ddl_create_table/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_create_table/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table/mysql/go/models.go b/internal/endtoend/testdata/ddl_create_table/mysql/go/models.go index 71937e08a4..c43b161fde 100644 --- a/internal/endtoend/testdata/ddl_create_table/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table/mysql/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_create_table/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/models.go index 71937e08a4..c43b161fde 100644 --- a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/models.go index 0b7d31316c..81249afc4a 100644 --- a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/models.go index 71937e08a4..c43b161fde 100644 --- a/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table/sqlite/go/db.go b/internal/endtoend/testdata/ddl_create_table/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_create_table/sqlite/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table/sqlite/go/models.go b/internal/endtoend/testdata/ddl_create_table/sqlite/go/models.go index 71937e08a4..c43b161fde 100644 --- a/internal/endtoend/testdata/ddl_create_table/sqlite/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table/sqlite/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_create_table/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/models.go index 1b324e0f0b..4c34036e2c 100644 --- a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/models.go index c5e69d6eaf..dbc5cbd8b1 100644 --- a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/models.go index 1b324e0f0b..4c34036e2c 100644 --- a/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/models.go index aa2ce5bb53..87aff71db6 100644 --- a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/query.sql.go index a7c8ebf655..4caab44ccb 100644 --- a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/models.go index 64845fa3df..2cbc4b68a6 100644 --- a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/query.sql.go index a7c8ebf655..4caab44ccb 100644 --- a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/models.go index aa2ce5bb53..87aff71db6 100644 --- a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/query.sql.go index 0a9e63d669..fe4b5e86fa 100644 --- a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_invalid_inherits/postgresql/stdlib/exec.json b/internal/endtoend/testdata/ddl_create_table_invalid_inherits/postgresql/stdlib/exec.json new file mode 100644 index 0000000000..c85ca2dfa7 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_invalid_inherits/postgresql/stdlib/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["base"], + "meta": { + "invalid_schema": true + } +} diff --git a/internal/endtoend/testdata/ddl_create_table_like/issue.md b/internal/endtoend/testdata/ddl_create_table_like/issue.md new file mode 100644 index 0000000000..371a25581d --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_like/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/481 diff --git a/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/go/db.go b/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/go/models.go b/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..b23f089922 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Change struct { + Ranked int32 +} + +type ChangesRanked struct { + Ranked int32 + RankByEffectSize int32 + RankByAbsPercentChange int32 +} diff --git a/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..2a19ba1d08 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const allRanked = `-- name: AllRanked :many +SELECT ranked, rank_by_effect_size, rank_by_abs_percent_change FROM changes_ranked +` + +func (q *Queries) AllRanked(ctx context.Context) ([]ChangesRanked, error) { + rows, err := q.db.Query(ctx, allRanked) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ChangesRanked + for rows.Next() { + var i ChangesRanked + if err := rows.Scan(&i.Ranked, &i.RankByEffectSize, &i.RankByAbsPercentChange); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/query.sql b/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/query.sql new file mode 100644 index 0000000000..759ef862de --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/query.sql @@ -0,0 +1,2 @@ +-- name: AllRanked :many +SELECT * FROM changes_ranked; diff --git a/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/schema.sql b/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..7365737bab --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/schema.sql @@ -0,0 +1,9 @@ +CREATE TABLE changes ( + ranked INT NOT NULL +); + +CREATE TABLE changes_ranked ( + LIKE changes INCLUDING ALL, + rank_by_effect_size INT NOT NULL, + rank_by_abs_percent_change INT NOT NULL +); diff --git a/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/models.go index 194051cd22..f2b61659d0 100644 --- a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/models.go index 213aa6fed6..2021aeb9b0 100644 --- a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/models.go index 194051cd22..f2b61659d0 100644 --- a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/db.go b/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/models.go b/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/models.go index 4e5797e425..93892e5783 100644 --- a/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/models.go index 4e5797e425..93892e5783 100644 --- a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/models.go index e19b8ce8cc..4289389f52 100644 --- a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/models.go index 4e5797e425..93892e5783 100644 --- a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/db.go b/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/models.go b/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/models.go index 71937e08a4..c43b161fde 100644 --- a/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_unknown_type/issue.md b/internal/endtoend/testdata/ddl_create_table_unknown_type/issue.md new file mode 100644 index 0000000000..39b617cc6a --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_unknown_type/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1917 diff --git a/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/exec.json b/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/exec.json new file mode 100644 index 0000000000..abd3ab549c --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["unknown"], + "meta": { + "invalid_schema": true + } +} diff --git a/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/query.sql b/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/query.sql new file mode 100644 index 0000000000..299eb45e2e --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/query.sql @@ -0,0 +1,2 @@ +-- name: SelectOne :one +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/schema.sql b/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..70cd3cf93a --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE test_table ( + id STRING +); diff --git a/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/stderr.txt b/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/stderr.txt new file mode 100644 index 0000000000..2cfd3bad96 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/stderr.txt @@ -0,0 +1,5 @@ +# package querytest +query.sql:1:1: rpc error: code = FailedPrecondition desc = type "string" does not exist (42704) +CREATE TABLE test_table ( + id STRING +); diff --git a/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/db.go b/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/models.go b/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/models.go index 150616bbf2..8886ac424e 100644 --- a/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/models.go index 2894e13b9d..b45d05b560 100644 --- a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/models.go index bfa37ae88f..f1fd7cc650 100644 --- a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/models.go index 2894e13b9d..b45d05b560 100644 --- a/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/db.go b/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/db.go +++ b/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/models.go b/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/models.go index d164ec581b..b4ca845334 100644 --- a/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/models.go +++ b/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_schema/mysql/exec.json b/internal/endtoend/testdata/ddl_drop_schema/mysql/exec.json new file mode 100644 index 0000000000..c85ca2dfa7 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema/mysql/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["base"], + "meta": { + "invalid_schema": true + } +} diff --git a/internal/endtoend/testdata/ddl_drop_schema/mysql/go/db.go b/internal/endtoend/testdata/ddl_drop_schema/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_schema/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_schema/mysql/go/models.go b/internal/endtoend/testdata/ddl_drop_schema/mysql/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_schema/mysql/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_schema/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_schema/mysql/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_schema/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table/sqlite/go/db.go b/internal/endtoend/testdata/ddl_drop_table/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_drop_table/sqlite/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_table/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table/sqlite/go/models.go b/internal/endtoend/testdata/ddl_drop_table/sqlite/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_table/sqlite/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_table/sqlite/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_table/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table/sqlite/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_drop_table/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table/sqlite/schema.sql b/internal/endtoend/testdata/ddl_drop_table/sqlite/schema.sql index d2ea37a051..c0b8f00ed1 100644 --- a/internal/endtoend/testdata/ddl_drop_table/sqlite/schema.sql +++ b/internal/endtoend/testdata/ddl_drop_table/sqlite/schema.sql @@ -1,2 +1,8 @@ CREATE TABLE venues (hi text); -DROP TABLE venues; \ No newline at end of file +DROP TABLE venues; + +CREATE TABLE Authors (id integer); +DROP TABLE Authors; + +CREATE TABLE "Books" (id integer); +DROP TABLE "Books"; diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/db.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/models.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/models.go index c31f6d04d7..90fc088b4d 100644 --- a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/models.go index 3496b9eb8b..7851cb18be 100644 --- a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/models.go index c31f6d04d7..90fc088b4d 100644 --- a/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_materialized_views_invalid/issue.md b/internal/endtoend/testdata/ddl_materialized_views_invalid/issue.md new file mode 100644 index 0000000000..21df2f08dd --- /dev/null +++ b/internal/endtoend/testdata/ddl_materialized_views_invalid/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1545 diff --git a/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/exec.json b/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/query.sql b/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/query.sql new file mode 100644 index 0000000000..b9fa4a4eb3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/query.sql @@ -0,0 +1,4 @@ +-- name: GetTotalEarned :one +SELECT COALESCE(SUM(earned), 0) as total_earned +FROM grouped_kpis +WHERE day = @day; diff --git a/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/schema.sql b/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..d95036a96a --- /dev/null +++ b/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/schema.sql @@ -0,0 +1,9 @@ +CREATE TABLE kpis ( + ts TIMESTAMPTZ, + event_id TEXT NOT NULL +); + +CREATE MATERIALIZED VIEW IF NOT EXISTS grouped_kpis AS +SELECT date_trunc('1 day', ts) as day, COUNT(*) +FROM kpis +GROUP BY 1; diff --git a/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/stderr.txt b/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/stderr.txt new file mode 100644 index 0000000000..e79676465e --- /dev/null +++ b/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/stderr.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:2:21: column "earned" does not exist diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/models.go index 5f2dec0a83..99dabef55e 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/models.go index cda8f80dbd..8592a198af 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..d490737c00 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/models.go index 5f2dec0a83..99dabef55e 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/query.sql.go index dec25cb784..3f59aec9b9 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/issue.md b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/issue.md new file mode 100644 index 0000000000..6b8f89e934 --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/3371 \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/exec.json b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..b2288a73cf --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/go/models.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} + +type AuthorsMv struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/go/query.sql.go new file mode 100644 index 0000000000..6b935d3625 --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,22 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAuthorMv = `-- name: GetAuthorMv :one +SELECT id, name, bio FROM authors_mv +WHERE id = $1 LIMIT 1 +` + +func (q *Queries) GetAuthorMv(ctx context.Context, id int64) (AuthorsMv, error) { + row := q.db.QueryRow(ctx, getAuthorMv, id) + var i AuthorsMv + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..752a6f4d47 --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/query.sql @@ -0,0 +1,3 @@ +-- name: GetAuthorMv :one +SELECT * FROM authors_mv +WHERE id = $1 LIMIT 1; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..3f88871f93 --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/schema.sql @@ -0,0 +1,18 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + +CREATE MATERIALIZED VIEW authors_mv AS ( + SELECT * FROM authors +); + +CREATE MATERIALIZED VIEW authors_mv_new AS ( + SELECT * FROM authors +); + +ALTER MATERIALIZED VIEW authors_mv RENAME TO authors_mv_old; +ALTER MATERIALIZED VIEW authors_mv_new RENAME TO authors_mv; + +DROP MATERIALIZED VIEW authors_mv_old; diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/sqlc.yaml b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/sqlc.yaml new file mode 100644 index 0000000000..3440c3f119 --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v4" diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/exec.json b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..79b9c0ebc3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/go/models.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Author struct { + ID int64 + Name string + Bio pgtype.Text +} + +type AuthorsMv struct { + ID int64 + Name string + Bio pgtype.Text +} diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/go/query.sql.go new file mode 100644 index 0000000000..6b935d3625 --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,22 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAuthorMv = `-- name: GetAuthorMv :one +SELECT id, name, bio FROM authors_mv +WHERE id = $1 LIMIT 1 +` + +func (q *Queries) GetAuthorMv(ctx context.Context, id int64) (AuthorsMv, error) { + row := q.db.QueryRow(ctx, getAuthorMv, id) + var i AuthorsMv + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..752a6f4d47 --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/query.sql @@ -0,0 +1,3 @@ +-- name: GetAuthorMv :one +SELECT * FROM authors_mv +WHERE id = $1 LIMIT 1; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..3f88871f93 --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/schema.sql @@ -0,0 +1,18 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + +CREATE MATERIALIZED VIEW authors_mv AS ( + SELECT * FROM authors +); + +CREATE MATERIALIZED VIEW authors_mv_new AS ( + SELECT * FROM authors +); + +ALTER MATERIALIZED VIEW authors_mv RENAME TO authors_mv_old; +ALTER MATERIALIZED VIEW authors_mv_new RENAME TO authors_mv; + +DROP MATERIALIZED VIEW authors_mv_old; diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/sqlc.yaml b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/delete_from/mysql/go/db.go b/internal/endtoend/testdata/delete_from/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/delete_from/mysql/go/db.go +++ b/internal/endtoend/testdata/delete_from/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/delete_from/mysql/go/models.go b/internal/endtoend/testdata/delete_from/mysql/go/models.go index 91961addfb..ef6e41447e 100644 --- a/internal/endtoend/testdata/delete_from/mysql/go/models.go +++ b/internal/endtoend/testdata/delete_from/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { ID string } diff --git a/internal/endtoend/testdata/delete_from/mysql/go/query.sql.go b/internal/endtoend/testdata/delete_from/mysql/go/query.sql.go index 851d1b12f7..1691acb0c2 100644 --- a/internal/endtoend/testdata/delete_from/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/delete_from/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/delete_from/mysql/query.sql b/internal/endtoend/testdata/delete_from/mysql/query.sql index dbf6a1508a..b47bfc4f4c 100644 --- a/internal/endtoend/testdata/delete_from/mysql/query.sql +++ b/internal/endtoend/testdata/delete_from/mysql/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (id text not null); - /* name: DeleteFrom :exec */ DELETE FROM foo WHERE id = ?; diff --git a/internal/endtoend/testdata/delete_from/mysql/schema.sql b/internal/endtoend/testdata/delete_from/mysql/schema.sql new file mode 100644 index 0000000000..1576c819ea --- /dev/null +++ b/internal/endtoend/testdata/delete_from/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id text not null); + diff --git a/internal/endtoend/testdata/delete_from/mysql/sqlc.json b/internal/endtoend/testdata/delete_from/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/delete_from/mysql/sqlc.json +++ b/internal/endtoend/testdata/delete_from/mysql/sqlc.json @@ -5,7 +5,7 @@ "engine": "mysql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/models.go index 91961addfb..ef6e41447e 100644 --- a/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { ID string } diff --git a/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/query.sql.go index 5a6226f580..2ee4810a1a 100644 --- a/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/query.sql index 09734fdbc5..ed305f4b2c 100644 --- a/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (id text not null); - -- name: DeleteFrom :exec DELETE FROM foo WHERE id = $1; diff --git a/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..1576c819ea --- /dev/null +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id text not null); + diff --git a/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/models.go index 91961addfb..ef6e41447e 100644 --- a/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { ID string } diff --git a/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/query.sql.go index 5a6226f580..2ee4810a1a 100644 --- a/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/query.sql index 09734fdbc5..ed305f4b2c 100644 --- a/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (id text not null); - -- name: DeleteFrom :exec DELETE FROM foo WHERE id = $1; diff --git a/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..1576c819ea --- /dev/null +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id text not null); + diff --git a/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/models.go index 91961addfb..ef6e41447e 100644 --- a/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { ID string } diff --git a/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/query.sql.go index fbc6cabb0e..923b59d51a 100644 --- a/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/delete_from/postgresql/stdlib/query.sql b/internal/endtoend/testdata/delete_from/postgresql/stdlib/query.sql index 09734fdbc5..ed305f4b2c 100644 --- a/internal/endtoend/testdata/delete_from/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/delete_from/postgresql/stdlib/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (id text not null); - -- name: DeleteFrom :exec DELETE FROM foo WHERE id = $1; diff --git a/internal/endtoend/testdata/delete_from/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/delete_from/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..1576c819ea --- /dev/null +++ b/internal/endtoend/testdata/delete_from/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id text not null); + diff --git a/internal/endtoend/testdata/delete_from/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/delete_from/postgresql/stdlib/sqlc.json index de427d069f..cd518671ac 100644 --- a/internal/endtoend/testdata/delete_from/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/delete_from/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "engine": "postgresql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/delete_from/sqlite/go/db.go b/internal/endtoend/testdata/delete_from/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/delete_from/sqlite/go/db.go +++ b/internal/endtoend/testdata/delete_from/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/delete_from/sqlite/go/models.go b/internal/endtoend/testdata/delete_from/sqlite/go/models.go index 91961addfb..ef6e41447e 100644 --- a/internal/endtoend/testdata/delete_from/sqlite/go/models.go +++ b/internal/endtoend/testdata/delete_from/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { ID string } diff --git a/internal/endtoend/testdata/delete_from/sqlite/go/query.sql.go b/internal/endtoend/testdata/delete_from/sqlite/go/query.sql.go index 851d1b12f7..1691acb0c2 100644 --- a/internal/endtoend/testdata/delete_from/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/delete_from/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/delete_inner_join/mysql/go/db.go b/internal/endtoend/testdata/delete_inner_join/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/delete_inner_join/mysql/go/db.go +++ b/internal/endtoend/testdata/delete_inner_join/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/delete_inner_join/mysql/go/models.go b/internal/endtoend/testdata/delete_inner_join/mysql/go/models.go index 437de4d444..d10385dde7 100644 --- a/internal/endtoend/testdata/delete_inner_join/mysql/go/models.go +++ b/internal/endtoend/testdata/delete_inner_join/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Author struct { ID uint32 Name string diff --git a/internal/endtoend/testdata/delete_inner_join/mysql/go/query.sql.go b/internal/endtoend/testdata/delete_inner_join/mysql/go/query.sql.go index 5a867bb1bf..c61efcac1c 100644 --- a/internal/endtoend/testdata/delete_inner_join/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/delete_inner_join/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/delete_inner_join/mysql/query.sql b/internal/endtoend/testdata/delete_inner_join/mysql/query.sql index 833f952149..58f27474cf 100644 --- a/internal/endtoend/testdata/delete_inner_join/mysql/query.sql +++ b/internal/endtoend/testdata/delete_inner_join/mysql/query.sql @@ -1,21 +1,3 @@ -CREATE TABLE author ( - id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, - name VARCHAR(255) NOT NULL -); - -CREATE TABLE book ( - id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, - title VARCHAR(255) NOT NULL -); - -CREATE TABLE author_book ( - author_id INT UNSIGNED NOT NULL, - book_id INT UNSIGNED NOT NULL, - CONSTRAINT `pk-author_book` PRIMARY KEY (author_id, book_id), - CONSTRAINT `fk-author_book-author-id` FOREIGN KEY (author_id) REFERENCES author (id), - CONSTRAINT `fk-author_book-book-id` FOREIGN KEY (book_id) REFERENCES book (id) -); - /* name: RemoveAllAuthorsFromTheGreatGatsby :exec */ DELETE author_book FROM diff --git a/internal/endtoend/testdata/delete_inner_join/mysql/schema.sql b/internal/endtoend/testdata/delete_inner_join/mysql/schema.sql new file mode 100644 index 0000000000..61c646b48a --- /dev/null +++ b/internal/endtoend/testdata/delete_inner_join/mysql/schema.sql @@ -0,0 +1,18 @@ +CREATE TABLE author ( + id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(255) NOT NULL +); + +CREATE TABLE book ( + id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, + title VARCHAR(255) NOT NULL +); + +CREATE TABLE author_book ( + author_id INT UNSIGNED NOT NULL, + book_id INT UNSIGNED NOT NULL, + CONSTRAINT `pk-author_book` PRIMARY KEY (author_id, book_id), + CONSTRAINT `fk-author_book-author-id` FOREIGN KEY (author_id) REFERENCES author (id), + CONSTRAINT `fk-author_book-book-id` FOREIGN KEY (book_id) REFERENCES book (id) +); + diff --git a/internal/endtoend/testdata/delete_inner_join/mysql/sqlc.json b/internal/endtoend/testdata/delete_inner_join/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/delete_inner_join/mysql/sqlc.json +++ b/internal/endtoend/testdata/delete_inner_join/mysql/sqlc.json @@ -5,7 +5,7 @@ "engine": "mysql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/delete_join/mysql/db/db.go b/internal/endtoend/testdata/delete_join/mysql/db/db.go index 3d2b5bf3a3..cd5bbb8e08 100644 --- a/internal/endtoend/testdata/delete_join/mysql/db/db.go +++ b/internal/endtoend/testdata/delete_join/mysql/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/delete_join/mysql/db/models.go b/internal/endtoend/testdata/delete_join/mysql/db/models.go index 2e43afa8ec..ebf0df7b7b 100644 --- a/internal/endtoend/testdata/delete_join/mysql/db/models.go +++ b/internal/endtoend/testdata/delete_join/mysql/db/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db -import () - type JoinTable struct { ID uint64 PrimaryTableID uint64 diff --git a/internal/endtoend/testdata/delete_join/mysql/db/query.sql.go b/internal/endtoend/testdata/delete_join/mysql/db/query.sql.go index c4784e2d38..adab0de2cc 100644 --- a/internal/endtoend/testdata/delete_join/mysql/db/query.sql.go +++ b/internal/endtoend/testdata/delete_join/mysql/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package db @@ -30,6 +30,17 @@ func (q *Queries) DeleteJoin(ctx context.Context, arg DeleteJoinParams) error { return err } +const deleteJoinWithSubquery = `-- name: DeleteJoinWithSubquery :exec +DELETE pt +FROM primary_table pt +JOIN (SELECT 1 as id) jt ON pt.id = jt.id +` + +func (q *Queries) DeleteJoinWithSubquery(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, deleteJoinWithSubquery) + return err +} + const deleteLeftJoin = `-- name: DeleteLeftJoin :exec DELETE jt.*, pt.* diff --git a/internal/endtoend/testdata/delete_join/mysql/query.sql b/internal/endtoend/testdata/delete_join/mysql/query.sql index 863a6769bd..d29062f90e 100644 --- a/internal/endtoend/testdata/delete_join/mysql/query.sql +++ b/internal/endtoend/testdata/delete_join/mysql/query.sql @@ -1,17 +1,3 @@ -CREATE TABLE primary_table ( - id bigint(20) unsigned NOT NULL AUTO_INCREMENT, - user_id bigint(20) unsigned NOT NULL, - PRIMARY KEY (id) -); - -CREATE TABLE join_table ( - id bigint(20) unsigned NOT NULL AUTO_INCREMENT, - primary_table_id bigint(20) unsigned NOT NULL, - other_table_id bigint(20) unsigned NOT NULL, - is_active tinyint(1) NOT NULL DEFAULT '0', - PRIMARY KEY (id) -); - -- name: DeleteJoin :exec DELETE jt.*, pt.* @@ -40,4 +26,9 @@ FROM RIGHT JOIN primary_table as pt ON jt.primary_table_id = pt.id WHERE jt.id = ? - AND pt.user_id = ?; \ No newline at end of file + AND pt.user_id = ?; + +-- name: DeleteJoinWithSubquery :exec +DELETE pt +FROM primary_table pt +JOIN (SELECT 1 as id) jt ON pt.id = jt.id; diff --git a/internal/endtoend/testdata/delete_join/mysql/schema.sql b/internal/endtoend/testdata/delete_join/mysql/schema.sql new file mode 100644 index 0000000000..d0ec352052 --- /dev/null +++ b/internal/endtoend/testdata/delete_join/mysql/schema.sql @@ -0,0 +1,14 @@ +CREATE TABLE primary_table ( + id bigint(20) unsigned NOT NULL AUTO_INCREMENT, + user_id bigint(20) unsigned NOT NULL, + PRIMARY KEY (id) +); + +CREATE TABLE join_table ( + id bigint(20) unsigned NOT NULL AUTO_INCREMENT, + primary_table_id bigint(20) unsigned NOT NULL, + other_table_id bigint(20) unsigned NOT NULL, + is_active tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (id) +); + diff --git a/internal/endtoend/testdata/delete_join/mysql/sqlc.json b/internal/endtoend/testdata/delete_join/mysql/sqlc.json index b63437627d..421770653f 100644 --- a/internal/endtoend/testdata/delete_join/mysql/sqlc.json +++ b/internal/endtoend/testdata/delete_join/mysql/sqlc.json @@ -4,7 +4,7 @@ { "path": "db", "engine": "mysql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/delete_using/issue.md b/internal/endtoend/testdata/delete_using/issue.md new file mode 100644 index 0000000000..c3fc394ad0 --- /dev/null +++ b/internal/endtoend/testdata/delete_using/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1714 diff --git a/internal/endtoend/testdata/delete_using/postgresql/pgx/exec.json b/internal/endtoend/testdata/delete_using/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/delete_using/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/delete_using/postgresql/pgx/go/db.go b/internal/endtoend/testdata/delete_using/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/delete_using/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/delete_using/postgresql/pgx/go/models.go b/internal/endtoend/testdata/delete_using/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..f2040e28d2 --- /dev/null +++ b/internal/endtoend/testdata/delete_using/postgresql/pgx/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type A struct { + AID pgtype.Text + BIDFk pgtype.Text +} + +type B struct { + BID pgtype.Text +} diff --git a/internal/endtoend/testdata/delete_using/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/delete_using/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..581c1d6fb3 --- /dev/null +++ b/internal/endtoend/testdata/delete_using/postgresql/pgx/go/query.sql.go @@ -0,0 +1,39 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const getSomeDeletedNotOk = `-- name: GetSomeDeletedNotOk :many +DELETE FROM a +USING b +WHERE a.b_id_fk = b.b_id +RETURNING b.b_id +` + +func (q *Queries) GetSomeDeletedNotOk(ctx context.Context) ([]pgtype.Text, error) { + rows, err := q.db.Query(ctx, getSomeDeletedNotOk) + if err != nil { + return nil, err + } + defer rows.Close() + var items []pgtype.Text + for rows.Next() { + var b_id pgtype.Text + if err := rows.Scan(&b_id); err != nil { + return nil, err + } + items = append(items, b_id) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/delete_using/postgresql/pgx/query.sql b/internal/endtoend/testdata/delete_using/postgresql/pgx/query.sql new file mode 100644 index 0000000000..f660aaf95d --- /dev/null +++ b/internal/endtoend/testdata/delete_using/postgresql/pgx/query.sql @@ -0,0 +1,5 @@ +-- name: GetSomeDeletedNotOk :many +DELETE FROM a +USING b +WHERE a.b_id_fk = b.b_id +RETURNING b.b_id; -- column "b_id" does not exist diff --git a/internal/endtoend/testdata/delete_using/postgresql/pgx/schema.sql b/internal/endtoend/testdata/delete_using/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..d6380b7a5f --- /dev/null +++ b/internal/endtoend/testdata/delete_using/postgresql/pgx/schema.sql @@ -0,0 +1,9 @@ +CREATE TABLE a +( + a_id TEXT, + b_id_fk TEXT +); +CREATE TABLE b +( + b_id TEXT +); diff --git a/internal/endtoend/testdata/delete_using/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/delete_using/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/delete_using/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/diff_no_output/go/db.go b/internal/endtoend/testdata/diff_no_output/go/db.go index f5d9de7305..fc409f7e3f 100644 --- a/internal/endtoend/testdata/diff_no_output/go/db.go +++ b/internal/endtoend/testdata/diff_no_output/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package authors diff --git a/internal/endtoend/testdata/diff_no_output/go/models.go b/internal/endtoend/testdata/diff_no_output/go/models.go index 559ef910b8..0e2e889bc6 100644 --- a/internal/endtoend/testdata/diff_no_output/go/models.go +++ b/internal/endtoend/testdata/diff_no_output/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package authors diff --git a/internal/endtoend/testdata/diff_no_output/go/query.sql.go b/internal/endtoend/testdata/diff_no_output/go/query.sql.go index 477e08c61b..e54b0f59a1 100644 --- a/internal/endtoend/testdata/diff_no_output/go/query.sql.go +++ b/internal/endtoend/testdata/diff_no_output/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package authors diff --git a/internal/endtoend/testdata/diff_output/go/db.go b/internal/endtoend/testdata/diff_output/go/db.go index f5d9de7305..fc409f7e3f 100644 --- a/internal/endtoend/testdata/diff_output/go/db.go +++ b/internal/endtoend/testdata/diff_output/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package authors diff --git a/internal/endtoend/testdata/diff_output/go/models.go b/internal/endtoend/testdata/diff_output/go/models.go index ec61702f5a..24e47df1ef 100644 --- a/internal/endtoend/testdata/diff_output/go/models.go +++ b/internal/endtoend/testdata/diff_output/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package authors diff --git a/internal/endtoend/testdata/diff_output/go/query.sql.go b/internal/endtoend/testdata/diff_output/go/query.sql.go index a3864f0d97..bb0bc6ce56 100644 --- a/internal/endtoend/testdata/diff_output/go/query.sql.go +++ b/internal/endtoend/testdata/diff_output/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package authors diff --git a/internal/endtoend/testdata/diff_output/stderr.txt b/internal/endtoend/testdata/diff_output/stderr.txt index 4db48d8d44..e7e455436e 100644 --- a/internal/endtoend/testdata/diff_output/stderr.txt +++ b/internal/endtoend/testdata/diff_output/stderr.txt @@ -52,3 +52,4 @@ + err := row.Scan(&column_1) + return column_1, err +} + diff --git a/internal/endtoend/testdata/do/postgresql/pgx/db/db.go b/internal/endtoend/testdata/do/postgresql/pgx/db/db.go index 0975c670b0..9d485b5f16 100644 --- a/internal/endtoend/testdata/do/postgresql/pgx/db/db.go +++ b/internal/endtoend/testdata/do/postgresql/pgx/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.21.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/do/postgresql/pgx/db/models.go b/internal/endtoend/testdata/do/postgresql/pgx/db/models.go index 9d556e5184..d3515f1ede 100644 --- a/internal/endtoend/testdata/do/postgresql/pgx/db/models.go +++ b/internal/endtoend/testdata/do/postgresql/pgx/db/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.21.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/do/postgresql/pgx/db/query.sql.go b/internal/endtoend/testdata/do/postgresql/pgx/db/query.sql.go index b56dac6fc7..31b1fefa59 100644 --- a/internal/endtoend/testdata/do/postgresql/pgx/db/query.sql.go +++ b/internal/endtoend/testdata/do/postgresql/pgx/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.21.0 +// sqlc v1.30.0 // source: query.sql package db diff --git a/internal/endtoend/testdata/do/postgresql/pq/db/db.go b/internal/endtoend/testdata/do/postgresql/pq/db/db.go index 46fda54404..cd5bbb8e08 100644 --- a/internal/endtoend/testdata/do/postgresql/pq/db/db.go +++ b/internal/endtoend/testdata/do/postgresql/pq/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.21.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/do/postgresql/pq/db/models.go b/internal/endtoend/testdata/do/postgresql/pq/db/models.go index b73fc43b09..5041799d54 100644 --- a/internal/endtoend/testdata/do/postgresql/pq/db/models.go +++ b/internal/endtoend/testdata/do/postgresql/pq/db/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.21.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/do/postgresql/pq/db/query.sql.go b/internal/endtoend/testdata/do/postgresql/pq/db/query.sql.go index 3da76a3e74..10fa883b3d 100644 --- a/internal/endtoend/testdata/do/postgresql/pq/db/query.sql.go +++ b/internal/endtoend/testdata/do/postgresql/pq/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.21.0 +// sqlc v1.30.0 // source: query.sql package db diff --git a/internal/endtoend/testdata/duplicate_go_names/enum/query.sql b/internal/endtoend/testdata/duplicate_go_names/enum/query.sql new file mode 100644 index 0000000000..760e82582e --- /dev/null +++ b/internal/endtoend/testdata/duplicate_go_names/enum/query.sql @@ -0,0 +1,2 @@ +-- name: GetFoos :many +SELECT * FROM foos; \ No newline at end of file diff --git a/internal/endtoend/testdata/duplicate_go_names/enum/schema.sql b/internal/endtoend/testdata/duplicate_go_names/enum/schema.sql new file mode 100644 index 0000000000..d0ac445ab1 --- /dev/null +++ b/internal/endtoend/testdata/duplicate_go_names/enum/schema.sql @@ -0,0 +1,3 @@ +CREATE TYPE foo AS ENUM (); + +CREATE TABLE foos (); \ No newline at end of file diff --git a/internal/endtoend/testdata/duplicate_go_names/enum/sqlc.yaml b/internal/endtoend/testdata/duplicate_go_names/enum/sqlc.yaml new file mode 100644 index 0000000000..48946b0279 --- /dev/null +++ b/internal/endtoend/testdata/duplicate_go_names/enum/sqlc.yaml @@ -0,0 +1,8 @@ +version: "2" +sql: +- schema: "schema.sql" + queries: "query.sql" + engine: "postgresql" + gen: + go: + out: "db" diff --git a/internal/endtoend/testdata/duplicate_go_names/enum/stderr.txt b/internal/endtoend/testdata/duplicate_go_names/enum/stderr.txt new file mode 100644 index 0000000000..e6d206bda7 --- /dev/null +++ b/internal/endtoend/testdata/duplicate_go_names/enum/stderr.txt @@ -0,0 +1,2 @@ +# package +error generating code: struct name conflicts with enum name: Foo diff --git a/internal/endtoend/testdata/duplicate_go_names/null_enum/query.sql b/internal/endtoend/testdata/duplicate_go_names/null_enum/query.sql new file mode 100644 index 0000000000..fcb2e75923 --- /dev/null +++ b/internal/endtoend/testdata/duplicate_go_names/null_enum/query.sql @@ -0,0 +1,2 @@ +-- name: GetFoos :many +SELECT * FROM null_foos; \ No newline at end of file diff --git a/internal/endtoend/testdata/duplicate_go_names/null_enum/schema.sql b/internal/endtoend/testdata/duplicate_go_names/null_enum/schema.sql new file mode 100644 index 0000000000..46fe734fe0 --- /dev/null +++ b/internal/endtoend/testdata/duplicate_go_names/null_enum/schema.sql @@ -0,0 +1,3 @@ +CREATE TYPE foo AS ENUM (); + +CREATE TABLE null_foos (); \ No newline at end of file diff --git a/internal/endtoend/testdata/duplicate_go_names/null_enum/sqlc.yaml b/internal/endtoend/testdata/duplicate_go_names/null_enum/sqlc.yaml new file mode 100644 index 0000000000..48946b0279 --- /dev/null +++ b/internal/endtoend/testdata/duplicate_go_names/null_enum/sqlc.yaml @@ -0,0 +1,8 @@ +version: "2" +sql: +- schema: "schema.sql" + queries: "query.sql" + engine: "postgresql" + gen: + go: + out: "db" diff --git a/internal/endtoend/testdata/duplicate_go_names/null_enum/stderr.txt b/internal/endtoend/testdata/duplicate_go_names/null_enum/stderr.txt new file mode 100644 index 0000000000..16321a008f --- /dev/null +++ b/internal/endtoend/testdata/duplicate_go_names/null_enum/stderr.txt @@ -0,0 +1,2 @@ +# package +error generating code: struct name conflicts with enum name: NullFoo diff --git a/internal/endtoend/testdata/duplicate_go_names/query_constant/query.sql b/internal/endtoend/testdata/duplicate_go_names/query_constant/query.sql new file mode 100644 index 0000000000..fc3436d4c5 --- /dev/null +++ b/internal/endtoend/testdata/duplicate_go_names/query_constant/query.sql @@ -0,0 +1,2 @@ +-- name: Foo :one +SELECT 1; \ No newline at end of file diff --git a/internal/endtoend/testdata/duplicate_go_names/query_constant/schema.sql b/internal/endtoend/testdata/duplicate_go_names/query_constant/schema.sql new file mode 100644 index 0000000000..a0ed9c3aba --- /dev/null +++ b/internal/endtoend/testdata/duplicate_go_names/query_constant/schema.sql @@ -0,0 +1 @@ +CREATE TYPE foo AS ENUM (); diff --git a/internal/endtoend/testdata/duplicate_go_names/query_constant/sqlc.yaml b/internal/endtoend/testdata/duplicate_go_names/query_constant/sqlc.yaml new file mode 100644 index 0000000000..e6314287c2 --- /dev/null +++ b/internal/endtoend/testdata/duplicate_go_names/query_constant/sqlc.yaml @@ -0,0 +1,9 @@ +version: "2" +sql: +- schema: "schema.sql" + queries: "query.sql" + engine: "postgresql" + gen: + go: + out: "db" + emit_exported_queries: true diff --git a/internal/endtoend/testdata/duplicate_go_names/query_constant/stderr.txt b/internal/endtoend/testdata/duplicate_go_names/query_constant/stderr.txt new file mode 100644 index 0000000000..1a9b5f80b5 --- /dev/null +++ b/internal/endtoend/testdata/duplicate_go_names/query_constant/stderr.txt @@ -0,0 +1,2 @@ +# package +error generating code: query constant name conflicts with enum name: Foo diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/db.go b/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/db.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/models.go b/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/models.go index 5e04c3bea4..7a8d049ca3 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/models.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/query.sql.go b/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/query.sql.go index 5770a261d9..5018df0e2a 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/models.go index 5e04c3bea4..7a8d049ca3 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/query.sql.go index 2c74224c0f..ac9cb5cc66 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/models.go index 67af9a1db8..3e61e3751a 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/query.sql.go index 2c74224c0f..ac9cb5cc66 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/models.go index 5e04c3bea4..7a8d049ca3 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/query.sql.go index 5770a261d9..5018df0e2a 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/db.go b/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/db.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/models.go b/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/models.go index 1a8b9499ce..6adfc71ef9 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/models.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/query.sql.go b/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/query.sql.go index 5770a261d9..5018df0e2a 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_db_tags/mysql/go/db.go b/internal/endtoend/testdata/emit_db_tags/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/emit_db_tags/mysql/go/db.go +++ b/internal/endtoend/testdata/emit_db_tags/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_db_tags/mysql/go/models.go b/internal/endtoend/testdata/emit_db_tags/mysql/go/models.go index 964a80dafe..7b7052a133 100644 --- a/internal/endtoend/testdata/emit_db_tags/mysql/go/models.go +++ b/internal/endtoend/testdata/emit_db_tags/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_db_tags/mysql/go/query.sql.go b/internal/endtoend/testdata/emit_db_tags/mysql/go/query.sql.go index 5770a261d9..5018df0e2a 100644 --- a/internal/endtoend/testdata/emit_db_tags/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_tags/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/models.go index 964a80dafe..7b7052a133 100644 --- a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/query.sql.go index 2c74224c0f..ac9cb5cc66 100644 --- a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/models.go index 4cc4423728..7abf837c7d 100644 --- a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/query.sql.go index 2c74224c0f..ac9cb5cc66 100644 --- a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/models.go index 964a80dafe..7b7052a133 100644 --- a/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/query.sql.go index 5770a261d9..5018df0e2a 100644 --- a/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_db_tags/sqlite/go/db.go b/internal/endtoend/testdata/emit_db_tags/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/emit_db_tags/sqlite/go/db.go +++ b/internal/endtoend/testdata/emit_db_tags/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_db_tags/sqlite/go/models.go b/internal/endtoend/testdata/emit_db_tags/sqlite/go/models.go index 9926af7772..7dabd95332 100644 --- a/internal/endtoend/testdata/emit_db_tags/sqlite/go/models.go +++ b/internal/endtoend/testdata/emit_db_tags/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_db_tags/sqlite/go/query.sql.go b/internal/endtoend/testdata/emit_db_tags/sqlite/go/query.sql.go index 5770a261d9..5018df0e2a 100644 --- a/internal/endtoend/testdata/emit_db_tags/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_tags/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/db.go b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/models.go b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/query.sql.go index 3431141a4d..df99bb1722 100644 --- a/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_empty_slices/pgx/v4/query.sql b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/query.sql index 68d61ce7e9..af1f130f18 100644 --- a/internal/endtoend/testdata/emit_empty_slices/pgx/v4/query.sql +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE bar (id serial not null); - -- name: ListBar :many SELECT * FROM bar; diff --git a/internal/endtoend/testdata/emit_empty_slices/pgx/v4/schema.sql b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/emit_empty_slices/pgx/v4/sqlc.json b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/sqlc.json index de2a1c22d5..d3e0569d0f 100644 --- a/internal/endtoend/testdata/emit_empty_slices/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_empty_slices": true } diff --git a/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/db.go b/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/models.go b/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/query.sql.go index 3431141a4d..df99bb1722 100644 --- a/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_empty_slices/pgx/v5/query.sql b/internal/endtoend/testdata/emit_empty_slices/pgx/v5/query.sql index 68d61ce7e9..af1f130f18 100644 --- a/internal/endtoend/testdata/emit_empty_slices/pgx/v5/query.sql +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v5/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE bar (id serial not null); - -- name: ListBar :many SELECT * FROM bar; diff --git a/internal/endtoend/testdata/emit_empty_slices/pgx/v5/schema.sql b/internal/endtoend/testdata/emit_empty_slices/pgx/v5/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/emit_empty_slices/pgx/v5/sqlc.json b/internal/endtoend/testdata/emit_empty_slices/pgx/v5/sqlc.json index 6d23fb3337..ed890d325a 100644 --- a/internal/endtoend/testdata/emit_empty_slices/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_empty_slices": true } diff --git a/internal/endtoend/testdata/emit_empty_slices/stdlib/go/db.go b/internal/endtoend/testdata/emit_empty_slices/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/emit_empty_slices/stdlib/go/db.go +++ b/internal/endtoend/testdata/emit_empty_slices/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_empty_slices/stdlib/go/models.go b/internal/endtoend/testdata/emit_empty_slices/stdlib/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/emit_empty_slices/stdlib/go/models.go +++ b/internal/endtoend/testdata/emit_empty_slices/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/emit_empty_slices/stdlib/go/query.sql.go b/internal/endtoend/testdata/emit_empty_slices/stdlib/go/query.sql.go index b52125c455..24ca1da9c1 100644 --- a/internal/endtoend/testdata/emit_empty_slices/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/emit_empty_slices/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_empty_slices/stdlib/query.sql b/internal/endtoend/testdata/emit_empty_slices/stdlib/query.sql index 68d61ce7e9..af1f130f18 100644 --- a/internal/endtoend/testdata/emit_empty_slices/stdlib/query.sql +++ b/internal/endtoend/testdata/emit_empty_slices/stdlib/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE bar (id serial not null); - -- name: ListBar :many SELECT * FROM bar; diff --git a/internal/endtoend/testdata/emit_empty_slices/stdlib/schema.sql b/internal/endtoend/testdata/emit_empty_slices/stdlib/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/emit_empty_slices/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/emit_empty_slices/stdlib/sqlc.json b/internal/endtoend/testdata/emit_empty_slices/stdlib/sqlc.json index c906b4eeb7..b496f6a68d 100644 --- a/internal/endtoend/testdata/emit_empty_slices/stdlib/sqlc.json +++ b/internal/endtoend/testdata/emit_empty_slices/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_empty_slices": true } diff --git a/internal/endtoend/testdata/emit_enum_valid_and_values/go/db.go b/internal/endtoend/testdata/emit_enum_valid_and_values/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/emit_enum_valid_and_values/go/db.go +++ b/internal/endtoend/testdata/emit_enum_valid_and_values/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_enum_valid_and_values/go/models.go b/internal/endtoend/testdata/emit_enum_valid_and_values/go/models.go index b2a1a6f78e..9a5c991421 100644 --- a/internal/endtoend/testdata/emit_enum_valid_and_values/go/models.go +++ b/internal/endtoend/testdata/emit_enum_valid_and_values/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_enum_valid_and_values/go/query.sql.go b/internal/endtoend/testdata/emit_enum_valid_and_values/go/query.sql.go index 531548fbb1..30a1622132 100644 --- a/internal/endtoend/testdata/emit_enum_valid_and_values/go/query.sql.go +++ b/internal/endtoend/testdata/emit_enum_valid_and_values/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_enum_valid_and_values/query.sql b/internal/endtoend/testdata/emit_enum_valid_and_values/query.sql index 4828b5a815..a8211d0edb 100644 --- a/internal/endtoend/testdata/emit_enum_valid_and_values/query.sql +++ b/internal/endtoend/testdata/emit_enum_valid_and_values/query.sql @@ -1,7 +1,3 @@ -CREATE TYPE ip_protocol AS enum ('tcp', 'ip', 'icmp'); - -CREATE TABLE bar_old (id_old serial not null, ip_old ip_protocol NOT NULL); - -- name: ListFoo :many SELECT id_old as foo_old, id_old as baz_old FROM bar_old diff --git a/internal/endtoend/testdata/emit_enum_valid_and_values/schema.sql b/internal/endtoend/testdata/emit_enum_valid_and_values/schema.sql new file mode 100644 index 0000000000..85cb7d33fb --- /dev/null +++ b/internal/endtoend/testdata/emit_enum_valid_and_values/schema.sql @@ -0,0 +1,4 @@ +CREATE TYPE ip_protocol AS enum ('tcp', 'ip', 'icmp'); + +CREATE TABLE bar_old (id_old serial not null, ip_old ip_protocol NOT NULL); + diff --git a/internal/endtoend/testdata/emit_enum_valid_and_values/sqlc.json b/internal/endtoend/testdata/emit_enum_valid_and_values/sqlc.json index 740c12c5e5..ffa7377573 100644 --- a/internal/endtoend/testdata/emit_enum_valid_and_values/sqlc.json +++ b/internal/endtoend/testdata/emit_enum_valid_and_values/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_enum_valid_method": true, "emit_all_enum_values": true diff --git a/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/db.go b/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/models.go b/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/query.sql.go index c21df985c1..934bf69c13 100644 --- a/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_exported_queries/pgx/v4/query.sql b/internal/endtoend/testdata/emit_exported_queries/pgx/v4/query.sql index 0c0ecfcd8b..7591d3bd4e 100644 --- a/internal/endtoend/testdata/emit_exported_queries/pgx/v4/query.sql +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v4/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE bar (id serial not null); - -- name: UpdateBarID :exec UPDATE bar SET id = $1 WHERE id = $2; diff --git a/internal/endtoend/testdata/emit_exported_queries/pgx/v4/schema.sql b/internal/endtoend/testdata/emit_exported_queries/pgx/v4/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/emit_exported_queries/pgx/v4/sqlc.json b/internal/endtoend/testdata/emit_exported_queries/pgx/v4/sqlc.json index 5db6cc08a3..d0002132c5 100644 --- a/internal/endtoend/testdata/emit_exported_queries/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_exported_queries": true } diff --git a/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/db.go b/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/models.go b/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/query.sql.go index c21df985c1..934bf69c13 100644 --- a/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_exported_queries/pgx/v5/query.sql b/internal/endtoend/testdata/emit_exported_queries/pgx/v5/query.sql index 0c0ecfcd8b..7591d3bd4e 100644 --- a/internal/endtoend/testdata/emit_exported_queries/pgx/v5/query.sql +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v5/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE bar (id serial not null); - -- name: UpdateBarID :exec UPDATE bar SET id = $1 WHERE id = $2; diff --git a/internal/endtoend/testdata/emit_exported_queries/pgx/v5/schema.sql b/internal/endtoend/testdata/emit_exported_queries/pgx/v5/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/emit_exported_queries/pgx/v5/sqlc.json b/internal/endtoend/testdata/emit_exported_queries/pgx/v5/sqlc.json index d94319cb19..22064cf9de 100644 --- a/internal/endtoend/testdata/emit_exported_queries/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_exported_queries": true } diff --git a/internal/endtoend/testdata/emit_exported_queries/stdlib/go/db.go b/internal/endtoend/testdata/emit_exported_queries/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/emit_exported_queries/stdlib/go/db.go +++ b/internal/endtoend/testdata/emit_exported_queries/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_exported_queries/stdlib/go/models.go b/internal/endtoend/testdata/emit_exported_queries/stdlib/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/emit_exported_queries/stdlib/go/models.go +++ b/internal/endtoend/testdata/emit_exported_queries/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/emit_exported_queries/stdlib/go/query.sql.go b/internal/endtoend/testdata/emit_exported_queries/stdlib/go/query.sql.go index 3dba1298f5..4325490a42 100644 --- a/internal/endtoend/testdata/emit_exported_queries/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/emit_exported_queries/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_exported_queries/stdlib/query.sql b/internal/endtoend/testdata/emit_exported_queries/stdlib/query.sql index 0c0ecfcd8b..7591d3bd4e 100644 --- a/internal/endtoend/testdata/emit_exported_queries/stdlib/query.sql +++ b/internal/endtoend/testdata/emit_exported_queries/stdlib/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE bar (id serial not null); - -- name: UpdateBarID :exec UPDATE bar SET id = $1 WHERE id = $2; diff --git a/internal/endtoend/testdata/emit_exported_queries/stdlib/schema.sql b/internal/endtoend/testdata/emit_exported_queries/stdlib/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/emit_exported_queries/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/emit_exported_queries/stdlib/sqlc.json b/internal/endtoend/testdata/emit_exported_queries/stdlib/sqlc.json index 6be5bf1b03..24db62ec28 100644 --- a/internal/endtoend/testdata/emit_exported_queries/stdlib/sqlc.json +++ b/internal/endtoend/testdata/emit_exported_queries/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_exported_queries": true } diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/db.go b/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/db.go index 388a75dae3..44139faf54 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/db.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/models.go b/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/models.go index 41d5cb689a..f5668bd976 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/models.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/query.sql.go b/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/query.sql.go index 767b1994be..a710fa5c85 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/db.go index baa9266939..7599fccb42 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/models.go index 41d5cb689a..f5668bd976 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/query.sql.go index f83fbdf078..611c1e5874 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/db.go index 378f123111..166695c170 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/models.go index 98a6c710c0..f68e9f60b9 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/query.sql.go index f83fbdf078..611c1e5874 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/db.go index 388a75dae3..44139faf54 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/models.go index 41d5cb689a..f5668bd976 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/query.sql.go index 767b1994be..a710fa5c85 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/db.go b/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/db.go index 388a75dae3..44139faf54 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/db.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/models.go b/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/models.go index 8bc479df7d..dfbb4f7e0b 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/models.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/query.sql.go b/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/query.sql.go index 767b1994be..a710fa5c85 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/go/db.go b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/go/db.go index 819b76a2d8..4e47262b7d 100644 --- a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package datatype diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/go/models.go b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/go/models.go index 2edba60558..70b1ef30f7 100644 --- a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package datatype diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/go/query.sql.go new file mode 100644 index 0000000000..3a1b6bccec --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package datatype + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRow(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/sql/query.sql b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/sql/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/sql/query.sql +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/sql/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/go/db.go b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/go/db.go index 628fe9c96b..2853d5f77e 100644 --- a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package datatype diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/go/models.go b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/go/models.go index 249f97e31f..deab99cd28 100644 --- a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package datatype diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/go/query.sql.go new file mode 100644 index 0000000000..3a1b6bccec --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package datatype + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRow(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/sql/query.sql b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/sql/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/sql/query.sql +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/sql/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/go/db.go b/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/go/db.go new file mode 100644 index 0000000000..0a639a6476 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package datatype + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/go/models.go b/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/go/models.go new file mode 100644 index 0000000000..2d52f36770 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/go/models.go @@ -0,0 +1,27 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package datatype + +import ( + "time" +) + +type DtType struct { + A *int64 + B *float64 + C *bool + D *time.Time + E *string + F *float64 +} + +type DtTypesNotNull struct { + A int64 + B float64 + C bool + D time.Time + E string + F float64 +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/go/query.sql.go b/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/go/query.sql.go new file mode 100644 index 0000000000..fa36be67e6 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package datatype + +import ( + "context" +) + +const noop = `-- name: Noop :one +SELECT 1 +` + +func (q *Queries) Noop(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, noop) + var column_1 int64 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/sql/query.sql b/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/sql/query.sql new file mode 100644 index 0000000000..d32220c3d5 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/sql/query.sql @@ -0,0 +1,2 @@ +-- name: Noop :one +SELECT 1; diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/sql/types.sql b/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/sql/types.sql new file mode 100644 index 0000000000..eb55c80eda --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/sql/types.sql @@ -0,0 +1,18 @@ + +CREATE TABLE dt_types ( + a int, + b real, + c bool, + d date, + e text, + f numeric +); + +CREATE TABLE dt_types_not_null ( + a int NOT NULL, + b real NOT NULL, + c bool NOT NULL, + d date NOT NULL, + e text NOT NULL, + f numeric NOT NULL +); diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/sqlc.json b/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/sqlc.json new file mode 100644 index 0000000000..9b8d7693bc --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "datatype", + "schema": "sql/types.sql", + "queries": "sql/query.sql", + "emit_pointers_for_null_types": true + } + ] +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/go/db.go b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/go/db.go index f280f77116..0a639a6476 100644 --- a/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/go/db.go +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package datatype diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/go/models.go b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/go/models.go index c9f87be871..691793cbdd 100644 --- a/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/go/models.go +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package datatype diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/go/query.sql.go b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/go/query.sql.go new file mode 100644 index 0000000000..4720927d0a --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package datatype + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/sql/query.sql b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/sql/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/sql/query.sql +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/sql/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/emit_pydantic_models/postgresql/models.py b/internal/endtoend/testdata/emit_pydantic_models/postgresql/models.py deleted file mode 100644 index 2b1b5abc61..0000000000 --- a/internal/endtoend/testdata/emit_pydantic_models/postgresql/models.py +++ /dev/null @@ -1,11 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -import pydantic -from typing import Optional - - -class Author(pydantic.BaseModel): - id: int - name: str - bio: Optional[str] diff --git a/internal/endtoend/testdata/emit_pydantic_models/postgresql/query.py b/internal/endtoend/testdata/emit_pydantic_models/postgresql/query.py deleted file mode 100644 index 5a108e6530..0000000000 --- a/internal/endtoend/testdata/emit_pydantic_models/postgresql/query.py +++ /dev/null @@ -1,112 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -# source: query.sql -from typing import AsyncIterator, Iterator, Optional - -import sqlalchemy -import sqlalchemy.ext.asyncio - -from postgresql import models - - -CREATE_AUTHOR = """-- name: create_author \\:one -INSERT INTO authors ( - name, bio -) VALUES ( - :p1, :p2 -) -RETURNING id, name, bio -""" - - -DELETE_AUTHOR = """-- name: delete_author \\:exec -DELETE FROM authors -WHERE id = :p1 -""" - - -GET_AUTHOR = """-- name: get_author \\:one -SELECT id, name, bio FROM authors -WHERE id = :p1 LIMIT 1 -""" - - -LIST_AUTHORS = """-- name: list_authors \\:many -SELECT id, name, bio FROM authors -ORDER BY name -""" - - -class Querier: - def __init__(self, conn: sqlalchemy.engine.Connection): - self._conn = conn - - def create_author(self, *, name: str, bio: Optional[str]) -> Optional[models.Author]: - row = self._conn.execute(sqlalchemy.text(CREATE_AUTHOR), {"p1": name, "p2": bio}).first() - if row is None: - return None - return models.Author( - id=row[0], - name=row[1], - bio=row[2], - ) - - def delete_author(self, *, id: int) -> None: - self._conn.execute(sqlalchemy.text(DELETE_AUTHOR), {"p1": id}) - - def get_author(self, *, id: int) -> Optional[models.Author]: - row = self._conn.execute(sqlalchemy.text(GET_AUTHOR), {"p1": id}).first() - if row is None: - return None - return models.Author( - id=row[0], - name=row[1], - bio=row[2], - ) - - def list_authors(self) -> Iterator[models.Author]: - result = self._conn.execute(sqlalchemy.text(LIST_AUTHORS)) - for row in result: - yield models.Author( - id=row[0], - name=row[1], - bio=row[2], - ) - - -class AsyncQuerier: - def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection): - self._conn = conn - - async def create_author(self, *, name: str, bio: Optional[str]) -> Optional[models.Author]: - row = (await self._conn.execute(sqlalchemy.text(CREATE_AUTHOR), {"p1": name, "p2": bio})).first() - if row is None: - return None - return models.Author( - id=row[0], - name=row[1], - bio=row[2], - ) - - async def delete_author(self, *, id: int) -> None: - await self._conn.execute(sqlalchemy.text(DELETE_AUTHOR), {"p1": id}) - - async def get_author(self, *, id: int) -> Optional[models.Author]: - row = (await self._conn.execute(sqlalchemy.text(GET_AUTHOR), {"p1": id})).first() - if row is None: - return None - return models.Author( - id=row[0], - name=row[1], - bio=row[2], - ) - - async def list_authors(self) -> AsyncIterator[models.Author]: - result = await self._conn.stream(sqlalchemy.text(LIST_AUTHORS)) - async for row in result: - yield models.Author( - id=row[0], - name=row[1], - bio=row[2], - ) diff --git a/internal/endtoend/testdata/emit_pydantic_models/sqlc.json b/internal/endtoend/testdata/emit_pydantic_models/sqlc.json deleted file mode 100644 index 65ca70df70..0000000000 --- a/internal/endtoend/testdata/emit_pydantic_models/sqlc.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "version": "2", - "plugins": [ - { - "name": "py", - "wasm": { - "url": "https://downloads.sqlc.dev/plugin/sqlc-gen-python_1.1.0.wasm", - "sha256": "ef58f143a8c116781091441770c7166caaf361dd645f62b8f05f462e9f95c3b2" - } - } - ], - "sql": [ - { - "schema": "postgresql/schema.sql", - "queries": "postgresql/query.sql", - "engine": "postgresql", - "codegen": [ - { - "plugin": "py", - "out": "postgresql", - "options": { - "package": "postgresql", - "emit_sync_querier": true, - "emit_async_querier": true, - "emit_pydantic_models": true - } - } - ] - } - ] -} diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/db.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/db.go +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/models.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/models.go index a1ac02ccf5..530968fc6b 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/models.go +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/querier.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/querier.go index 2d25419317..928b9423af 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/querier.go +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/query.sql.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/query.sql.go index 2ff4a93790..6314b95930 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/query.sql b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/query.sql index 53bbf19f94..06d3554f09 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/query.sql +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (a integer, b integer); - /* name: GetOne :one */ SELECT * FROM foo WHERE a = ? AND b = ? LIMIT 1; diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/schema.sql b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/schema.sql new file mode 100644 index 0000000000..f9244aacac --- /dev/null +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a integer, b integer); + diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/sqlc.json b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/sqlc.json index 5bd5791999..be5b7dd55f 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/sqlc.json +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/sqlc.json @@ -4,7 +4,7 @@ { "name": "querytest", "path": "go", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "engine": "mysql", "emit_interface": true, diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/batch.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/batch.go index 85070addfc..ec7726ffae 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/batch.go +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/batch.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: batch.go package querytest diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/db.go index e28790b2ce..fa88475d3d 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/models.go index a1ac02ccf5..530968fc6b 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/query.sql.go index 2fa53c4382..cbec4e96ee 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/query.sql index 1c60a1dfae..e6321bb867 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (a integer, b integer); - -- name: InsertValues :batchone INSERT INTO foo (a, b) VALUES ($1, $2) diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..f9244aacac --- /dev/null +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a integer, b integer); + diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/sqlc.json index 3ce648806d..2289f94fd5 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/sqlc.json @@ -3,7 +3,7 @@ "sql": [ { "engine": "postgresql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "gen": { "go": { diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/batch.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/batch.go index a4e330d2ce..13d3eb8db6 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/batch.go +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/batch.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: batch.go package querytest diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/db.go index 21d826834a..9a44027379 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/models.go index 81cc7f3173..95e7754cd6 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/query.sql.go index e1176bfd16..d6a2282c78 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/query.sql index 1c60a1dfae..e6321bb867 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (a integer, b integer); - -- name: InsertValues :batchone INSERT INTO foo (a, b) VALUES ($1, $2) diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..f9244aacac --- /dev/null +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a integer, b integer); + diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/sqlc.json index 693beafd11..eac0177ca5 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/sqlc.json @@ -3,7 +3,7 @@ "sql": [ { "engine": "postgresql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "gen": { "go": { diff --git a/internal/endtoend/testdata/emit_sql_as_comment/stdlib/exec.json b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/exec.json new file mode 100644 index 0000000000..9f208fb2df --- /dev/null +++ b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/exec.json @@ -0,0 +1,3 @@ +{ + "os": ["darwin", "linux"] +} diff --git a/internal/endtoend/testdata/emit_sql_as_comment/stdlib/go/db.go b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/emit_sql_as_comment/stdlib/go/models.go b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/go/models.go new file mode 100644 index 0000000000..4f106ee2e3 --- /dev/null +++ b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + ID int32 +} diff --git a/internal/endtoend/testdata/emit_sql_as_comment/stdlib/go/query.sql.go b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/go/query.sql.go new file mode 100644 index 0000000000..3438f222fe --- /dev/null +++ b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/go/query.sql.go @@ -0,0 +1,56 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listBar = `-- name: ListBar :many +SELECT id FROM ( + SELECT id FROM bar +) bar +` + +// Lists all bars +// +// SELECT id FROM ( +// SELECT id FROM bar +// ) bar +func (q *Queries) ListBar(ctx context.Context) ([]int32, error) { + rows, err := q.db.QueryContext(ctx, listBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var id int32 + if err := rows.Scan(&id); err != nil { + return nil, err + } + items = append(items, id) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const removeBar = `-- name: RemoveBar :exec +DELETE FROM bar WHERE id = $1 +` + +// RemoveBar +// +// DELETE FROM bar WHERE id = $1 +func (q *Queries) RemoveBar(ctx context.Context, id int32) error { + _, err := q.db.ExecContext(ctx, removeBar, id) + return err +} diff --git a/internal/endtoend/testdata/emit_sql_as_comment/stdlib/query.sql b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/query.sql new file mode 100644 index 0000000000..e3551898fb --- /dev/null +++ b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/query.sql @@ -0,0 +1,8 @@ +-- name: ListBar :many +-- Lists all bars +SELECT id FROM ( + SELECT * FROM bar +) bar; + +-- name: RemoveBar :exec +DELETE FROM bar WHERE id = $1; diff --git a/internal/endtoend/testdata/emit_sql_as_comment/stdlib/schema.sql b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/schema.sql new file mode 100644 index 0000000000..682614c578 --- /dev/null +++ b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/schema.sql @@ -0,0 +1 @@ +CREATE TABLE bar (id serial not null); diff --git a/internal/endtoend/testdata/emit_sql_as_comment/stdlib/sqlc.json b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/sqlc.json new file mode 100644 index 0000000000..9464b72b2e --- /dev/null +++ b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_sql_as_comment": true + } + ] +} diff --git a/internal/endtoend/testdata/enum/mysql/go/db.go b/internal/endtoend/testdata/enum/mysql/go/db.go index 388a75dae3..44139faf54 100644 --- a/internal/endtoend/testdata/enum/mysql/go/db.go +++ b/internal/endtoend/testdata/enum/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/enum/mysql/go/models.go b/internal/endtoend/testdata/enum/mysql/go/models.go index 5d3a7ddbd0..0ed9bc8b73 100644 --- a/internal/endtoend/testdata/enum/mysql/go/models.go +++ b/internal/endtoend/testdata/enum/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/enum/mysql/go/query.sql.go b/internal/endtoend/testdata/enum/mysql/go/query.sql.go index 67a2e4d1f3..4c95030785 100644 --- a/internal/endtoend/testdata/enum/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/enum/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/db.go index baa9266939..7599fccb42 100644 --- a/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/models.go index 410ea7ff3d..152ecabadd 100644 --- a/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/query.sql.go index 03d3d94c31..66a8db871b 100644 --- a/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -58,18 +58,16 @@ func (q *Queries) GetAll(ctx context.Context, db DBTX) ([]User, error) { const newUser = `-- name: NewUser :exec INSERT INTO users ( - id, first_name, last_name, age, shoe_size, shirt_size ) VALUES -($1, $2, $3, $4, $5, $6) +($1, $2, $3, $4, $5) ` type NewUserParams struct { - ID int32 FirstName string LastName sql.NullString Age int32 @@ -79,7 +77,6 @@ type NewUserParams struct { func (q *Queries) NewUser(ctx context.Context, db DBTX, arg NewUserParams) error { _, err := db.Exec(ctx, newUser, - arg.ID, arg.FirstName, arg.LastName, arg.Age, diff --git a/internal/endtoend/testdata/enum/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/enum/postgresql/pgx/v4/query.sql index 5b7ed159f9..818eafd10d 100644 --- a/internal/endtoend/testdata/enum/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/enum/postgresql/pgx/v4/query.sql @@ -3,14 +3,13 @@ SELECT * FROM users; -- name: NewUser :exec INSERT INTO users ( - id, first_name, last_name, age, shoe_size, shirt_size ) VALUES -($1, $2, $3, $4, $5, $6); +($1, $2, $3, $4, $5); -- name: UpdateSizes :exec UPDATE users diff --git a/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/db.go index 378f123111..166695c170 100644 --- a/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/models.go index ca703414bb..22c9bb0555 100644 --- a/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/query.sql.go index 7e3b425e15..81bde82c79 100644 --- a/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -59,18 +59,16 @@ func (q *Queries) GetAll(ctx context.Context, db DBTX) ([]User, error) { const newUser = `-- name: NewUser :exec INSERT INTO users ( - id, first_name, last_name, age, shoe_size, shirt_size ) VALUES -($1, $2, $3, $4, $5, $6) +($1, $2, $3, $4, $5) ` type NewUserParams struct { - ID int32 FirstName string LastName pgtype.Text Age int32 @@ -80,7 +78,6 @@ type NewUserParams struct { func (q *Queries) NewUser(ctx context.Context, db DBTX, arg NewUserParams) error { _, err := db.Exec(ctx, newUser, - arg.ID, arg.FirstName, arg.LastName, arg.Age, diff --git a/internal/endtoend/testdata/enum/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/enum/postgresql/pgx/v5/query.sql index 5b7ed159f9..1902312c1a 100644 --- a/internal/endtoend/testdata/enum/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/enum/postgresql/pgx/v5/query.sql @@ -3,14 +3,13 @@ SELECT * FROM users; -- name: NewUser :exec INSERT INTO users ( - id, first_name, last_name, age, shoe_size, shirt_size ) VALUES -($1, $2, $3, $4, $5, $6); +($1, $2, $3, $4, $5); -- name: UpdateSizes :exec UPDATE users @@ -19,4 +18,4 @@ WHERE id = $1; -- name: DeleteBySize :exec DELETE FROM users -WHERE shoe_size = $1 AND shirt_size = $2; \ No newline at end of file +WHERE shoe_size = $1 AND shirt_size = $2; diff --git a/internal/endtoend/testdata/enum/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/enum/postgresql/stdlib/go/db.go index 388a75dae3..44139faf54 100644 --- a/internal/endtoend/testdata/enum/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/enum/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/enum/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/enum/postgresql/stdlib/go/models.go index 410ea7ff3d..152ecabadd 100644 --- a/internal/endtoend/testdata/enum/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/enum/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/enum/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/enum/postgresql/stdlib/go/query.sql.go index 037574c405..08e77ed7b7 100644 --- a/internal/endtoend/testdata/enum/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/enum/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -61,18 +61,16 @@ func (q *Queries) GetAll(ctx context.Context, db DBTX) ([]User, error) { const newUser = `-- name: NewUser :exec INSERT INTO users ( - id, first_name, last_name, age, shoe_size, shirt_size ) VALUES -($1, $2, $3, $4, $5, $6) +($1, $2, $3, $4, $5) ` type NewUserParams struct { - ID int32 FirstName string LastName sql.NullString Age int32 @@ -82,7 +80,6 @@ type NewUserParams struct { func (q *Queries) NewUser(ctx context.Context, db DBTX, arg NewUserParams) error { _, err := db.ExecContext(ctx, newUser, - arg.ID, arg.FirstName, arg.LastName, arg.Age, diff --git a/internal/endtoend/testdata/enum/postgresql/stdlib/query.sql b/internal/endtoend/testdata/enum/postgresql/stdlib/query.sql index 5b7ed159f9..1902312c1a 100644 --- a/internal/endtoend/testdata/enum/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/enum/postgresql/stdlib/query.sql @@ -3,14 +3,13 @@ SELECT * FROM users; -- name: NewUser :exec INSERT INTO users ( - id, first_name, last_name, age, shoe_size, shirt_size ) VALUES -($1, $2, $3, $4, $5, $6); +($1, $2, $3, $4, $5); -- name: UpdateSizes :exec UPDATE users @@ -19,4 +18,4 @@ WHERE id = $1; -- name: DeleteBySize :exec DELETE FROM users -WHERE shoe_size = $1 AND shirt_size = $2; \ No newline at end of file +WHERE shoe_size = $1 AND shirt_size = $2; diff --git a/internal/endtoend/testdata/enum_column/issue.md b/internal/endtoend/testdata/enum_column/issue.md new file mode 100644 index 0000000000..e618d6c240 --- /dev/null +++ b/internal/endtoend/testdata/enum_column/issue.md @@ -0,0 +1,3 @@ +https://github.com/sqlc-dev/sqlc/issues/1503 +https://github.com/sqlc-dev/sqlc/issues/2475 + diff --git a/internal/endtoend/testdata/enum_column/mysql/go/db.go b/internal/endtoend/testdata/enum_column/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/enum_column/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/enum_column/mysql/go/models.go b/internal/endtoend/testdata/enum_column/mysql/go/models.go new file mode 100644 index 0000000000..2c8383b687 --- /dev/null +++ b/internal/endtoend/testdata/enum_column/mysql/go/models.go @@ -0,0 +1,271 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type AuthorsAddItem string + +const ( + AuthorsAddItemOk AuthorsAddItem = "ok" + AuthorsAddItemAdded AuthorsAddItem = "added" +) + +func (e *AuthorsAddItem) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = AuthorsAddItem(s) + case string: + *e = AuthorsAddItem(s) + default: + return fmt.Errorf("unsupported scan type for AuthorsAddItem: %T", src) + } + return nil +} + +type NullAuthorsAddItem struct { + AuthorsAddItem AuthorsAddItem + Valid bool // Valid is true if AuthorsAddItem is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullAuthorsAddItem) Scan(value interface{}) error { + if value == nil { + ns.AuthorsAddItem, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.AuthorsAddItem.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullAuthorsAddItem) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.AuthorsAddItem), nil +} + +type AuthorsAdded string + +const ( + AuthorsAddedOk AuthorsAdded = "ok" +) + +func (e *AuthorsAdded) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = AuthorsAdded(s) + case string: + *e = AuthorsAdded(s) + default: + return fmt.Errorf("unsupported scan type for AuthorsAdded: %T", src) + } + return nil +} + +type NullAuthorsAdded struct { + AuthorsAdded AuthorsAdded + Valid bool // Valid is true if AuthorsAdded is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullAuthorsAdded) Scan(value interface{}) error { + if value == nil { + ns.AuthorsAdded, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.AuthorsAdded.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullAuthorsAdded) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.AuthorsAdded), nil +} + +type AuthorsBar string + +const ( + AuthorsBarOk AuthorsBar = "ok" +) + +func (e *AuthorsBar) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = AuthorsBar(s) + case string: + *e = AuthorsBar(s) + default: + return fmt.Errorf("unsupported scan type for AuthorsBar: %T", src) + } + return nil +} + +type NullAuthorsBar struct { + AuthorsBar AuthorsBar + Valid bool // Valid is true if AuthorsBar is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullAuthorsBar) Scan(value interface{}) error { + if value == nil { + ns.AuthorsBar, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.AuthorsBar.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullAuthorsBar) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.AuthorsBar), nil +} + +type AuthorsFoo string + +const ( + AuthorsFooOk AuthorsFoo = "ok" +) + +func (e *AuthorsFoo) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = AuthorsFoo(s) + case string: + *e = AuthorsFoo(s) + default: + return fmt.Errorf("unsupported scan type for AuthorsFoo: %T", src) + } + return nil +} + +type NullAuthorsFoo struct { + AuthorsFoo AuthorsFoo + Valid bool // Valid is true if AuthorsFoo is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullAuthorsFoo) Scan(value interface{}) error { + if value == nil { + ns.AuthorsFoo, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.AuthorsFoo.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullAuthorsFoo) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.AuthorsFoo), nil +} + +type AuthorsRemoveItem string + +const ( + AuthorsRemoveItemOk AuthorsRemoveItem = "ok" +) + +func (e *AuthorsRemoveItem) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = AuthorsRemoveItem(s) + case string: + *e = AuthorsRemoveItem(s) + default: + return fmt.Errorf("unsupported scan type for AuthorsRemoveItem: %T", src) + } + return nil +} + +type NullAuthorsRemoveItem struct { + AuthorsRemoveItem AuthorsRemoveItem + Valid bool // Valid is true if AuthorsRemoveItem is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullAuthorsRemoveItem) Scan(value interface{}) error { + if value == nil { + ns.AuthorsRemoveItem, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.AuthorsRemoveItem.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullAuthorsRemoveItem) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.AuthorsRemoveItem), nil +} + +type BooksFoo string + +const ( + BooksFooOk BooksFoo = "ok" +) + +func (e *BooksFoo) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = BooksFoo(s) + case string: + *e = BooksFoo(s) + default: + return fmt.Errorf("unsupported scan type for BooksFoo: %T", src) + } + return nil +} + +type NullBooksFoo struct { + BooksFoo BooksFoo + Valid bool // Valid is true if BooksFoo is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullBooksFoo) Scan(value interface{}) error { + if value == nil { + ns.BooksFoo, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.BooksFoo.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullBooksFoo) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.BooksFoo), nil +} + +type Author struct { + ID int64 + Foo AuthorsFoo + Bar AuthorsBar + Added AuthorsAdded + AddItem AuthorsAddItem + RemoveItem AuthorsRemoveItem +} + +type Book struct { + ID int64 + Foo BooksFoo +} diff --git a/internal/endtoend/testdata/enum_column/mysql/go/query.sql.go b/internal/endtoend/testdata/enum_column/mysql/go/query.sql.go new file mode 100644 index 0000000000..3fc35608e0 --- /dev/null +++ b/internal/endtoend/testdata/enum_column/mysql/go/query.sql.go @@ -0,0 +1,71 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listAuthors = `-- name: ListAuthors :many +SELECT id, foo, bar, added, add_item, remove_item FROM authors +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan( + &i.ID, + &i.Foo, + &i.Bar, + &i.Added, + &i.AddItem, + &i.RemoveItem, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listBooks = `-- name: ListBooks :many +SELECT id, foo FROM books +` + +func (q *Queries) ListBooks(ctx context.Context) ([]Book, error) { + rows, err := q.db.QueryContext(ctx, listBooks) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Book + for rows.Next() { + var i Book + if err := rows.Scan(&i.ID, &i.Foo); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/enum_column/mysql/query.sql b/internal/endtoend/testdata/enum_column/mysql/query.sql new file mode 100644 index 0000000000..893743b53a --- /dev/null +++ b/internal/endtoend/testdata/enum_column/mysql/query.sql @@ -0,0 +1,5 @@ +/* name: ListAuthors :many */ +SELECT * FROM authors; + +/* name: ListBooks :many */ +SELECT * FROM books; diff --git a/internal/endtoend/testdata/enum_column/mysql/schema.sql b/internal/endtoend/testdata/enum_column/mysql/schema.sql new file mode 100644 index 0000000000..82771c1951 --- /dev/null +++ b/internal/endtoend/testdata/enum_column/mysql/schema.sql @@ -0,0 +1,39 @@ +CREATE TABLE authors ( + id BIGINT PRIMARY KEY, + foo ENUM("ok") DEFAULT "ok" NOT NULL, + renamed ENUM("ok") DEFAULT "ok" NOT NULL, + removed ENUM("ok") DEFAULT "ok" NOT NULL, + add_item ENUM("ok") DEFAULT "ok" NOT NULL, + remove_item ENUM("ok", "removed") DEFAULT "ok" NOT NULL +); + +CREATE TABLE renamed ( + id BIGINT PRIMARY KEY, + foo ENUM("ok") DEFAULT "ok" NOT NULL +); + +CREATE TABLE removed ( + id BIGINT PRIMARY KEY, + foo ENUM("ok") DEFAULT "ok" NOT NULL +); + +/* Rename column */ +ALTER TABLE authors RENAME COLUMN renamed TO bar; + +/* Drop column */ +ALTER TABLE authors DROP COLUMN removed; + +/* Add column */ +ALTER TABLE authors ADD COLUMN added ENUM("ok") DEFAULT "ok" NOT NULL; + +/* Add enum values */ +ALTER TABLE authors MODIFY add_item ENUM("ok", "added") DEFAULT "ok" NOT NULL; + +/* Remove enum values */ +ALTER TABLE authors MODIFY remove_item ENUM("ok") DEFAULT "ok" NOT NULL; + +/* Drop table */ +DROP TABLE removed; + +/* Rename table */ +ALTER TABLE renamed RENAME TO books; diff --git a/internal/endtoend/testdata/enum_column/mysql/sqlc.yaml b/internal/endtoend/testdata/enum_column/mysql/sqlc.yaml new file mode 100644 index 0000000000..b843ef55e3 --- /dev/null +++ b/internal/endtoend/testdata/enum_column/mysql/sqlc.yaml @@ -0,0 +1,9 @@ +version: "2" +sql: + - engine: "mysql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" diff --git a/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/db.go index 3d2b5bf3a3..cd5bbb8e08 100644 --- a/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/models.go index 34ca7919a9..09436fd2e7 100644 --- a/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/querier.go b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/querier.go index c020c0210d..4df64b6fb2 100644 --- a/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/querier.go +++ b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/query.sql.go index 740eacec8e..61d2425c01 100644 --- a/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package db diff --git a/internal/endtoend/testdata/exec_create_table/mysql/db/db.go b/internal/endtoend/testdata/exec_create_table/mysql/db/db.go new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/mysql/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/exec_create_table/mysql/db/models.go b/internal/endtoend/testdata/exec_create_table/mysql/db/models.go new file mode 100644 index 0000000000..32099017df --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/mysql/db/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db diff --git a/internal/endtoend/testdata/exec_create_table/mysql/db/mysql.query.sql.go b/internal/endtoend/testdata/exec_create_table/mysql/db/mysql.query.sql.go new file mode 100644 index 0000000000..11947091b9 --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/mysql/db/mysql.query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: mysql.query.sql + +package db + +import ( + "context" +) + +const createTable = `-- name: CreateTable :exec +CREATE TABLE test (id INTEGER NOT NULL) +` + +func (q *Queries) CreateTable(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, createTable) + return err +} diff --git a/internal/endtoend/testdata/exec_create_table/mysql/mysql.query.sql b/internal/endtoend/testdata/exec_create_table/mysql/mysql.query.sql new file mode 100644 index 0000000000..0a92ebb9cb --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/mysql/mysql.query.sql @@ -0,0 +1,2 @@ +-- name: CreateTable :exec +CREATE TABLE test (id INTEGER NOT NULL); diff --git a/examples/python/src/tests/__init__.py b/internal/endtoend/testdata/exec_create_table/mysql/mysql.schema.sql similarity index 100% rename from examples/python/src/tests/__init__.py rename to internal/endtoend/testdata/exec_create_table/mysql/mysql.schema.sql diff --git a/internal/endtoend/testdata/exec_create_table/mysql/sqlc.yaml b/internal/endtoend/testdata/exec_create_table/mysql/sqlc.yaml new file mode 100644 index 0000000000..bd888aabfc --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/mysql/sqlc.yaml @@ -0,0 +1,8 @@ +version: 2 +sql: +- queries: mysql.query.sql + schema: mysql.schema.sql + engine: mysql + gen: + go: + out: db diff --git a/internal/endtoend/testdata/exec_create_table/postgresql/db/db.go b/internal/endtoend/testdata/exec_create_table/postgresql/db/db.go new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/postgresql/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/exec_create_table/postgresql/db/models.go b/internal/endtoend/testdata/exec_create_table/postgresql/db/models.go new file mode 100644 index 0000000000..32099017df --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/postgresql/db/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db diff --git a/internal/endtoend/testdata/exec_create_table/postgresql/db/postgresql.query.sql.go b/internal/endtoend/testdata/exec_create_table/postgresql/db/postgresql.query.sql.go new file mode 100644 index 0000000000..3ecce84aa4 --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/postgresql/db/postgresql.query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: postgresql.query.sql + +package db + +import ( + "context" +) + +const createTable = `-- name: CreateTable :exec +CREATE TABLE test (id INTEGER NOT NULL) +` + +func (q *Queries) CreateTable(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, createTable) + return err +} diff --git a/internal/endtoend/testdata/exec_create_table/postgresql/postgresql.query.sql b/internal/endtoend/testdata/exec_create_table/postgresql/postgresql.query.sql new file mode 100644 index 0000000000..0a92ebb9cb --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/postgresql/postgresql.query.sql @@ -0,0 +1,2 @@ +-- name: CreateTable :exec +CREATE TABLE test (id INTEGER NOT NULL); diff --git a/internal/endtoend/testdata/emit_pydantic_models/postgresql/__init__.py b/internal/endtoend/testdata/exec_create_table/postgresql/postgresql.schema.sql similarity index 100% rename from internal/endtoend/testdata/emit_pydantic_models/postgresql/__init__.py rename to internal/endtoend/testdata/exec_create_table/postgresql/postgresql.schema.sql diff --git a/internal/endtoend/testdata/exec_create_table/postgresql/sqlc.yaml b/internal/endtoend/testdata/exec_create_table/postgresql/sqlc.yaml new file mode 100644 index 0000000000..6a89eb2179 --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/postgresql/sqlc.yaml @@ -0,0 +1,9 @@ +version: 2 +sql: +- queries: postgresql.query.sql + schema: postgresql.schema.sql + engine: postgresql + gen: + go: + out: db + diff --git a/internal/endtoend/testdata/exec_create_table/sqlite/db/db.go b/internal/endtoend/testdata/exec_create_table/sqlite/db/db.go new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/sqlite/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/exec_create_table/sqlite/db/models.go b/internal/endtoend/testdata/exec_create_table/sqlite/db/models.go new file mode 100644 index 0000000000..32099017df --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/sqlite/db/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db diff --git a/internal/endtoend/testdata/exec_create_table/sqlite/db/sqlite.query.sql.go b/internal/endtoend/testdata/exec_create_table/sqlite/db/sqlite.query.sql.go new file mode 100644 index 0000000000..17ffec74e7 --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/sqlite/db/sqlite.query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: sqlite.query.sql + +package db + +import ( + "context" +) + +const createTable = `-- name: CreateTable :exec +CREATE TABLE test (id INTEGER NOT NULL) +` + +func (q *Queries) CreateTable(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, createTable) + return err +} diff --git a/internal/endtoend/testdata/exec_create_table/sqlite/sqlc.yaml b/internal/endtoend/testdata/exec_create_table/sqlite/sqlc.yaml new file mode 100644 index 0000000000..bf2e6024b6 --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/sqlite/sqlc.yaml @@ -0,0 +1,8 @@ +version: 2 +sql: +- queries: sqlite.query.sql + schema: sqlite.schema.sql + engine: sqlite + gen: + go: + out: db diff --git a/internal/endtoend/testdata/exec_create_table/sqlite/sqlite.query.sql b/internal/endtoend/testdata/exec_create_table/sqlite/sqlite.query.sql new file mode 100644 index 0000000000..0a92ebb9cb --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/sqlite/sqlite.query.sql @@ -0,0 +1,2 @@ +-- name: CreateTable :exec +CREATE TABLE test (id INTEGER NOT NULL); diff --git a/internal/endtoend/testdata/exec_create_table/sqlite/sqlite.schema.sql b/internal/endtoend/testdata/exec_create_table/sqlite/sqlite.schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/exec_imports/pgx/v4/go/db.go b/internal/endtoend/testdata/exec_imports/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/exec_imports/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/exec_imports/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/exec_imports/pgx/v4/go/models.go b/internal/endtoend/testdata/exec_imports/pgx/v4/go/models.go index acd1d55f3c..aa72c20020 100644 --- a/internal/endtoend/testdata/exec_imports/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/exec_imports/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/exec_imports/pgx/v4/go/querier.go b/internal/endtoend/testdata/exec_imports/pgx/v4/go/querier.go index 70c7cdc62c..4ac6134bc7 100644 --- a/internal/endtoend/testdata/exec_imports/pgx/v4/go/querier.go +++ b/internal/endtoend/testdata/exec_imports/pgx/v4/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/exec_imports/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/exec_imports/pgx/v4/go/query.sql.go index ede1045539..9b47f5f368 100644 --- a/internal/endtoend/testdata/exec_imports/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/exec_imports/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/exec_imports/pgx/v4/query.sql b/internal/endtoend/testdata/exec_imports/pgx/v4/query.sql index 00b2b7d7f3..b1be28c911 100644 --- a/internal/endtoend/testdata/exec_imports/pgx/v4/query.sql +++ b/internal/endtoend/testdata/exec_imports/pgx/v4/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar int, bars int[] not null); - -- name: Bar :exec SELECT bar FROM foo; diff --git a/internal/endtoend/testdata/exec_imports/pgx/v4/schema.sql b/internal/endtoend/testdata/exec_imports/pgx/v4/schema.sql new file mode 100644 index 0000000000..63886c12da --- /dev/null +++ b/internal/endtoend/testdata/exec_imports/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar int, bars int[] not null); + diff --git a/internal/endtoend/testdata/exec_imports/pgx/v4/sqlc.json b/internal/endtoend/testdata/exec_imports/pgx/v4/sqlc.json index 2ec707567a..e0530db353 100644 --- a/internal/endtoend/testdata/exec_imports/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/exec_imports/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_interface": true } diff --git a/internal/endtoend/testdata/exec_imports/pgx/v5/go/db.go b/internal/endtoend/testdata/exec_imports/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/exec_imports/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/exec_imports/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/exec_imports/pgx/v5/go/models.go b/internal/endtoend/testdata/exec_imports/pgx/v5/go/models.go index 9005553d5a..5dde21524b 100644 --- a/internal/endtoend/testdata/exec_imports/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/exec_imports/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/exec_imports/pgx/v5/go/querier.go b/internal/endtoend/testdata/exec_imports/pgx/v5/go/querier.go index 70c7cdc62c..4ac6134bc7 100644 --- a/internal/endtoend/testdata/exec_imports/pgx/v5/go/querier.go +++ b/internal/endtoend/testdata/exec_imports/pgx/v5/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/exec_imports/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/exec_imports/pgx/v5/go/query.sql.go index ede1045539..9b47f5f368 100644 --- a/internal/endtoend/testdata/exec_imports/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/exec_imports/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/exec_imports/pgx/v5/query.sql b/internal/endtoend/testdata/exec_imports/pgx/v5/query.sql index 00b2b7d7f3..b1be28c911 100644 --- a/internal/endtoend/testdata/exec_imports/pgx/v5/query.sql +++ b/internal/endtoend/testdata/exec_imports/pgx/v5/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar int, bars int[] not null); - -- name: Bar :exec SELECT bar FROM foo; diff --git a/internal/endtoend/testdata/exec_imports/pgx/v5/schema.sql b/internal/endtoend/testdata/exec_imports/pgx/v5/schema.sql new file mode 100644 index 0000000000..63886c12da --- /dev/null +++ b/internal/endtoend/testdata/exec_imports/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar int, bars int[] not null); + diff --git a/internal/endtoend/testdata/exec_imports/pgx/v5/sqlc.json b/internal/endtoend/testdata/exec_imports/pgx/v5/sqlc.json index 170791aa85..007fb8530f 100644 --- a/internal/endtoend/testdata/exec_imports/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/exec_imports/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_interface": true } diff --git a/internal/endtoend/testdata/exec_imports/stdlib/go/db.go b/internal/endtoend/testdata/exec_imports/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/exec_imports/stdlib/go/db.go +++ b/internal/endtoend/testdata/exec_imports/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/exec_imports/stdlib/go/models.go b/internal/endtoend/testdata/exec_imports/stdlib/go/models.go index acd1d55f3c..aa72c20020 100644 --- a/internal/endtoend/testdata/exec_imports/stdlib/go/models.go +++ b/internal/endtoend/testdata/exec_imports/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/exec_imports/stdlib/go/querier.go b/internal/endtoend/testdata/exec_imports/stdlib/go/querier.go index 70c7cdc62c..4ac6134bc7 100644 --- a/internal/endtoend/testdata/exec_imports/stdlib/go/querier.go +++ b/internal/endtoend/testdata/exec_imports/stdlib/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/exec_imports/stdlib/go/query.sql.go b/internal/endtoend/testdata/exec_imports/stdlib/go/query.sql.go index cef76161ad..56f78eddb9 100644 --- a/internal/endtoend/testdata/exec_imports/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/exec_imports/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/exec_imports/stdlib/query.sql b/internal/endtoend/testdata/exec_imports/stdlib/query.sql index 00b2b7d7f3..b1be28c911 100644 --- a/internal/endtoend/testdata/exec_imports/stdlib/query.sql +++ b/internal/endtoend/testdata/exec_imports/stdlib/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar int, bars int[] not null); - -- name: Bar :exec SELECT bar FROM foo; diff --git a/internal/endtoend/testdata/exec_imports/stdlib/schema.sql b/internal/endtoend/testdata/exec_imports/stdlib/schema.sql new file mode 100644 index 0000000000..63886c12da --- /dev/null +++ b/internal/endtoend/testdata/exec_imports/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar int, bars int[] not null); + diff --git a/internal/endtoend/testdata/exec_imports/stdlib/sqlc.json b/internal/endtoend/testdata/exec_imports/stdlib/sqlc.json index b23380237a..49e9851aab 100644 --- a/internal/endtoend/testdata/exec_imports/stdlib/sqlc.json +++ b/internal/endtoend/testdata/exec_imports/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_interface": true } diff --git a/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/db.go b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/db.go +++ b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/models.go b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/models.go +++ b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/querier.go b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/querier.go index 88af887f16..c231878b80 100644 --- a/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/querier.go +++ b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/query.sql.go b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/query.sql.go index 8ad3076d43..ca4d7990ab 100644 --- a/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/query.sql b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/query.sql index a8203f0a78..9a96492c30 100644 --- a/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/query.sql +++ b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE bar (id integer(10) NOT NULL AUTO_INCREMENT PRIMARY KEY); - -- name: InsertBar :execlastid INSERT INTO bar () VALUES (); \ No newline at end of file diff --git a/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/schema.sql b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/schema.sql new file mode 100644 index 0000000000..f314957f7c --- /dev/null +++ b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id integer(10) NOT NULL AUTO_INCREMENT PRIMARY KEY); + diff --git a/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/sqlc.json b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/sqlc.json index b199a32720..536433b1a8 100644 --- a/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/sqlc.json +++ b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "name": "querytest", "engine": "mysql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_interface": true } diff --git a/internal/endtoend/testdata/exec_no_return_struct/issue.md b/internal/endtoend/testdata/exec_no_return_struct/issue.md new file mode 100644 index 0000000000..1184d6e9e3 --- /dev/null +++ b/internal/endtoend/testdata/exec_no_return_struct/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/2970 diff --git a/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/go/db.go b/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/go/models.go b/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..967badc4a9 --- /dev/null +++ b/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Job struct { + TaskName string + LastRun pgtype.Timestamptz +} diff --git a/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..fda09ec9c5 --- /dev/null +++ b/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/go/query.sql.go @@ -0,0 +1,30 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const resetTaskRun = `-- name: ResetTaskRun :exec +UPDATE job +SET last_run = NOW() +FROM ( + SELECT last_run, + task_name + FROM job AS o + WHERE o.task_name = $1 + FOR UPDATE + ) AS old_values +WHERE job.task_name = $1 +RETURNING job.last_run AS this_run, + old_values.last_run AS last_run +` + +func (q *Queries) ResetTaskRun(ctx context.Context, taskName string) error { + _, err := q.db.Exec(ctx, resetTaskRun, taskName) + return err +} diff --git a/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/query.sql b/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/query.sql new file mode 100644 index 0000000000..968ce9f7c8 --- /dev/null +++ b/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/query.sql @@ -0,0 +1,13 @@ +-- name: ResetTaskRun :exec +UPDATE job +SET last_run = NOW() +FROM ( + SELECT last_run, + task_name + FROM job AS o + WHERE o.task_name = $1 + FOR UPDATE + ) AS old_values +WHERE job.task_name = $1 +RETURNING job.last_run AS this_run, + old_values.last_run AS last_run; diff --git a/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/schema.sql b/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..6dd162bed9 --- /dev/null +++ b/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE IF NOT EXISTS job +( + task_name text NOT NULL, + last_run timestamp with time zone DEFAULT now() NOT NULL +); diff --git a/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/db.go b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/db.go +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/models.go b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/models.go +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/querier.go b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/querier.go index 3c79c900bb..6c8ba2785f 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/querier.go +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/query.sql.go b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/query.sql.go index b1510a7166..21bf5b2a97 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/query.sql b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/query.sql index 7f99212a9e..73917782cb 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/query.sql +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE bar (id serial not null); - -- name: DeleteBarByID :execresult DELETE FROM bar WHERE id = $1; diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/schema.sql b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/sqlc.json b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/sqlc.json index 2ec707567a..e0530db353 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_interface": true } diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/db.go b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/db.go +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/models.go b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/models.go +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/querier.go b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/querier.go index a5ed7f17be..835fc35107 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/querier.go +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/query.sql.go b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/query.sql.go index c5bb89d766..4d9b85fd50 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/query.sql b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/query.sql index 7f99212a9e..73917782cb 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/query.sql +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE bar (id serial not null); - -- name: DeleteBarByID :execresult DELETE FROM bar WHERE id = $1; diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/schema.sql b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/sqlc.json b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/sqlc.json index 170791aa85..007fb8530f 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_interface": true } diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/db.go b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/db.go +++ b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/models.go b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/models.go +++ b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/querier.go b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/querier.go index 91db35baa4..e5fe52ff35 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/querier.go +++ b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/query.sql.go b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/query.sql.go index 534465a786..166b0fa972 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/query.sql b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/query.sql index 7f99212a9e..73917782cb 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/query.sql +++ b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE bar (id serial not null); - -- name: DeleteBarByID :execresult DELETE FROM bar WHERE id = $1; diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/schema.sql b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/sqlc.json b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/sqlc.json index b23380237a..49e9851aab 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/sqlc.json +++ b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_interface": true } diff --git a/internal/endtoend/testdata/exec_result/python_postgresql/python/models.py b/internal/endtoend/testdata/exec_result/python_postgresql/python/models.py deleted file mode 100644 index b8a9932385..0000000000 --- a/internal/endtoend/testdata/exec_result/python_postgresql/python/models.py +++ /dev/null @@ -1,9 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -import dataclasses - - -@dataclasses.dataclass() -class Bar: - id: int diff --git a/internal/endtoend/testdata/exec_result/python_postgresql/python/query.py b/internal/endtoend/testdata/exec_result/python_postgresql/python/query.py deleted file mode 100644 index 57901492f4..0000000000 --- a/internal/endtoend/testdata/exec_result/python_postgresql/python/query.py +++ /dev/null @@ -1,29 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -# source: query.sql -import sqlalchemy -import sqlalchemy.ext.asyncio - -from querytest import models - - -DELETE_BAR_BY_ID = """-- name: delete_bar_by_id \\:execresult -DELETE FROM bar WHERE id = :p1 -""" - - -class Querier: - def __init__(self, conn: sqlalchemy.engine.Connection): - self._conn = conn - - def delete_bar_by_id(self, *, id: int) -> sqlalchemy.engine.Result: - return self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID), {"p1": id}) - - -class AsyncQuerier: - def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection): - self._conn = conn - - async def delete_bar_by_id(self, *, id: int) -> sqlalchemy.engine.Result: - return await self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID), {"p1": id}) diff --git a/internal/endtoend/testdata/exec_result/python_postgresql/query.sql b/internal/endtoend/testdata/exec_result/python_postgresql/query.sql deleted file mode 100644 index 7f99212a9e..0000000000 --- a/internal/endtoend/testdata/exec_result/python_postgresql/query.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE bar (id serial not null); - --- name: DeleteBarByID :execresult -DELETE FROM bar WHERE id = $1; diff --git a/internal/endtoend/testdata/exec_result/python_postgresql/sqlc.json b/internal/endtoend/testdata/exec_result/python_postgresql/sqlc.json deleted file mode 100644 index aa6530cc2b..0000000000 --- a/internal/endtoend/testdata/exec_result/python_postgresql/sqlc.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "version": "2", - "plugins": [ - { - "name": "py", - "wasm": { - "url": "https://downloads.sqlc.dev/plugin/sqlc-gen-python_1.1.0.wasm", - "sha256": "ef58f143a8c116781091441770c7166caaf361dd645f62b8f05f462e9f95c3b2" - } - } - ], - "sql": [ - { - "schema": "query.sql", - "queries": "query.sql", - "engine": "postgresql", - "codegen": [ - { - "plugin": "py", - "out": "python", - "options": { - "package": "querytest", - "emit_sync_querier": true, - "emit_async_querier": true - } - } - ] - } - ] -} diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/db.go b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/db.go +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/models.go b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/models.go +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/querier.go b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/querier.go index 71bbc0ee95..1b50d38666 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/querier.go +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/query.sql.go b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/query.sql.go index 2f3f30560c..5b5976e237 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/query.sql b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/query.sql index 5466ea7e17..94d2d09f90 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/query.sql +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE bar (id serial not null); - -- name: DeleteBarByID :execrows DELETE FROM bar WHERE id = $1; diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/schema.sql b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/sqlc.json b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/sqlc.json index 2ec707567a..e0530db353 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_interface": true } diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/db.go b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/db.go +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/models.go b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/models.go +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/querier.go b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/querier.go index 71bbc0ee95..1b50d38666 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/querier.go +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/query.sql.go b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/query.sql.go index 2f3f30560c..5b5976e237 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/query.sql b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/query.sql index 5466ea7e17..94d2d09f90 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/query.sql +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE bar (id serial not null); - -- name: DeleteBarByID :execrows DELETE FROM bar WHERE id = $1; diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/schema.sql b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/sqlc.json b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/sqlc.json index 170791aa85..007fb8530f 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_interface": true } diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/db.go b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/db.go +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/models.go b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/models.go +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/querier.go b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/querier.go index 71bbc0ee95..1b50d38666 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/querier.go +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/query.sql.go b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/query.sql.go index 72fbfa1921..57dd159fd5 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/query.sql b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/query.sql index 5466ea7e17..94d2d09f90 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/query.sql +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE bar (id serial not null); - -- name: DeleteBarByID :execrows DELETE FROM bar WHERE id = $1; diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/schema.sql b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/sqlc.json b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/sqlc.json index b23380237a..49e9851aab 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/sqlc.json +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_interface": true } diff --git a/internal/endtoend/testdata/exec_rows/python_postgresql/python/models.py b/internal/endtoend/testdata/exec_rows/python_postgresql/python/models.py deleted file mode 100644 index b8a9932385..0000000000 --- a/internal/endtoend/testdata/exec_rows/python_postgresql/python/models.py +++ /dev/null @@ -1,9 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -import dataclasses - - -@dataclasses.dataclass() -class Bar: - id: int diff --git a/internal/endtoend/testdata/exec_rows/python_postgresql/python/query.py b/internal/endtoend/testdata/exec_rows/python_postgresql/python/query.py deleted file mode 100644 index 60447ffe27..0000000000 --- a/internal/endtoend/testdata/exec_rows/python_postgresql/python/query.py +++ /dev/null @@ -1,31 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -# source: query.sql -import sqlalchemy -import sqlalchemy.ext.asyncio - -from querytest import models - - -DELETE_BAR_BY_ID = """-- name: delete_bar_by_id \\:execrows -DELETE FROM bar WHERE id = :p1 -""" - - -class Querier: - def __init__(self, conn: sqlalchemy.engine.Connection): - self._conn = conn - - def delete_bar_by_id(self, *, id: int) -> int: - result = self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID), {"p1": id}) - return result.rowcount - - -class AsyncQuerier: - def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection): - self._conn = conn - - async def delete_bar_by_id(self, *, id: int) -> int: - result = await self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID), {"p1": id}) - return result.rowcount diff --git a/internal/endtoend/testdata/exec_rows/python_postgresql/query.sql b/internal/endtoend/testdata/exec_rows/python_postgresql/query.sql deleted file mode 100644 index 5466ea7e17..0000000000 --- a/internal/endtoend/testdata/exec_rows/python_postgresql/query.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE bar (id serial not null); - --- name: DeleteBarByID :execrows -DELETE FROM bar WHERE id = $1; diff --git a/internal/endtoend/testdata/exec_rows/python_postgresql/sqlc.json b/internal/endtoend/testdata/exec_rows/python_postgresql/sqlc.json deleted file mode 100644 index aa6530cc2b..0000000000 --- a/internal/endtoend/testdata/exec_rows/python_postgresql/sqlc.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "version": "2", - "plugins": [ - { - "name": "py", - "wasm": { - "url": "https://downloads.sqlc.dev/plugin/sqlc-gen-python_1.1.0.wasm", - "sha256": "ef58f143a8c116781091441770c7166caaf361dd645f62b8f05f462e9f95c3b2" - } - } - ], - "sql": [ - { - "schema": "query.sql", - "queries": "query.sql", - "engine": "postgresql", - "codegen": [ - { - "plugin": "py", - "out": "python", - "options": { - "package": "querytest", - "emit_sync_querier": true, - "emit_async_querier": true - } - } - ] - } - ] -} diff --git a/internal/endtoend/testdata/full_outer_join/sqlite/go/db.go b/internal/endtoend/testdata/full_outer_join/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/full_outer_join/sqlite/go/db.go +++ b/internal/endtoend/testdata/full_outer_join/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/full_outer_join/sqlite/go/models.go b/internal/endtoend/testdata/full_outer_join/sqlite/go/models.go index 7a25498414..f1e4064907 100644 --- a/internal/endtoend/testdata/full_outer_join/sqlite/go/models.go +++ b/internal/endtoend/testdata/full_outer_join/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Author struct { ID int64 Name string diff --git a/internal/endtoend/testdata/full_outer_join/sqlite/go/query.sql.go b/internal/endtoend/testdata/full_outer_join/sqlite/go/query.sql.go index fe6539a497..2e4903124d 100644 --- a/internal/endtoend/testdata/full_outer_join/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/full_outer_join/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/full_outer_join/sqlite/query.sql b/internal/endtoend/testdata/full_outer_join/sqlite/query.sql index 305fe6f1fc..b9feaba655 100644 --- a/internal/endtoend/testdata/full_outer_join/sqlite/query.sql +++ b/internal/endtoend/testdata/full_outer_join/sqlite/query.sql @@ -1,14 +1,3 @@ --- Example queries for sqlc -CREATE TABLE authors ( - id INTEGER PRIMARY KEY, - name text NOT NULL -); - -CREATE TABLE books ( - id INTEGER PRIMARY KEY, - title text NOT NULL -); - -- name: GetAuthor :one SELECT * FROM authors AS a FULL OUTER JOIN books AS b diff --git a/internal/endtoend/testdata/full_outer_join/sqlite/schema.sql b/internal/endtoend/testdata/full_outer_join/sqlite/schema.sql new file mode 100644 index 0000000000..2018ca288c --- /dev/null +++ b/internal/endtoend/testdata/full_outer_join/sqlite/schema.sql @@ -0,0 +1,11 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id INTEGER PRIMARY KEY, + name text NOT NULL +); + +CREATE TABLE books ( + id INTEGER PRIMARY KEY, + title text NOT NULL +); + diff --git a/internal/endtoend/testdata/full_outer_join/sqlite/sqlc.json b/internal/endtoend/testdata/full_outer_join/sqlite/sqlc.json index fd6d575377..99b3b5f074 100644 --- a/internal/endtoend/testdata/full_outer_join/sqlite/sqlc.json +++ b/internal/endtoend/testdata/full_outer_join/sqlite/sqlc.json @@ -1 +1 @@ -{"version": "1", "packages": [{"path": "go", "engine": "sqlite", "schema": "query.sql", "queries": "query.sql", "name": "querytest"}]} \ No newline at end of file +{"version": "1", "packages": [{"path": "go", "engine": "sqlite", "schema": "schema.sql", "queries": "query.sql", "name": "querytest"}]} \ No newline at end of file diff --git a/internal/endtoend/testdata/func_aggregate/go/db.go b/internal/endtoend/testdata/func_aggregate/go/db.go deleted file mode 100644 index a457fb76b2..0000000000 --- a/internal/endtoend/testdata/func_aggregate/go/db.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package querytest - -import ( - "context" - "database/sql" -) - -type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) - PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row -} - -func New(db DBTX) *Queries { - return &Queries{db: db} -} - -type Queries struct { - db DBTX -} - -func (q *Queries) WithTx(tx *sql.Tx) *Queries { - return &Queries{ - db: tx, - } -} diff --git a/internal/endtoend/testdata/func_aggregate/go/models.go b/internal/endtoend/testdata/func_aggregate/go/models.go deleted file mode 100644 index 2727f2e2de..0000000000 --- a/internal/endtoend/testdata/func_aggregate/go/models.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package querytest - -import ( - "database/sql" -) - -type Author struct { - ID int64 - Name string - Bio sql.NullString -} diff --git a/internal/endtoend/testdata/func_aggregate/go/query.sql.go b/internal/endtoend/testdata/func_aggregate/go/query.sql.go deleted file mode 100644 index 49595c515d..0000000000 --- a/internal/endtoend/testdata/func_aggregate/go/query.sql.go +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 -// source: query.sql - -package querytest - -import ( - "context" -) - -const percentile = `-- name: Percentile :one -select percentile_disc(0.5) within group (order by authors.name) -from authors -` - -func (q *Queries) Percentile(ctx context.Context) (interface{}, error) { - row := q.db.QueryRowContext(ctx, percentile) - var percentile_disc interface{} - err := row.Scan(&percentile_disc) - return percentile_disc, err -} diff --git a/internal/endtoend/testdata/func_aggregate/pganalyze/exec.json b/internal/endtoend/testdata/func_aggregate/pganalyze/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/func_aggregate/pganalyze/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/func_aggregate/pganalyze/go/db.go b/internal/endtoend/testdata/func_aggregate/pganalyze/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/func_aggregate/pganalyze/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/func_aggregate/pganalyze/go/models.go b/internal/endtoend/testdata/func_aggregate/pganalyze/go/models.go new file mode 100644 index 0000000000..eaf05e5c00 --- /dev/null +++ b/internal/endtoend/testdata/func_aggregate/pganalyze/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/func_aggregate/pganalyze/go/query.sql.go b/internal/endtoend/testdata/func_aggregate/pganalyze/go/query.sql.go new file mode 100644 index 0000000000..0d04b2855c --- /dev/null +++ b/internal/endtoend/testdata/func_aggregate/pganalyze/go/query.sql.go @@ -0,0 +1,22 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const percentile = `-- name: Percentile :one +select percentile_disc(0.5) within group (order by authors.name) +from authors +` + +func (q *Queries) Percentile(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, percentile) + var percentile_disc string + err := row.Scan(&percentile_disc) + return percentile_disc, err +} diff --git a/internal/endtoend/testdata/func_aggregate/pganalyze/query.sql b/internal/endtoend/testdata/func_aggregate/pganalyze/query.sql new file mode 100644 index 0000000000..cdda8237c9 --- /dev/null +++ b/internal/endtoend/testdata/func_aggregate/pganalyze/query.sql @@ -0,0 +1,3 @@ +-- name: Percentile :one +select percentile_disc(0.5) within group (order by authors.name) +from authors; diff --git a/internal/endtoend/testdata/func_aggregate/pganalyze/schema.sql b/internal/endtoend/testdata/func_aggregate/pganalyze/schema.sql new file mode 100644 index 0000000000..290bbe1642 --- /dev/null +++ b/internal/endtoend/testdata/func_aggregate/pganalyze/schema.sql @@ -0,0 +1,7 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + diff --git a/internal/endtoend/testdata/func_aggregate/pganalyze/sqlc.json b/internal/endtoend/testdata/func_aggregate/pganalyze/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/func_aggregate/pganalyze/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/func_aggregate/postgresql/exec.json b/internal/endtoend/testdata/func_aggregate/postgresql/exec.json new file mode 100644 index 0000000000..c16f123ce3 --- /dev/null +++ b/internal/endtoend/testdata/func_aggregate/postgresql/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} \ No newline at end of file diff --git a/internal/endtoend/testdata/func_aggregate/postgresql/go/db.go b/internal/endtoend/testdata/func_aggregate/postgresql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/func_aggregate/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/func_aggregate/postgresql/go/models.go b/internal/endtoend/testdata/func_aggregate/postgresql/go/models.go new file mode 100644 index 0000000000..eaf05e5c00 --- /dev/null +++ b/internal/endtoend/testdata/func_aggregate/postgresql/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/func_aggregate/postgresql/go/query.sql.go b/internal/endtoend/testdata/func_aggregate/postgresql/go/query.sql.go new file mode 100644 index 0000000000..b57889b4a3 --- /dev/null +++ b/internal/endtoend/testdata/func_aggregate/postgresql/go/query.sql.go @@ -0,0 +1,22 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const percentile = `-- name: Percentile :one +select percentile_disc(0.5) within group (order by authors.name) +from authors +` + +func (q *Queries) Percentile(ctx context.Context) (interface{}, error) { + row := q.db.QueryRowContext(ctx, percentile) + var percentile_disc interface{} + err := row.Scan(&percentile_disc) + return percentile_disc, err +} diff --git a/internal/endtoend/testdata/func_aggregate/postgresql/query.sql b/internal/endtoend/testdata/func_aggregate/postgresql/query.sql new file mode 100644 index 0000000000..cdda8237c9 --- /dev/null +++ b/internal/endtoend/testdata/func_aggregate/postgresql/query.sql @@ -0,0 +1,3 @@ +-- name: Percentile :one +select percentile_disc(0.5) within group (order by authors.name) +from authors; diff --git a/internal/endtoend/testdata/func_aggregate/postgresql/schema.sql b/internal/endtoend/testdata/func_aggregate/postgresql/schema.sql new file mode 100644 index 0000000000..290bbe1642 --- /dev/null +++ b/internal/endtoend/testdata/func_aggregate/postgresql/schema.sql @@ -0,0 +1,7 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + diff --git a/internal/endtoend/testdata/func_aggregate/postgresql/sqlc.json b/internal/endtoend/testdata/func_aggregate/postgresql/sqlc.json new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/func_aggregate/postgresql/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/func_aggregate/query.sql b/internal/endtoend/testdata/func_aggregate/query.sql deleted file mode 100644 index b0e6f6496a..0000000000 --- a/internal/endtoend/testdata/func_aggregate/query.sql +++ /dev/null @@ -1,10 +0,0 @@ --- Example queries for sqlc -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - name text NOT NULL, - bio text -); - --- name: Percentile :one -select percentile_disc(0.5) within group (order by authors.name) -from authors; diff --git a/internal/endtoend/testdata/func_aggregate/sqlc.json b/internal/endtoend/testdata/func_aggregate/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/func_aggregate/sqlc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/func_args/pgx/v4/go/db.go b/internal/endtoend/testdata/func_args/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/func_args/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/func_args/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/func_args/pgx/v4/go/models.go b/internal/endtoend/testdata/func_args/pgx/v4/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/func_args/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/func_args/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/func_args/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/func_args/pgx/v4/go/query.sql.go index 8dd941b2f0..74bd180307 100644 --- a/internal/endtoend/testdata/func_args/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/func_args/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/func_args/pgx/v4/query.sql b/internal/endtoend/testdata/func_args/pgx/v4/query.sql index bbc440081a..7ca3eace58 100644 --- a/internal/endtoend/testdata/func_args/pgx/v4/query.sql +++ b/internal/endtoend/testdata/func_args/pgx/v4/query.sql @@ -1,11 +1,3 @@ -CREATE FUNCTION plus(a integer, b integer) RETURNS integer AS $$ - BEGIN - RETURN a + b; - END; -$$ LANGUAGE plpgsql; - -CREATE FUNCTION table_args(x INT) RETURNS TABLE (y INT) AS 'SELECT x' LANGUAGE sql; - -- name: Plus :one SELECT plus(b => $2, a => $1); diff --git a/internal/endtoend/testdata/func_args/pgx/v4/schema.sql b/internal/endtoend/testdata/func_args/pgx/v4/schema.sql new file mode 100644 index 0000000000..0ba81c1e57 --- /dev/null +++ b/internal/endtoend/testdata/func_args/pgx/v4/schema.sql @@ -0,0 +1,8 @@ +CREATE FUNCTION plus(a integer, b integer) RETURNS integer AS $$ + BEGIN + RETURN a + b; + END; +$$ LANGUAGE plpgsql; + +CREATE FUNCTION table_args(x INT) RETURNS TABLE (y INT) AS 'SELECT x' LANGUAGE sql; + diff --git a/internal/endtoend/testdata/func_args/pgx/v4/sqlc.json b/internal/endtoend/testdata/func_args/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/func_args/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/func_args/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/func_args/pgx/v5/go/db.go b/internal/endtoend/testdata/func_args/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/func_args/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/func_args/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/func_args/pgx/v5/go/models.go b/internal/endtoend/testdata/func_args/pgx/v5/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/func_args/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/func_args/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/func_args/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/func_args/pgx/v5/go/query.sql.go index 1f236dc907..55d849fca7 100644 --- a/internal/endtoend/testdata/func_args/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/func_args/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/func_args/pgx/v5/query.sql b/internal/endtoend/testdata/func_args/pgx/v5/query.sql index bbc440081a..7ca3eace58 100644 --- a/internal/endtoend/testdata/func_args/pgx/v5/query.sql +++ b/internal/endtoend/testdata/func_args/pgx/v5/query.sql @@ -1,11 +1,3 @@ -CREATE FUNCTION plus(a integer, b integer) RETURNS integer AS $$ - BEGIN - RETURN a + b; - END; -$$ LANGUAGE plpgsql; - -CREATE FUNCTION table_args(x INT) RETURNS TABLE (y INT) AS 'SELECT x' LANGUAGE sql; - -- name: Plus :one SELECT plus(b => $2, a => $1); diff --git a/internal/endtoend/testdata/func_args/pgx/v5/schema.sql b/internal/endtoend/testdata/func_args/pgx/v5/schema.sql new file mode 100644 index 0000000000..0ba81c1e57 --- /dev/null +++ b/internal/endtoend/testdata/func_args/pgx/v5/schema.sql @@ -0,0 +1,8 @@ +CREATE FUNCTION plus(a integer, b integer) RETURNS integer AS $$ + BEGIN + RETURN a + b; + END; +$$ LANGUAGE plpgsql; + +CREATE FUNCTION table_args(x INT) RETURNS TABLE (y INT) AS 'SELECT x' LANGUAGE sql; + diff --git a/internal/endtoend/testdata/func_args/pgx/v5/sqlc.json b/internal/endtoend/testdata/func_args/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/func_args/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/func_args/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/func_args/stdlib/go/db.go b/internal/endtoend/testdata/func_args/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/func_args/stdlib/go/db.go +++ b/internal/endtoend/testdata/func_args/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/func_args/stdlib/go/models.go b/internal/endtoend/testdata/func_args/stdlib/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/func_args/stdlib/go/models.go +++ b/internal/endtoend/testdata/func_args/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/func_args/stdlib/go/query.sql.go b/internal/endtoend/testdata/func_args/stdlib/go/query.sql.go index 8e87563a6c..e083ece3f3 100644 --- a/internal/endtoend/testdata/func_args/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/func_args/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/func_args/stdlib/query.sql b/internal/endtoend/testdata/func_args/stdlib/query.sql index bbc440081a..7ca3eace58 100644 --- a/internal/endtoend/testdata/func_args/stdlib/query.sql +++ b/internal/endtoend/testdata/func_args/stdlib/query.sql @@ -1,11 +1,3 @@ -CREATE FUNCTION plus(a integer, b integer) RETURNS integer AS $$ - BEGIN - RETURN a + b; - END; -$$ LANGUAGE plpgsql; - -CREATE FUNCTION table_args(x INT) RETURNS TABLE (y INT) AS 'SELECT x' LANGUAGE sql; - -- name: Plus :one SELECT plus(b => $2, a => $1); diff --git a/internal/endtoend/testdata/func_args/stdlib/schema.sql b/internal/endtoend/testdata/func_args/stdlib/schema.sql new file mode 100644 index 0000000000..0ba81c1e57 --- /dev/null +++ b/internal/endtoend/testdata/func_args/stdlib/schema.sql @@ -0,0 +1,8 @@ +CREATE FUNCTION plus(a integer, b integer) RETURNS integer AS $$ + BEGIN + RETURN a + b; + END; +$$ LANGUAGE plpgsql; + +CREATE FUNCTION table_args(x INT) RETURNS TABLE (y INT) AS 'SELECT x' LANGUAGE sql; + diff --git a/internal/endtoend/testdata/func_args/stdlib/sqlc.json b/internal/endtoend/testdata/func_args/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/func_args/stdlib/sqlc.json +++ b/internal/endtoend/testdata/func_args/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/db.go b/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/models.go b/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/query.sql.go index cbbe3bb8bc..9e091cf0f0 100644 --- a/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/func_args_typecast/pgx/v4/query.sql b/internal/endtoend/testdata/func_args_typecast/pgx/v4/query.sql index 399a5de922..5c5fccf030 100644 --- a/internal/endtoend/testdata/func_args_typecast/pgx/v4/query.sql +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v4/query.sql @@ -1,8 +1,2 @@ -CREATE FUNCTION plus(a integer, b integer) RETURNS integer AS $$ - BEGIN - RETURN a + b; - END; -$$ LANGUAGE plpgsql; - -- name: PlusPositionalCast :one SELECT plus($1, $2::INTEGER); diff --git a/internal/endtoend/testdata/func_args_typecast/pgx/v4/schema.sql b/internal/endtoend/testdata/func_args_typecast/pgx/v4/schema.sql new file mode 100644 index 0000000000..148490039e --- /dev/null +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v4/schema.sql @@ -0,0 +1,6 @@ +CREATE FUNCTION plus(a integer, b integer) RETURNS integer AS $$ + BEGIN + RETURN a + b; + END; +$$ LANGUAGE plpgsql; + diff --git a/internal/endtoend/testdata/func_args_typecast/pgx/v4/sqlc.json b/internal/endtoend/testdata/func_args_typecast/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/func_args_typecast/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/db.go b/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/models.go b/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/query.sql.go index cbbe3bb8bc..9e091cf0f0 100644 --- a/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/func_args_typecast/pgx/v5/query.sql b/internal/endtoend/testdata/func_args_typecast/pgx/v5/query.sql index 399a5de922..5c5fccf030 100644 --- a/internal/endtoend/testdata/func_args_typecast/pgx/v5/query.sql +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v5/query.sql @@ -1,8 +1,2 @@ -CREATE FUNCTION plus(a integer, b integer) RETURNS integer AS $$ - BEGIN - RETURN a + b; - END; -$$ LANGUAGE plpgsql; - -- name: PlusPositionalCast :one SELECT plus($1, $2::INTEGER); diff --git a/internal/endtoend/testdata/func_args_typecast/pgx/v5/schema.sql b/internal/endtoend/testdata/func_args_typecast/pgx/v5/schema.sql new file mode 100644 index 0000000000..148490039e --- /dev/null +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v5/schema.sql @@ -0,0 +1,6 @@ +CREATE FUNCTION plus(a integer, b integer) RETURNS integer AS $$ + BEGIN + RETURN a + b; + END; +$$ LANGUAGE plpgsql; + diff --git a/internal/endtoend/testdata/func_args_typecast/pgx/v5/sqlc.json b/internal/endtoend/testdata/func_args_typecast/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/func_args_typecast/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/func_args_typecast/stdlib/go/db.go b/internal/endtoend/testdata/func_args_typecast/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/func_args_typecast/stdlib/go/db.go +++ b/internal/endtoend/testdata/func_args_typecast/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/func_args_typecast/stdlib/go/models.go b/internal/endtoend/testdata/func_args_typecast/stdlib/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/func_args_typecast/stdlib/go/models.go +++ b/internal/endtoend/testdata/func_args_typecast/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/func_args_typecast/stdlib/go/query.sql.go b/internal/endtoend/testdata/func_args_typecast/stdlib/go/query.sql.go index 09fda78b89..8d37ee409c 100644 --- a/internal/endtoend/testdata/func_args_typecast/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/func_args_typecast/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/func_args_typecast/stdlib/query.sql b/internal/endtoend/testdata/func_args_typecast/stdlib/query.sql index 399a5de922..5c5fccf030 100644 --- a/internal/endtoend/testdata/func_args_typecast/stdlib/query.sql +++ b/internal/endtoend/testdata/func_args_typecast/stdlib/query.sql @@ -1,8 +1,2 @@ -CREATE FUNCTION plus(a integer, b integer) RETURNS integer AS $$ - BEGIN - RETURN a + b; - END; -$$ LANGUAGE plpgsql; - -- name: PlusPositionalCast :one SELECT plus($1, $2::INTEGER); diff --git a/internal/endtoend/testdata/func_args_typecast/stdlib/schema.sql b/internal/endtoend/testdata/func_args_typecast/stdlib/schema.sql new file mode 100644 index 0000000000..148490039e --- /dev/null +++ b/internal/endtoend/testdata/func_args_typecast/stdlib/schema.sql @@ -0,0 +1,6 @@ +CREATE FUNCTION plus(a integer, b integer) RETURNS integer AS $$ + BEGIN + RETURN a + b; + END; +$$ LANGUAGE plpgsql; + diff --git a/internal/endtoend/testdata/func_args_typecast/stdlib/sqlc.json b/internal/endtoend/testdata/func_args_typecast/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/func_args_typecast/stdlib/sqlc.json +++ b/internal/endtoend/testdata/func_args_typecast/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/func_call_cast/mysql/go/db.go b/internal/endtoend/testdata/func_call_cast/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/func_call_cast/mysql/go/db.go +++ b/internal/endtoend/testdata/func_call_cast/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/func_call_cast/mysql/go/models.go b/internal/endtoend/testdata/func_call_cast/mysql/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/func_call_cast/mysql/go/models.go +++ b/internal/endtoend/testdata/func_call_cast/mysql/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/func_call_cast/mysql/go/query.sql.go b/internal/endtoend/testdata/func_call_cast/mysql/go/query.sql.go index 83504aa24e..4199d37599 100644 --- a/internal/endtoend/testdata/func_call_cast/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/func_call_cast/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/func_call_cast/mysql/schema.sql b/internal/endtoend/testdata/func_call_cast/mysql/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/func_call_cast/mysql/sqlc.json b/internal/endtoend/testdata/func_call_cast/mysql/sqlc.json index 534b7e24e9..0390f67889 100644 --- a/internal/endtoend/testdata/func_call_cast/mysql/sqlc.json +++ b/internal/endtoend/testdata/func_call_cast/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/query.sql.go index b5d079a8b9..3c4ae5070b 100644 --- a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -15,8 +15,8 @@ const demo = `-- name: Demo :one SELECT uuid_generate_v5('7c4597a0-8cfa-4c19-8da0-b8474a36440d', $1)::uuid as col1 ` -func (q *Queries) Demo(ctx context.Context, uuidGenerateV5 interface{}) (uuid.UUID, error) { - row := q.db.QueryRow(ctx, demo, uuidGenerateV5) +func (q *Queries) Demo(ctx context.Context, name string) (uuid.UUID, error) { + row := q.db.QueryRow(ctx, demo, name) var col1 uuid.UUID err := row.Scan(&col1) return col1, err diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..682131d3bf --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/schema.sql @@ -0,0 +1 @@ +CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; \ No newline at end of file diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/query.sql.go index 973118c2bb..fb325cd9bc 100644 --- a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -15,8 +15,8 @@ const demo = `-- name: Demo :one SELECT uuid_generate_v5('7c4597a0-8cfa-4c19-8da0-b8474a36440d', $1)::uuid as col1 ` -func (q *Queries) Demo(ctx context.Context, uuidGenerateV5 interface{}) (pgtype.UUID, error) { - row := q.db.QueryRow(ctx, demo, uuidGenerateV5) +func (q *Queries) Demo(ctx context.Context, name string) (pgtype.UUID, error) { + row := q.db.QueryRow(ctx, demo, name) var col1 pgtype.UUID err := row.Scan(&col1) return col1, err diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..682131d3bf --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/schema.sql @@ -0,0 +1 @@ +CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; \ No newline at end of file diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/query.sql.go index 55b1e9432b..26f8697252 100644 --- a/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -15,8 +15,8 @@ const demo = `-- name: Demo :one SELECT uuid_generate_v5('7c4597a0-8cfa-4c19-8da0-b8474a36440d', $1)::uuid as col1 ` -func (q *Queries) Demo(ctx context.Context, uuidGenerateV5 interface{}) (uuid.UUID, error) { - row := q.db.QueryRowContext(ctx, demo, uuidGenerateV5) +func (q *Queries) Demo(ctx context.Context, name string) (uuid.UUID, error) { + row := q.db.QueryRowContext(ctx, demo, name) var col1 uuid.UUID err := row.Scan(&col1) return col1, err diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..682131d3bf --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/schema.sql @@ -0,0 +1 @@ +CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; \ No newline at end of file diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/func_call_cast/sqlite/go/db.go b/internal/endtoend/testdata/func_call_cast/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/func_call_cast/sqlite/go/db.go +++ b/internal/endtoend/testdata/func_call_cast/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/func_call_cast/sqlite/go/models.go b/internal/endtoend/testdata/func_call_cast/sqlite/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/func_call_cast/sqlite/go/models.go +++ b/internal/endtoend/testdata/func_call_cast/sqlite/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/func_call_cast/sqlite/go/query.sql.go b/internal/endtoend/testdata/func_call_cast/sqlite/go/query.sql.go index b81c84883b..797db651d3 100644 --- a/internal/endtoend/testdata/func_call_cast/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/func_call_cast/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/func_call_cast/sqlite/schema.sql b/internal/endtoend/testdata/func_call_cast/sqlite/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/func_call_cast/sqlite/sqlc.json b/internal/endtoend/testdata/func_call_cast/sqlite/sqlc.json index e5c397f043..95b9cd09c0 100644 --- a/internal/endtoend/testdata/func_call_cast/sqlite/sqlc.json +++ b/internal/endtoend/testdata/func_call_cast/sqlite/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "sqlite", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/func_match_types/mysql/go/db.go b/internal/endtoend/testdata/func_match_types/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/func_match_types/mysql/go/db.go +++ b/internal/endtoend/testdata/func_match_types/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/func_match_types/mysql/go/models.go b/internal/endtoend/testdata/func_match_types/mysql/go/models.go index 315221c85b..eb64577fc3 100644 --- a/internal/endtoend/testdata/func_match_types/mysql/go/models.go +++ b/internal/endtoend/testdata/func_match_types/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Book struct { ID int32 Title string diff --git a/internal/endtoend/testdata/func_match_types/mysql/go/query.sql.go b/internal/endtoend/testdata/func_match_types/mysql/go/query.sql.go index 2489a3a333..4843b2807e 100644 --- a/internal/endtoend/testdata/func_match_types/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/func_match_types/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/func_match_types/postgresql/go/db.go b/internal/endtoend/testdata/func_match_types/postgresql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/func_match_types/postgresql/go/db.go +++ b/internal/endtoend/testdata/func_match_types/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/func_match_types/postgresql/go/models.go b/internal/endtoend/testdata/func_match_types/postgresql/go/models.go index 4d16f82923..eb64577fc3 100644 --- a/internal/endtoend/testdata/func_match_types/postgresql/go/models.go +++ b/internal/endtoend/testdata/func_match_types/postgresql/go/models.go @@ -1,14 +1,12 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Book struct { ID int32 Title string Author string - Pages string + Pages int32 } diff --git a/internal/endtoend/testdata/func_match_types/postgresql/go/query.sql.go b/internal/endtoend/testdata/func_match_types/postgresql/go/query.sql.go index f64610ca97..1a4f16f188 100644 --- a/internal/endtoend/testdata/func_match_types/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/func_match_types/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/func_match_types/postgresql/schema.sql b/internal/endtoend/testdata/func_match_types/postgresql/schema.sql index db9215b088..cf91381e3f 100644 --- a/internal/endtoend/testdata/func_match_types/postgresql/schema.sql +++ b/internal/endtoend/testdata/func_match_types/postgresql/schema.sql @@ -1,6 +1,6 @@ CREATE TABLE books ( - id integer PRIMARY KEY, - title text NOT NULL, - author text NOT NULL, - pages numeric NOT NULL + id integer PRIMARY KEY, + title text NOT NULL, + author text NOT NULL, + pages integer NOT NULL ); diff --git a/internal/endtoend/testdata/func_match_types/sqlite/go/db.go b/internal/endtoend/testdata/func_match_types/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/func_match_types/sqlite/go/db.go +++ b/internal/endtoend/testdata/func_match_types/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/func_match_types/sqlite/go/models.go b/internal/endtoend/testdata/func_match_types/sqlite/go/models.go index 6f96b7c920..84258229b2 100644 --- a/internal/endtoend/testdata/func_match_types/sqlite/go/models.go +++ b/internal/endtoend/testdata/func_match_types/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Book struct { ID int64 Title string diff --git a/internal/endtoend/testdata/func_match_types/sqlite/go/query.sql.go b/internal/endtoend/testdata/func_match_types/sqlite/go/query.sql.go index 904ab41fd0..60b373aeb9 100644 --- a/internal/endtoend/testdata/func_match_types/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/func_match_types/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/func_out_param/issue.md b/internal/endtoend/testdata/func_out_param/issue.md new file mode 100644 index 0000000000..1b8779f2ff --- /dev/null +++ b/internal/endtoend/testdata/func_out_param/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1654 diff --git a/internal/endtoend/testdata/func_out_param/pgx/go/db.go b/internal/endtoend/testdata/func_out_param/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/func_out_param/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/func_out_param/pgx/go/models.go b/internal/endtoend/testdata/func_out_param/pgx/go/models.go new file mode 100644 index 0000000000..e4cf9d17ae --- /dev/null +++ b/internal/endtoend/testdata/func_out_param/pgx/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Author struct { + ID int64 + Name string + Bio pgtype.Text +} diff --git a/internal/endtoend/testdata/func_out_param/pgx/go/query.sql.go b/internal/endtoend/testdata/func_out_param/pgx/go/query.sql.go new file mode 100644 index 0000000000..03b53863f4 --- /dev/null +++ b/internal/endtoend/testdata/func_out_param/pgx/go/query.sql.go @@ -0,0 +1,30 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const createAuthor = `-- name: CreateAuthor :one +SELECT id FROM add_author ( + $1, $2 +) +` + +type CreateAuthorParams struct { + Name string + Bio string +} + +func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (pgtype.Int4, error) { + row := q.db.QueryRow(ctx, createAuthor, arg.Name, arg.Bio) + var id pgtype.Int4 + err := row.Scan(&id) + return id, err +} diff --git a/internal/endtoend/testdata/func_out_param/pgx/query.sql b/internal/endtoend/testdata/func_out_param/pgx/query.sql new file mode 100644 index 0000000000..b23c7dca49 --- /dev/null +++ b/internal/endtoend/testdata/func_out_param/pgx/query.sql @@ -0,0 +1,4 @@ +-- name: CreateAuthor :one +SELECT * FROM add_author ( + sqlc.arg(name), sqlc.arg(bio) +); diff --git a/internal/endtoend/testdata/func_out_param/pgx/schema.sql b/internal/endtoend/testdata/func_out_param/pgx/schema.sql new file mode 100644 index 0000000000..97c1022d14 --- /dev/null +++ b/internal/endtoend/testdata/func_out_param/pgx/schema.sql @@ -0,0 +1,14 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + +CREATE OR REPLACE FUNCTION add_author (name text, bio text, out id int) +AS $$ +DECLARE +BEGIN + id = 123; +END; +$$ LANGUAGE plpgsql; diff --git a/internal/endtoend/testdata/func_out_param/pgx/sqlc.yaml b/internal/endtoend/testdata/func_out_param/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/func_out_param/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/func_return/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/func_return/postgresql/pgx/v4/go/db.go deleted file mode 100644 index 312ca8c296..0000000000 --- a/internal/endtoend/testdata/func_return/postgresql/pgx/v4/go/db.go +++ /dev/null @@ -1,32 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package querytest - -import ( - "context" - - "github.com/jackc/pgconn" - "github.com/jackc/pgx/v4" -) - -type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row -} - -func New(db DBTX) *Queries { - return &Queries{db: db} -} - -type Queries struct { - db DBTX -} - -func (q *Queries) WithTx(tx pgx.Tx) *Queries { - return &Queries{ - db: tx, - } -} diff --git a/internal/endtoend/testdata/func_return/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/func_return/postgresql/pgx/v4/go/models.go deleted file mode 100644 index 18a0ebb3e7..0000000000 --- a/internal/endtoend/testdata/func_return/postgresql/pgx/v4/go/models.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package querytest - -import ( - "database/sql" -) - -type User struct { - ID sql.NullInt32 - FirstName string -} diff --git a/internal/endtoend/testdata/func_return/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/func_return/postgresql/pgx/v4/go/query.sql.go deleted file mode 100644 index 4bca42ab68..0000000000 --- a/internal/endtoend/testdata/func_return/postgresql/pgx/v4/go/query.sql.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 -// source: query.sql - -package querytest - -import ( - "context" - - "github.com/jackc/pgtype" -) - -const generateSeries = `-- name: GenerateSeries :many -SELECT ($1::inet) + i -FROM generate_series(0, $2::int) AS i -LIMIT 1 -` - -type GenerateSeriesParams struct { - Column1 pgtype.Inet - Column2 int32 -} - -func (q *Queries) GenerateSeries(ctx context.Context, arg GenerateSeriesParams) ([]int32, error) { - rows, err := q.db.Query(ctx, generateSeries, arg.Column1, arg.Column2) - if err != nil { - return nil, err - } - defer rows.Close() - var items []int32 - for rows.Next() { - var column_1 int32 - if err := rows.Scan(&column_1); err != nil { - return nil, err - } - items = append(items, column_1) - } - if err := rows.Err(); err != nil { - return nil, err - } - return items, nil -} - -const getDate = `-- name: GetDate :one -SELECT from CURRENT_DATE -` - -type GetDateRow struct { -} - -func (q *Queries) GetDate(ctx context.Context) (GetDateRow, error) { - row := q.db.QueryRow(ctx, getDate) - var i GetDateRow - err := row.Scan() - return i, err -} - -const getUsers = `-- name: GetUsers :many -SELECT id, first_name -FROM users_func() -WHERE first_name != '' -` - -func (q *Queries) GetUsers(ctx context.Context) ([]User, error) { - rows, err := q.db.Query(ctx, getUsers) - if err != nil { - return nil, err - } - defer rows.Close() - var items []User - for rows.Next() { - var i User - if err := rows.Scan(&i.ID, &i.FirstName); err != nil { - return nil, err - } - items = append(items, i) - } - if err := rows.Err(); err != nil { - return nil, err - } - return items, nil -} diff --git a/internal/endtoend/testdata/func_return/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/func_return/postgresql/pgx/v4/query.sql deleted file mode 100644 index c2fe0b941b..0000000000 --- a/internal/endtoend/testdata/func_return/postgresql/pgx/v4/query.sql +++ /dev/null @@ -1,13 +0,0 @@ - -/* name: GetUsers :many */ -SELECT * -FROM users_func() -WHERE first_name != ''; - -/* name: GenerateSeries :many */ -SELECT ($1::inet) + i -FROM generate_series(0, $2::int) AS i -LIMIT 1; - -/* name: GetDate :one */ -SELECT * from CURRENT_DATE; \ No newline at end of file diff --git a/internal/endtoend/testdata/func_return/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/func_return/postgresql/pgx/v4/schema.sql deleted file mode 100644 index adc43acdb6..0000000000 --- a/internal/endtoend/testdata/func_return/postgresql/pgx/v4/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE users ( - id integer, - first_name varchar(255) NOT NULL -); - -CREATE FUNCTION users_func() RETURNS SETOF users AS $func$ - BEGIN - SELECT * - FROM users; - END; -$func$ LANGUAGE plpgsql; diff --git a/internal/endtoend/testdata/func_return/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/func_return/postgresql/pgx/v5/go/db.go deleted file mode 100644 index 8a010ccc48..0000000000 --- a/internal/endtoend/testdata/func_return/postgresql/pgx/v5/go/db.go +++ /dev/null @@ -1,32 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package querytest - -import ( - "context" - - "github.com/jackc/pgx/v5" - "github.com/jackc/pgx/v5/pgconn" -) - -type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row -} - -func New(db DBTX) *Queries { - return &Queries{db: db} -} - -type Queries struct { - db DBTX -} - -func (q *Queries) WithTx(tx pgx.Tx) *Queries { - return &Queries{ - db: tx, - } -} diff --git a/internal/endtoend/testdata/func_return/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/func_return/postgresql/pgx/v5/go/models.go deleted file mode 100644 index 950971b7c2..0000000000 --- a/internal/endtoend/testdata/func_return/postgresql/pgx/v5/go/models.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package querytest - -import ( - "github.com/jackc/pgx/v5/pgtype" -) - -type User struct { - ID pgtype.Int4 - FirstName string -} diff --git a/internal/endtoend/testdata/func_return/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/func_return/postgresql/pgx/v5/go/query.sql.go deleted file mode 100644 index 19f4053aa9..0000000000 --- a/internal/endtoend/testdata/func_return/postgresql/pgx/v5/go/query.sql.go +++ /dev/null @@ -1,82 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 -// source: query.sql - -package querytest - -import ( - "context" - "net/netip" -) - -const generateSeries = `-- name: GenerateSeries :many -SELECT ($1::inet) + i -FROM generate_series(0, $2::int) AS i -LIMIT 1 -` - -type GenerateSeriesParams struct { - Column1 netip.Addr - Column2 int32 -} - -func (q *Queries) GenerateSeries(ctx context.Context, arg GenerateSeriesParams) ([]int32, error) { - rows, err := q.db.Query(ctx, generateSeries, arg.Column1, arg.Column2) - if err != nil { - return nil, err - } - defer rows.Close() - var items []int32 - for rows.Next() { - var column_1 int32 - if err := rows.Scan(&column_1); err != nil { - return nil, err - } - items = append(items, column_1) - } - if err := rows.Err(); err != nil { - return nil, err - } - return items, nil -} - -const getDate = `-- name: GetDate :one -SELECT from CURRENT_DATE -` - -type GetDateRow struct { -} - -func (q *Queries) GetDate(ctx context.Context) (GetDateRow, error) { - row := q.db.QueryRow(ctx, getDate) - var i GetDateRow - err := row.Scan() - return i, err -} - -const getUsers = `-- name: GetUsers :many -SELECT id, first_name -FROM users_func() -WHERE first_name != '' -` - -func (q *Queries) GetUsers(ctx context.Context) ([]User, error) { - rows, err := q.db.Query(ctx, getUsers) - if err != nil { - return nil, err - } - defer rows.Close() - var items []User - for rows.Next() { - var i User - if err := rows.Scan(&i.ID, &i.FirstName); err != nil { - return nil, err - } - items = append(items, i) - } - if err := rows.Err(); err != nil { - return nil, err - } - return items, nil -} diff --git a/internal/endtoend/testdata/func_return/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/func_return/postgresql/pgx/v5/query.sql deleted file mode 100644 index c2fe0b941b..0000000000 --- a/internal/endtoend/testdata/func_return/postgresql/pgx/v5/query.sql +++ /dev/null @@ -1,13 +0,0 @@ - -/* name: GetUsers :many */ -SELECT * -FROM users_func() -WHERE first_name != ''; - -/* name: GenerateSeries :many */ -SELECT ($1::inet) + i -FROM generate_series(0, $2::int) AS i -LIMIT 1; - -/* name: GetDate :one */ -SELECT * from CURRENT_DATE; \ No newline at end of file diff --git a/internal/endtoend/testdata/func_return/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/func_return/postgresql/pgx/v5/schema.sql deleted file mode 100644 index adc43acdb6..0000000000 --- a/internal/endtoend/testdata/func_return/postgresql/pgx/v5/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE users ( - id integer, - first_name varchar(255) NOT NULL -); - -CREATE FUNCTION users_func() RETURNS SETOF users AS $func$ - BEGIN - SELECT * - FROM users; - END; -$func$ LANGUAGE plpgsql; diff --git a/internal/endtoend/testdata/func_return/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/func_return/postgresql/stdlib/go/db.go deleted file mode 100644 index a457fb76b2..0000000000 --- a/internal/endtoend/testdata/func_return/postgresql/stdlib/go/db.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package querytest - -import ( - "context" - "database/sql" -) - -type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) - PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row -} - -func New(db DBTX) *Queries { - return &Queries{db: db} -} - -type Queries struct { - db DBTX -} - -func (q *Queries) WithTx(tx *sql.Tx) *Queries { - return &Queries{ - db: tx, - } -} diff --git a/internal/endtoend/testdata/func_return/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/func_return/postgresql/stdlib/go/models.go deleted file mode 100644 index 18a0ebb3e7..0000000000 --- a/internal/endtoend/testdata/func_return/postgresql/stdlib/go/models.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package querytest - -import ( - "database/sql" -) - -type User struct { - ID sql.NullInt32 - FirstName string -} diff --git a/internal/endtoend/testdata/func_return/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/func_return/postgresql/stdlib/go/query.sql.go deleted file mode 100644 index 5bda0df50d..0000000000 --- a/internal/endtoend/testdata/func_return/postgresql/stdlib/go/query.sql.go +++ /dev/null @@ -1,89 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 -// source: query.sql - -package querytest - -import ( - "context" - - "github.com/sqlc-dev/pqtype" -) - -const generateSeries = `-- name: GenerateSeries :many -SELECT ($1::inet) + i -FROM generate_series(0, $2::int) AS i -LIMIT 1 -` - -type GenerateSeriesParams struct { - Column1 pqtype.Inet - Column2 int32 -} - -func (q *Queries) GenerateSeries(ctx context.Context, arg GenerateSeriesParams) ([]int32, error) { - rows, err := q.db.QueryContext(ctx, generateSeries, arg.Column1, arg.Column2) - if err != nil { - return nil, err - } - defer rows.Close() - var items []int32 - for rows.Next() { - var column_1 int32 - if err := rows.Scan(&column_1); err != nil { - return nil, err - } - items = append(items, column_1) - } - if err := rows.Close(); err != nil { - return nil, err - } - if err := rows.Err(); err != nil { - return nil, err - } - return items, nil -} - -const getDate = `-- name: GetDate :one -SELECT from CURRENT_DATE -` - -type GetDateRow struct { -} - -func (q *Queries) GetDate(ctx context.Context) (GetDateRow, error) { - row := q.db.QueryRowContext(ctx, getDate) - var i GetDateRow - err := row.Scan() - return i, err -} - -const getUsers = `-- name: GetUsers :many -SELECT id, first_name -FROM users_func() -WHERE first_name != '' -` - -func (q *Queries) GetUsers(ctx context.Context) ([]User, error) { - rows, err := q.db.QueryContext(ctx, getUsers) - if err != nil { - return nil, err - } - defer rows.Close() - var items []User - for rows.Next() { - var i User - if err := rows.Scan(&i.ID, &i.FirstName); err != nil { - return nil, err - } - items = append(items, i) - } - if err := rows.Close(); err != nil { - return nil, err - } - if err := rows.Err(); err != nil { - return nil, err - } - return items, nil -} diff --git a/internal/endtoend/testdata/func_return/postgresql/stdlib/query.sql b/internal/endtoend/testdata/func_return/postgresql/stdlib/query.sql deleted file mode 100644 index c2fe0b941b..0000000000 --- a/internal/endtoend/testdata/func_return/postgresql/stdlib/query.sql +++ /dev/null @@ -1,13 +0,0 @@ - -/* name: GetUsers :many */ -SELECT * -FROM users_func() -WHERE first_name != ''; - -/* name: GenerateSeries :many */ -SELECT ($1::inet) + i -FROM generate_series(0, $2::int) AS i -LIMIT 1; - -/* name: GetDate :one */ -SELECT * from CURRENT_DATE; \ No newline at end of file diff --git a/internal/endtoend/testdata/func_return/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/func_return/postgresql/stdlib/schema.sql deleted file mode 100644 index adc43acdb6..0000000000 --- a/internal/endtoend/testdata/func_return/postgresql/stdlib/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE users ( - id integer, - first_name varchar(255) NOT NULL -); - -CREATE FUNCTION users_func() RETURNS SETOF users AS $func$ - BEGIN - SELECT * - FROM users; - END; -$func$ LANGUAGE plpgsql; diff --git a/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/exec.json b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/go/db.go b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/go/models.go b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest diff --git a/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/go/query.sql.go b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/go/query.sql.go new file mode 100644 index 0000000000..c11ac157c0 --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/go/query.sql.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const getDate = `-- name: GetDate :one +SELECT now from NOW() +` + +func (q *Queries) GetDate(ctx context.Context) (pgtype.Timestamptz, error) { + row := q.db.QueryRow(ctx, getDate) + var now pgtype.Timestamptz + err := row.Scan(&now) + return now, err +} diff --git a/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/query.sql b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/query.sql new file mode 100644 index 0000000000..8f71309953 --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/query.sql @@ -0,0 +1,2 @@ +/* name: GetDate :one */ +SELECT * from NOW(); \ No newline at end of file diff --git a/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/schema.sql b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/func_return/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/sqlc.json similarity index 100% rename from internal/endtoend/testdata/func_return/postgresql/pgx/v5/sqlc.json rename to internal/endtoend/testdata/func_return_date/postgresql/pganalyze/sqlc.json diff --git a/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/exec.json b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest diff --git a/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/go/query.sql.go new file mode 100644 index 0000000000..0a05becd82 --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getDate = `-- name: GetDate :one +SELECT from CURRENT_DATE +` + +type GetDateRow struct { +} + +func (q *Queries) GetDate(ctx context.Context) (GetDateRow, error) { + row := q.db.QueryRow(ctx, getDate) + var i GetDateRow + err := row.Scan() + return i, err +} diff --git a/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..b5696a969e --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +/* name: GetDate :one */ +SELECT * from CURRENT_DATE; diff --git a/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v5", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/func_return_date/postgresql/stdlib/exec.json b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/func_return_date/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/func_return_date/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest diff --git a/internal/endtoend/testdata/func_return_date/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/go/query.sql.go new file mode 100644 index 0000000000..697afe2378 --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getDate = `-- name: GetDate :one +SELECT from CURRENT_DATE +` + +type GetDateRow struct { +} + +func (q *Queries) GetDate(ctx context.Context) (GetDateRow, error) { + row := q.db.QueryRowContext(ctx, getDate) + var i GetDateRow + err := row.Scan() + return i, err +} diff --git a/internal/endtoend/testdata/func_return_date/postgresql/stdlib/query.sql b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..b5696a969e --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +/* name: GetDate :one */ +SELECT * from CURRENT_DATE; diff --git a/internal/endtoend/testdata/func_return_date/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/func_return/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/sqlc.json similarity index 100% rename from internal/endtoend/testdata/func_return/postgresql/stdlib/sqlc.json rename to internal/endtoend/testdata/func_return_date/postgresql/stdlib/sqlc.json diff --git a/internal/endtoend/testdata/func_return_record/issue.md b/internal/endtoend/testdata/func_return_record/issue.md new file mode 100644 index 0000000000..56e68299aa --- /dev/null +++ b/internal/endtoend/testdata/func_return_record/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1979 diff --git a/internal/endtoend/testdata/func_return_record/postgresql/pgx/exec.json b/internal/endtoend/testdata/func_return_record/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/func_return_record/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/func_return_record/postgresql/pgx/go/db.go b/internal/endtoend/testdata/func_return_record/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/func_return_record/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/func_return_record/postgresql/pgx/go/models.go b/internal/endtoend/testdata/func_return_record/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..f323010acf --- /dev/null +++ b/internal/endtoend/testdata/func_return_record/postgresql/pgx/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type MyTable struct { + Data []byte +} diff --git a/internal/endtoend/testdata/func_return_record/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/func_return_record/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..4aacc462ac --- /dev/null +++ b/internal/endtoend/testdata/func_return_record/postgresql/pgx/go/query.sql.go @@ -0,0 +1,30 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const getData = `-- name: GetData :one +SELECT key, value +FROM my_table, jsonb_each(data) +LIMIT 1 +` + +type GetDataRow struct { + Key pgtype.Text + Value []byte +} + +func (q *Queries) GetData(ctx context.Context) (GetDataRow, error) { + row := q.db.QueryRow(ctx, getData) + var i GetDataRow + err := row.Scan(&i.Key, &i.Value) + return i, err +} diff --git a/internal/endtoend/testdata/func_return_record/postgresql/pgx/query.sql b/internal/endtoend/testdata/func_return_record/postgresql/pgx/query.sql new file mode 100644 index 0000000000..c540b6ac53 --- /dev/null +++ b/internal/endtoend/testdata/func_return_record/postgresql/pgx/query.sql @@ -0,0 +1,4 @@ +-- name: GetData :one +SELECT key, value +FROM my_table, jsonb_each(data) +LIMIT 1; diff --git a/internal/endtoend/testdata/func_return_record/postgresql/pgx/schema.sql b/internal/endtoend/testdata/func_return_record/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..4db45f9723 --- /dev/null +++ b/internal/endtoend/testdata/func_return_record/postgresql/pgx/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE my_table ( + data JSONB NOT NULL +); diff --git a/internal/endtoend/testdata/func_return_record/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/func_return_record/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/func_return_record/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..3895084dc3 --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest diff --git a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/go/query.sql.go new file mode 100644 index 0000000000..a976e628cf --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,41 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const generateSeries = `-- name: GenerateSeries :many +SELECT ($1::int) + i +FROM generate_series(0, $2::int) AS i +LIMIT 1 +` + +type GenerateSeriesParams struct { + Column1 int32 + Column2 int32 +} + +func (q *Queries) GenerateSeries(ctx context.Context, arg GenerateSeriesParams) ([]int32, error) { + rows, err := q.db.Query(ctx, generateSeries, arg.Column1, arg.Column2) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var column_1 int32 + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..ac5a434493 --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/query.sql @@ -0,0 +1,4 @@ +/* name: GenerateSeries :many */ +SELECT ($1::int) + i +FROM generate_series(0, $2::int) AS i +LIMIT 1; diff --git a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/func_return/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/sqlc.json similarity index 100% rename from internal/endtoend/testdata/func_return/postgresql/pgx/v4/sqlc.json rename to internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/sqlc.json diff --git a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest diff --git a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/go/query.sql.go new file mode 100644 index 0000000000..a976e628cf --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,41 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const generateSeries = `-- name: GenerateSeries :many +SELECT ($1::int) + i +FROM generate_series(0, $2::int) AS i +LIMIT 1 +` + +type GenerateSeriesParams struct { + Column1 int32 + Column2 int32 +} + +func (q *Queries) GenerateSeries(ctx context.Context, arg GenerateSeriesParams) ([]int32, error) { + rows, err := q.db.Query(ctx, generateSeries, arg.Column1, arg.Column2) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var column_1 int32 + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..ac5a434493 --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/query.sql @@ -0,0 +1,4 @@ +/* name: GenerateSeries :many */ +SELECT ($1::int) + i +FROM generate_series(0, $2::int) AS i +LIMIT 1; diff --git a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v5", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest diff --git a/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/query.sql.go new file mode 100644 index 0000000000..ab90ac0a03 --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,44 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const generateSeries = `-- name: GenerateSeries :many +SELECT ($1::int) + i +FROM generate_series(0, $2::int) AS i +LIMIT 1 +` + +type GenerateSeriesParams struct { + Column1 int32 + Column2 int32 +} + +func (q *Queries) GenerateSeries(ctx context.Context, arg GenerateSeriesParams) ([]int32, error) { + rows, err := q.db.QueryContext(ctx, generateSeries, arg.Column1, arg.Column2) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var column_1 int32 + if err := rows.Scan(&column_1); err != nil { + return nil, err + } + items = append(items, column_1) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/func_return_series/postgresql/stdlib/query.sql b/internal/endtoend/testdata/func_return_series/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..ac5a434493 --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/postgresql/stdlib/query.sql @@ -0,0 +1,4 @@ +/* name: GenerateSeries :many */ +SELECT ($1::int) + i +FROM generate_series(0, $2::int) AS i +LIMIT 1; diff --git a/internal/endtoend/testdata/func_return_series/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/func_return_series/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/func_return_series/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/func_return_series/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/postgresql/stdlib/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/func_return_table/issue.md b/internal/endtoend/testdata/func_return_table/issue.md new file mode 100644 index 0000000000..119a3cd987 --- /dev/null +++ b/internal/endtoend/testdata/func_return_table/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1322 diff --git a/internal/endtoend/testdata/func_return_table/postgresql/pgx/exec.json b/internal/endtoend/testdata/func_return_table/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/func_return_table/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/func_return_table/postgresql/pgx/go/db.go b/internal/endtoend/testdata/func_return_table/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/func_return_table/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/func_return_table/postgresql/pgx/go/models.go b/internal/endtoend/testdata/func_return_table/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..c99cf3d8af --- /dev/null +++ b/internal/endtoend/testdata/func_return_table/postgresql/pgx/go/models.go @@ -0,0 +1,11 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Account struct { + ID int32 + Username string + Password string +} diff --git a/internal/endtoend/testdata/func_return_table/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/func_return_table/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..2d9be96f4b --- /dev/null +++ b/internal/endtoend/testdata/func_return_table/postgresql/pgx/go/query.sql.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const foo = `-- name: Foo :one +SELECT register_account FROM register_account('a', 'b') +` + +func (q *Queries) Foo(ctx context.Context) (pgtype.Int4, error) { + row := q.db.QueryRow(ctx, foo) + var register_account pgtype.Int4 + err := row.Scan(®ister_account) + return register_account, err +} diff --git a/internal/endtoend/testdata/func_return_table/postgresql/pgx/query.sql b/internal/endtoend/testdata/func_return_table/postgresql/pgx/query.sql new file mode 100644 index 0000000000..8a3db0f6d8 --- /dev/null +++ b/internal/endtoend/testdata/func_return_table/postgresql/pgx/query.sql @@ -0,0 +1,2 @@ +-- name: Foo :one +SELECT * FROM register_account('a', 'b'); diff --git a/internal/endtoend/testdata/func_return_table/postgresql/pgx/schema.sql b/internal/endtoend/testdata/func_return_table/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..e9ebf5e423 --- /dev/null +++ b/internal/endtoend/testdata/func_return_table/postgresql/pgx/schema.sql @@ -0,0 +1,27 @@ +CREATE TABLE accounts ( + id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + username TEXT NOT NULL UNIQUE, + password TEXT NOT NULL +); + +-- this is a useless and horrifying function cause we don't hash +-- the password, this is just to repro the bug in sqlc +CREATE OR REPLACE FUNCTION register_account( + _username TEXT, + _password VARCHAR(70) +) +RETURNS TABLE ( + account_id INTEGER +) +AS $$ +BEGIN + INSERT INTO accounts (username, password) + VALUES ( + _username, + _password + ) + RETURNING id INTO account_id; + + RETURN NEXT; +END; +$$ LANGUAGE plpgsql; diff --git a/internal/endtoend/testdata/func_return_table/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/func_return_table/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/func_return_table/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/func_return_table_columns/issue.md b/internal/endtoend/testdata/func_return_table_columns/issue.md new file mode 100644 index 0000000000..ec4e1128f7 --- /dev/null +++ b/internal/endtoend/testdata/func_return_table_columns/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/2386 diff --git a/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/exec.json b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/go/db.go b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/go/models.go b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..85bf9ee12f --- /dev/null +++ b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Blog struct { + ID int32 + Name string +} diff --git a/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..03818a02f4 --- /dev/null +++ b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/go/query.sql.go @@ -0,0 +1,41 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const testFuncSelectBlog = `-- name: TestFuncSelectBlog :many +select id, name from test_select_blog($1) +` + +type TestFuncSelectBlogRow struct { + ID pgtype.Int4 + Name pgtype.Text +} + +func (q *Queries) TestFuncSelectBlog(ctx context.Context, pID int32) ([]TestFuncSelectBlogRow, error) { + rows, err := q.db.Query(ctx, testFuncSelectBlog, pID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []TestFuncSelectBlogRow + for rows.Next() { + var i TestFuncSelectBlogRow + if err := rows.Scan(&i.ID, &i.Name); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/query.sql b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/query.sql new file mode 100644 index 0000000000..73e2396558 --- /dev/null +++ b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/query.sql @@ -0,0 +1,2 @@ +-- name: TestFuncSelectBlog :many +select id, name from test_select_blog($1); diff --git a/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/schema.sql b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..ccf032e687 --- /dev/null +++ b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/schema.sql @@ -0,0 +1,11 @@ +create table blog ( + id serial primary key, + name text not null +); + +create function test_select_blog(in p_id int) + returns table (id int, name text) AS $$ +BEGIN RETURN QUERY + select id, name from blog where id = p_id; +END; +$$ language plpgsql; diff --git a/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/func_star_expansion/issue.md b/internal/endtoend/testdata/func_star_expansion/issue.md new file mode 100644 index 0000000000..c9b8798441 --- /dev/null +++ b/internal/endtoend/testdata/func_star_expansion/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/2364 diff --git a/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/exec.json b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/go/db.go b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/go/models.go b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest diff --git a/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..8eca49cebe --- /dev/null +++ b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/go/query.sql.go @@ -0,0 +1,45 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const testFuncGetTime = `-- name: TestFuncGetTime :one +select test_func_get_time from test_func_get_time() +` + +func (q *Queries) TestFuncGetTime(ctx context.Context) (pgtype.Timestamp, error) { + row := q.db.QueryRow(ctx, testFuncGetTime) + var test_func_get_time pgtype.Timestamp + err := row.Scan(&test_func_get_time) + return test_func_get_time, err +} + +const testFuncSelectBlog = `-- name: TestFuncSelectBlog :one +select test_func_select_blog from test_func_select_blog($1) +` + +func (q *Queries) TestFuncSelectBlog(ctx context.Context, pID int32) (interface{}, error) { + row := q.db.QueryRow(ctx, testFuncSelectBlog, pID) + var test_func_select_blog interface{} + err := row.Scan(&test_func_select_blog) + return test_func_select_blog, err +} + +const testFuncSelectString = `-- name: TestFuncSelectString :one +select test_func_select_string from test_func_select_string($1) +` + +func (q *Queries) TestFuncSelectString(ctx context.Context, pString string) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, testFuncSelectString, pString) + var test_func_select_string pgtype.Text + err := row.Scan(&test_func_select_string) + return test_func_select_string, err +} diff --git a/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/query.sql b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/query.sql new file mode 100644 index 0000000000..edb27a30f5 --- /dev/null +++ b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/query.sql @@ -0,0 +1,8 @@ +-- name: TestFuncGetTime :one +select * from test_func_get_time(); + +-- name: TestFuncSelectString :one +select * from test_func_select_string($1); + +-- name: TestFuncSelectBlog :one +select * from test_func_select_blog($1); diff --git a/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/schema.sql b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..eb3de78724 --- /dev/null +++ b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/schema.sql @@ -0,0 +1,20 @@ +create function test_func_get_time () + returns timestamp AS $$ +Begin + return now(); +End; +$$ language plpgsql; + +create function test_func_select_string (in p_string text) + returns text AS $$ +Begin + return p_string; +End; +$$ language plpgsql; + +create function test_func_select_blog(in p_id int) + returns table (id int, name text, created_at timestamp, updated_at timestamp) AS $$ +BEGIN RETURN QUERY + select id, name, created_at, updated_at from blog where id = p_id; +END; +$$ language plpgsql; diff --git a/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/models.go index ed6b9bda7f..62625b2dd2 100644 --- a/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/query.sql.go index 5ad9d9edda..a4938a4241 100644 --- a/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -14,25 +14,25 @@ const updateJ = `-- name: UpdateJ :exec UPDATE test SET - j = jsonb_build_object($1, $2, $3, $4) + j = jsonb_build_object($1::text, $2::text, $3::text, $4::text) WHERE id = $5 ` type UpdateJParams struct { - JsonbBuildObject interface{} - JsonbBuildObject_2 interface{} - JsonbBuildObject_3 interface{} - JsonbBuildObject_4 interface{} - ID sql.NullInt32 + Column1 string + Column2 string + Column3 string + Column4 string + ID sql.NullInt32 } func (q *Queries) UpdateJ(ctx context.Context, arg UpdateJParams) error { _, err := q.db.ExecContext(ctx, updateJ, - arg.JsonbBuildObject, - arg.JsonbBuildObject_2, - arg.JsonbBuildObject_3, - arg.JsonbBuildObject_4, + arg.Column1, + arg.Column2, + arg.Column3, + arg.Column4, arg.ID, ) return err diff --git a/internal/endtoend/testdata/func_variadic/postgresql/stdlib/query.sql b/internal/endtoend/testdata/func_variadic/postgresql/stdlib/query.sql index 63298cb46d..235e7cbb90 100644 --- a/internal/endtoend/testdata/func_variadic/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/func_variadic/postgresql/stdlib/query.sql @@ -1,12 +1,7 @@ -CREATE TABLE test ( - id integer, - j jsonb NOT NULL - ); - -- name: UpdateJ :exec UPDATE test SET - j = jsonb_build_object($1, $2, $3, $4) + j = jsonb_build_object($1::text, $2::text, $3::text, $4::text) WHERE id = $5; \ No newline at end of file diff --git a/internal/endtoend/testdata/func_variadic/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/func_variadic/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..6fdd78b6ed --- /dev/null +++ b/internal/endtoend/testdata/func_variadic/postgresql/stdlib/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE test ( + id integer, + j jsonb NOT NULL + ); + diff --git a/internal/endtoend/testdata/func_variadic/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/func_variadic/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/func_variadic/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/func_variadic/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/geometric/pgx/v4/go/db.go b/internal/endtoend/testdata/geometric/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/geometric/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/geometric/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/geometric/pgx/v4/go/models.go b/internal/endtoend/testdata/geometric/pgx/v4/go/models.go index 8075221739..1e9ad482a6 100644 --- a/internal/endtoend/testdata/geometric/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/geometric/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/geometric/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/geometric/pgx/v4/go/query.sql.go index 5121a4e820..164284d0a1 100644 --- a/internal/endtoend/testdata/geometric/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/geometric/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/geometric/pgx/v4/query.sql b/internal/endtoend/testdata/geometric/pgx/v4/query.sql index e6084a0026..3ab56eee50 100644 --- a/internal/endtoend/testdata/geometric/pgx/v4/query.sql +++ b/internal/endtoend/testdata/geometric/pgx/v4/query.sql @@ -1,21 +1,3 @@ -CREATE TABLE test_table -( - v_box_null box, - v_circle_null circle, - v_line_null line, - v_lseg_null lseg, - v_path_null path, - v_point_null point, - v_polygon_null polygon, - v_box box not null, - v_circle circle not null, - v_line line not null, - v_lseg lseg not null, - v_path path not null, - v_point point not null, - v_polygon polygon not null -); - -- name: SelectTest :many SELECT * from test_table; diff --git a/internal/endtoend/testdata/geometric/pgx/v4/schema.sql b/internal/endtoend/testdata/geometric/pgx/v4/schema.sql new file mode 100644 index 0000000000..78a5f2109e --- /dev/null +++ b/internal/endtoend/testdata/geometric/pgx/v4/schema.sql @@ -0,0 +1,18 @@ +CREATE TABLE test_table +( + v_box_null box, + v_circle_null circle, + v_line_null line, + v_lseg_null lseg, + v_path_null path, + v_point_null point, + v_polygon_null polygon, + v_box box not null, + v_circle circle not null, + v_line line not null, + v_lseg lseg not null, + v_path path not null, + v_point point not null, + v_polygon polygon not null +); + diff --git a/internal/endtoend/testdata/geometric/pgx/v4/sqlc.json b/internal/endtoend/testdata/geometric/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/geometric/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/geometric/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/geometric/pgx/v5/go/db.go b/internal/endtoend/testdata/geometric/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/geometric/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/geometric/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/geometric/pgx/v5/go/models.go b/internal/endtoend/testdata/geometric/pgx/v5/go/models.go index bd1635c461..82d4b4dfa9 100644 --- a/internal/endtoend/testdata/geometric/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/geometric/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/geometric/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/geometric/pgx/v5/go/query.sql.go index 5121a4e820..164284d0a1 100644 --- a/internal/endtoend/testdata/geometric/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/geometric/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/geometric/pgx/v5/query.sql b/internal/endtoend/testdata/geometric/pgx/v5/query.sql index e6084a0026..3ab56eee50 100644 --- a/internal/endtoend/testdata/geometric/pgx/v5/query.sql +++ b/internal/endtoend/testdata/geometric/pgx/v5/query.sql @@ -1,21 +1,3 @@ -CREATE TABLE test_table -( - v_box_null box, - v_circle_null circle, - v_line_null line, - v_lseg_null lseg, - v_path_null path, - v_point_null point, - v_polygon_null polygon, - v_box box not null, - v_circle circle not null, - v_line line not null, - v_lseg lseg not null, - v_path path not null, - v_point point not null, - v_polygon polygon not null -); - -- name: SelectTest :many SELECT * from test_table; diff --git a/internal/endtoend/testdata/geometric/pgx/v5/schema.sql b/internal/endtoend/testdata/geometric/pgx/v5/schema.sql new file mode 100644 index 0000000000..78a5f2109e --- /dev/null +++ b/internal/endtoend/testdata/geometric/pgx/v5/schema.sql @@ -0,0 +1,18 @@ +CREATE TABLE test_table +( + v_box_null box, + v_circle_null circle, + v_line_null line, + v_lseg_null lseg, + v_path_null path, + v_point_null point, + v_polygon_null polygon, + v_box box not null, + v_circle circle not null, + v_line line not null, + v_lseg lseg not null, + v_path path not null, + v_point point not null, + v_polygon polygon not null +); + diff --git a/internal/endtoend/testdata/geometric/pgx/v5/sqlc.json b/internal/endtoend/testdata/geometric/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/geometric/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/geometric/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/go.mod b/internal/endtoend/testdata/go.mod index 535a3b8d29..e2a7ea704b 100644 --- a/internal/endtoend/testdata/go.mod +++ b/internal/endtoend/testdata/go.mod @@ -10,7 +10,7 @@ require ( github.com/jackc/pgconn v1.5.1-0.20200601181101-fa742c524853 github.com/jackc/pgtype v1.6.2 github.com/jackc/pgx/v4 v4.6.1-0.20200606145419-4e5062306904 - github.com/jackc/pgx/v5 v5.0.1 + github.com/jackc/pgx/v5 v5.4.3 github.com/lib/pq v1.9.0 github.com/sqlc-dev/pqtype v0.2.0 github.com/sqlc-dev/sqlc-testdata v1.0.0 @@ -24,11 +24,12 @@ require ( github.com/jackc/pgio v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgproto3/v2 v2.0.1 // indirect - github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect + github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect + github.com/pgvector/pgvector-go v0.1.1 // indirect github.com/volatiletech/inflect v0.0.1 // indirect github.com/volatiletech/randomize v0.0.1 // indirect github.com/volatiletech/strmangle v0.0.1 // indirect - golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect - golang.org/x/text v0.3.7 // indirect - golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 // indirect + golang.org/x/crypto v0.9.0 // indirect + golang.org/x/text v0.9.0 // indirect + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect ) diff --git a/internal/endtoend/testdata/go.sum b/internal/endtoend/testdata/go.sum index a1cc055483..a5819e0a3b 100644 --- a/internal/endtoend/testdata/go.sum +++ b/internal/endtoend/testdata/go.sum @@ -47,6 +47,8 @@ github.com/jackc/pgproto3/v2 v2.0.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwX github.com/jackc/pgservicefile v0.0.0-20200307190119-3430c5407db8/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg= github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= +github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk= +github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg= github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc= github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw= @@ -64,6 +66,10 @@ github.com/jackc/pgx/v4 v4.6.1-0.20200606145419-4e5062306904 h1:SdGWuGg+Cpxq6Z+A github.com/jackc/pgx/v4 v4.6.1-0.20200606145419-4e5062306904/go.mod h1:ZDaNWkt9sW1JMiNn0kdYBaLelIhw7Pg4qd+Vk6tw7Hg= github.com/jackc/pgx/v5 v5.0.1 h1:JZu9othr7l8so2JMDAGeDUMXqERAuZpovyfl4H50tdg= github.com/jackc/pgx/v5 v5.0.1/go.mod h1:JBbvW3Hdw77jKl9uJrEDATUZIFM2VFPzRq4RWIhkF4o= +github.com/jackc/pgx/v5 v5.3.1 h1:Fcr8QJ1ZeLi5zsPZqQeUZhNhxfkkKBOgJuYkJHoBOtU= +github.com/jackc/pgx/v5 v5.3.1/go.mod h1:t3JDKnCBlYIc0ewLF0Q7B8MXmoIaBOZj/ic7iHozM/8= +github.com/jackc/pgx/v5 v5.4.3 h1:cxFyXhxlvAifxnkKKdlxv8XqUf59tDlYjnV5YYfsJJY= +github.com/jackc/pgx/v5 v5.4.3/go.mod h1:Ig06C2Vu0t5qXC60W8sqIthScaEnFvojjj9dSljmHRA= github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= @@ -89,6 +95,8 @@ github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/pgvector/pgvector-go v0.1.1 h1:kqJigGctFnlWvskUiYIvJRNwUtQl/aMSUZVs0YWQe+g= +github.com/pgvector/pgvector-go v0.1.1/go.mod h1:wLJgD/ODkdtd2LJK4l6evHXTuG+8PxymYAVomKHOWac= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -114,6 +122,7 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/volatiletech/inflect v0.0.1 h1:2a6FcMQyhmPZcLa+uet3VJ8gLn/9svWhJxJYwvE8KsU= github.com/volatiletech/inflect v0.0.1/go.mod h1:IBti31tG6phkHitLlr5j7shC5SOo//x0AjDzaJU1PLA= @@ -140,6 +149,9 @@ golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 h1:Y/gsMcFOcR+6S6f3YeMKl5g+dZMEWqcz5Czj/GWYbkM= golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= +golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -161,6 +173,10 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= @@ -173,6 +189,8 @@ golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= @@ -180,5 +198,6 @@ gopkg.in/guregu/null.v4 v4.0.0 h1:1Wm3S1WEA2I26Kq+6vcW+w0gcDo44YKYD7YIEJNHDjg= gopkg.in/guregu/null.v4 v4.0.0/go.mod h1:YoQhUrADuG3i9WqesrCmpNRwm1ypAgSHYqoOcTu/JrI= gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= diff --git a/internal/endtoend/testdata/golang_initialisms_empty/db/db.go b/internal/endtoend/testdata/golang_initialisms_empty/db/db.go new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/golang_initialisms_empty/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/golang_initialisms_empty/db/models.go b/internal/endtoend/testdata/golang_initialisms_empty/db/models.go new file mode 100644 index 0000000000..bf7f3fdc5b --- /dev/null +++ b/internal/endtoend/testdata/golang_initialisms_empty/db/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "database/sql" +) + +type Foo struct { + BarId sql.NullString +} diff --git a/internal/endtoend/testdata/golang_initialisms_empty/db/query.sql.go b/internal/endtoend/testdata/golang_initialisms_empty/db/query.sql.go new file mode 100644 index 0000000000..426a750297 --- /dev/null +++ b/internal/endtoend/testdata/golang_initialisms_empty/db/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" + "database/sql" +) + +const selectFoo = `-- name: SelectFoo :many +SELECT bar_id FROM foo +` + +func (q *Queries) SelectFoo(ctx context.Context) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, selectFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var bar_id sql.NullString + if err := rows.Scan(&bar_id); err != nil { + return nil, err + } + items = append(items, bar_id) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/golang_initialisms_empty/query.sql b/internal/endtoend/testdata/golang_initialisms_empty/query.sql new file mode 100644 index 0000000000..e32e926b32 --- /dev/null +++ b/internal/endtoend/testdata/golang_initialisms_empty/query.sql @@ -0,0 +1,2 @@ +-- name: SelectFoo :many +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/golang_initialisms_empty/schema.sql b/internal/endtoend/testdata/golang_initialisms_empty/schema.sql new file mode 100644 index 0000000000..fe692b6af6 --- /dev/null +++ b/internal/endtoend/testdata/golang_initialisms_empty/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo( + bar_id text +); diff --git a/internal/endtoend/testdata/golang_initialisms_empty/sqlc.json b/internal/endtoend/testdata/golang_initialisms_empty/sqlc.json new file mode 100644 index 0000000000..02ab2e395c --- /dev/null +++ b/internal/endtoend/testdata/golang_initialisms_empty/sqlc.json @@ -0,0 +1,16 @@ +{ + "version": "2", + "sql": [ + { + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "gen": { + "go": { + "out": "db", + "initialisms": [] + } + } + } + ] +} diff --git a/internal/endtoend/testdata/golang_initialisms_url/db/db.go b/internal/endtoend/testdata/golang_initialisms_url/db/db.go new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/golang_initialisms_url/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/golang_initialisms_url/db/models.go b/internal/endtoend/testdata/golang_initialisms_url/db/models.go new file mode 100644 index 0000000000..3062c6ad8e --- /dev/null +++ b/internal/endtoend/testdata/golang_initialisms_url/db/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "database/sql" +) + +type Foo struct { + BarID sql.NullString + SiteURL sql.NullString +} diff --git a/internal/endtoend/testdata/golang_initialisms_url/db/query.sql.go b/internal/endtoend/testdata/golang_initialisms_url/db/query.sql.go new file mode 100644 index 0000000000..a7c5349dab --- /dev/null +++ b/internal/endtoend/testdata/golang_initialisms_url/db/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" +) + +const selectFoo = `-- name: SelectFoo :many +SELECT bar_id, site_url FROM foo +` + +func (q *Queries) SelectFoo(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, selectFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.BarID, &i.SiteURL); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/golang_initialisms_url/query.sql b/internal/endtoend/testdata/golang_initialisms_url/query.sql new file mode 100644 index 0000000000..e32e926b32 --- /dev/null +++ b/internal/endtoend/testdata/golang_initialisms_url/query.sql @@ -0,0 +1,2 @@ +-- name: SelectFoo :many +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/golang_initialisms_url/schema.sql b/internal/endtoend/testdata/golang_initialisms_url/schema.sql new file mode 100644 index 0000000000..d0b2506904 --- /dev/null +++ b/internal/endtoend/testdata/golang_initialisms_url/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE foo ( + bar_id text, + site_url text +); diff --git a/internal/endtoend/testdata/golang_initialisms_url/sqlc.json b/internal/endtoend/testdata/golang_initialisms_url/sqlc.json new file mode 100644 index 0000000000..2b135eec3e --- /dev/null +++ b/internal/endtoend/testdata/golang_initialisms_url/sqlc.json @@ -0,0 +1,16 @@ +{ + "version": "2", + "sql": [ + { + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "gen": { + "go": { + "out": "db", + "initialisms": ["id", "url"] + } + } + } + ] +} diff --git a/internal/endtoend/testdata/golang_invalid_sql_driver/db/db.go b/internal/endtoend/testdata/golang_invalid_sql_driver/db/db.go new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/golang_invalid_sql_driver/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/golang_invalid_sql_driver/db/models.go b/internal/endtoend/testdata/golang_invalid_sql_driver/db/models.go new file mode 100644 index 0000000000..69bf4b51b6 --- /dev/null +++ b/internal/endtoend/testdata/golang_invalid_sql_driver/db/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullString +} diff --git a/internal/endtoend/testdata/golang_invalid_sql_driver/db/query.sql.go b/internal/endtoend/testdata/golang_invalid_sql_driver/db/query.sql.go new file mode 100644 index 0000000000..a5c350affa --- /dev/null +++ b/internal/endtoend/testdata/golang_invalid_sql_driver/db/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" + "database/sql" +) + +const selectFoo = `-- name: SelectFoo :many +SELECT bar FROM foo +` + +func (q *Queries) SelectFoo(ctx context.Context) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, selectFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var bar sql.NullString + if err := rows.Scan(&bar); err != nil { + return nil, err + } + items = append(items, bar) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/golang_invalid_sql_driver/query.sql b/internal/endtoend/testdata/golang_invalid_sql_driver/query.sql new file mode 100644 index 0000000000..e32e926b32 --- /dev/null +++ b/internal/endtoend/testdata/golang_invalid_sql_driver/query.sql @@ -0,0 +1,2 @@ +-- name: SelectFoo :many +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/golang_invalid_sql_driver/schema.sql b/internal/endtoend/testdata/golang_invalid_sql_driver/schema.sql new file mode 100644 index 0000000000..1bd72529f8 --- /dev/null +++ b/internal/endtoend/testdata/golang_invalid_sql_driver/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo( + bar text +); diff --git a/internal/endtoend/testdata/golang_invalid_sql_driver/sqlc.json b/internal/endtoend/testdata/golang_invalid_sql_driver/sqlc.json new file mode 100644 index 0000000000..6124f178d1 --- /dev/null +++ b/internal/endtoend/testdata/golang_invalid_sql_driver/sqlc.json @@ -0,0 +1,16 @@ +{ + "version": "2", + "sql": [ + { + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "gen": { + "go": { + "out": "db", + "sql_driver": "github.com/unknown/driver" + } + } + } + ] +} diff --git a/internal/endtoend/testdata/golang_invalid_sql_driver/stderr.txt b/internal/endtoend/testdata/golang_invalid_sql_driver/stderr.txt new file mode 100644 index 0000000000..b71f130a2f --- /dev/null +++ b/internal/endtoend/testdata/golang_invalid_sql_driver/stderr.txt @@ -0,0 +1,2 @@ +# package +error generating code: invalid options: unknown SQL driver: github.com/unknown/driver diff --git a/internal/endtoend/testdata/golang_invalid_sql_package/db/db.go b/internal/endtoend/testdata/golang_invalid_sql_package/db/db.go new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/golang_invalid_sql_package/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/golang_invalid_sql_package/db/models.go b/internal/endtoend/testdata/golang_invalid_sql_package/db/models.go new file mode 100644 index 0000000000..69bf4b51b6 --- /dev/null +++ b/internal/endtoend/testdata/golang_invalid_sql_package/db/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullString +} diff --git a/internal/endtoend/testdata/golang_invalid_sql_package/db/query.sql.go b/internal/endtoend/testdata/golang_invalid_sql_package/db/query.sql.go new file mode 100644 index 0000000000..a5c350affa --- /dev/null +++ b/internal/endtoend/testdata/golang_invalid_sql_package/db/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" + "database/sql" +) + +const selectFoo = `-- name: SelectFoo :many +SELECT bar FROM foo +` + +func (q *Queries) SelectFoo(ctx context.Context) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, selectFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var bar sql.NullString + if err := rows.Scan(&bar); err != nil { + return nil, err + } + items = append(items, bar) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/golang_invalid_sql_package/query.sql b/internal/endtoend/testdata/golang_invalid_sql_package/query.sql new file mode 100644 index 0000000000..e32e926b32 --- /dev/null +++ b/internal/endtoend/testdata/golang_invalid_sql_package/query.sql @@ -0,0 +1,2 @@ +-- name: SelectFoo :many +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/golang_invalid_sql_package/schema.sql b/internal/endtoend/testdata/golang_invalid_sql_package/schema.sql new file mode 100644 index 0000000000..e29621be57 --- /dev/null +++ b/internal/endtoend/testdata/golang_invalid_sql_package/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo ( + bar text +); diff --git a/internal/endtoend/testdata/golang_invalid_sql_package/sqlc.json b/internal/endtoend/testdata/golang_invalid_sql_package/sqlc.json new file mode 100644 index 0000000000..a6c726061c --- /dev/null +++ b/internal/endtoend/testdata/golang_invalid_sql_package/sqlc.json @@ -0,0 +1,16 @@ +{ + "version": "2", + "sql": [ + { + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "gen": { + "go": { + "out": "db", + "sql_package": "pgx/5" + } + } + } + ] +} diff --git a/internal/endtoend/testdata/golang_invalid_sql_package/stderr.txt b/internal/endtoend/testdata/golang_invalid_sql_package/stderr.txt new file mode 100644 index 0000000000..249ae167b7 --- /dev/null +++ b/internal/endtoend/testdata/golang_invalid_sql_package/stderr.txt @@ -0,0 +1,2 @@ +# package +error generating code: invalid options: unknown SQL package: pgx/5 diff --git a/internal/endtoend/testdata/having/mysql/go/db.go b/internal/endtoend/testdata/having/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/having/mysql/go/db.go +++ b/internal/endtoend/testdata/having/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/having/mysql/go/models.go b/internal/endtoend/testdata/having/mysql/go/models.go index 38eab129b5..857d2a81f2 100644 --- a/internal/endtoend/testdata/having/mysql/go/models.go +++ b/internal/endtoend/testdata/having/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Weather struct { City string TempLo int32 diff --git a/internal/endtoend/testdata/having/mysql/go/query.sql.go b/internal/endtoend/testdata/having/mysql/go/query.sql.go index 19f0c86407..3dbecd981c 100644 --- a/internal/endtoend/testdata/having/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/having/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/having/mysql/query.sql b/internal/endtoend/testdata/having/mysql/query.sql index fd0dfe0694..b234352fba 100644 --- a/internal/endtoend/testdata/having/mysql/query.sql +++ b/internal/endtoend/testdata/having/mysql/query.sql @@ -1,8 +1,3 @@ -CREATE TABLE weather ( - city text NOT NULL, - temp_lo integer NOT NULL -); - -- name: ColdCities :many SELECT city FROM weather diff --git a/internal/endtoend/testdata/having/mysql/schema.sql b/internal/endtoend/testdata/having/mysql/schema.sql new file mode 100644 index 0000000000..b9e4261fce --- /dev/null +++ b/internal/endtoend/testdata/having/mysql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE weather ( + city text NOT NULL, + temp_lo integer NOT NULL +); + diff --git a/internal/endtoend/testdata/having/mysql/sqlc.json b/internal/endtoend/testdata/having/mysql/sqlc.json index 534b7e24e9..0390f67889 100644 --- a/internal/endtoend/testdata/having/mysql/sqlc.json +++ b/internal/endtoend/testdata/having/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/having/postgresql/go/db.go b/internal/endtoend/testdata/having/postgresql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/having/postgresql/go/db.go +++ b/internal/endtoend/testdata/having/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/having/postgresql/go/models.go b/internal/endtoend/testdata/having/postgresql/go/models.go index 38eab129b5..857d2a81f2 100644 --- a/internal/endtoend/testdata/having/postgresql/go/models.go +++ b/internal/endtoend/testdata/having/postgresql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Weather struct { City string TempLo int32 diff --git a/internal/endtoend/testdata/having/postgresql/go/query.sql.go b/internal/endtoend/testdata/having/postgresql/go/query.sql.go index e1847c36b5..64f6b38ca9 100644 --- a/internal/endtoend/testdata/having/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/having/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/having/postgresql/query.sql b/internal/endtoend/testdata/having/postgresql/query.sql index 9e079fd2fe..5861dbab23 100644 --- a/internal/endtoend/testdata/having/postgresql/query.sql +++ b/internal/endtoend/testdata/having/postgresql/query.sql @@ -1,8 +1,3 @@ -CREATE TABLE weather ( - city text NOT NULL, - temp_lo integer NOT NULL -); - -- name: ColdCities :many SELECT city FROM weather diff --git a/internal/endtoend/testdata/having/postgresql/schema.sql b/internal/endtoend/testdata/having/postgresql/schema.sql new file mode 100644 index 0000000000..b9e4261fce --- /dev/null +++ b/internal/endtoend/testdata/having/postgresql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE weather ( + city text NOT NULL, + temp_lo integer NOT NULL +); + diff --git a/internal/endtoend/testdata/having/postgresql/sqlc.json b/internal/endtoend/testdata/having/postgresql/sqlc.json index af57681f66..a590361309 100644 --- a/internal/endtoend/testdata/having/postgresql/sqlc.json +++ b/internal/endtoend/testdata/having/postgresql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/hstore/pgx/v4/go/db.go b/internal/endtoend/testdata/hstore/pgx/v4/go/db.go index e41a53991b..3b95a6875a 100644 --- a/internal/endtoend/testdata/hstore/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/hstore/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package hstore diff --git a/internal/endtoend/testdata/hstore/pgx/v4/go/hstore.sql.go b/internal/endtoend/testdata/hstore/pgx/v4/go/hstore.sql.go index 0e92fbfeb9..0d38588e84 100644 --- a/internal/endtoend/testdata/hstore/pgx/v4/go/hstore.sql.go +++ b/internal/endtoend/testdata/hstore/pgx/v4/go/hstore.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: hstore.sql package hstore diff --git a/internal/endtoend/testdata/hstore/pgx/v4/go/models.go b/internal/endtoend/testdata/hstore/pgx/v4/go/models.go index c660d29bb8..a736165f20 100644 --- a/internal/endtoend/testdata/hstore/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/hstore/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package hstore diff --git a/internal/endtoend/testdata/hstore/pgx/v5/go/db.go b/internal/endtoend/testdata/hstore/pgx/v5/go/db.go index 5c25c07044..77d5163554 100644 --- a/internal/endtoend/testdata/hstore/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/hstore/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package hstore diff --git a/internal/endtoend/testdata/hstore/pgx/v5/go/hstore.sql.go b/internal/endtoend/testdata/hstore/pgx/v5/go/hstore.sql.go index bf4432f91a..d97408441d 100644 --- a/internal/endtoend/testdata/hstore/pgx/v5/go/hstore.sql.go +++ b/internal/endtoend/testdata/hstore/pgx/v5/go/hstore.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: hstore.sql package hstore diff --git a/internal/endtoend/testdata/hstore/pgx/v5/go/models.go b/internal/endtoend/testdata/hstore/pgx/v5/go/models.go index 9202feb84b..3a6e4a1287 100644 --- a/internal/endtoend/testdata/hstore/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/hstore/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package hstore diff --git a/internal/endtoend/testdata/hstore/stdlib/go/db.go b/internal/endtoend/testdata/hstore/stdlib/go/db.go index bc8e1713d8..ae55290586 100644 --- a/internal/endtoend/testdata/hstore/stdlib/go/db.go +++ b/internal/endtoend/testdata/hstore/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package hstore diff --git a/internal/endtoend/testdata/hstore/stdlib/go/hstore.sql.go b/internal/endtoend/testdata/hstore/stdlib/go/hstore.sql.go index 3d1312f195..0fb01ca1c2 100644 --- a/internal/endtoend/testdata/hstore/stdlib/go/hstore.sql.go +++ b/internal/endtoend/testdata/hstore/stdlib/go/hstore.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: hstore.sql package hstore diff --git a/internal/endtoend/testdata/hstore/stdlib/go/models.go b/internal/endtoend/testdata/hstore/stdlib/go/models.go index 6b11866054..8fcd53858d 100644 --- a/internal/endtoend/testdata/hstore/stdlib/go/models.go +++ b/internal/endtoend/testdata/hstore/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package hstore -import () - type Foo struct { Bar interface{} Baz interface{} diff --git a/internal/endtoend/testdata/identical_tables/mysql/go/db.go b/internal/endtoend/testdata/identical_tables/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/identical_tables/mysql/go/db.go +++ b/internal/endtoend/testdata/identical_tables/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/identical_tables/mysql/go/models.go b/internal/endtoend/testdata/identical_tables/mysql/go/models.go index 26342a2ed7..962e8d9e66 100644 --- a/internal/endtoend/testdata/identical_tables/mysql/go/models.go +++ b/internal/endtoend/testdata/identical_tables/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID string } diff --git a/internal/endtoend/testdata/identical_tables/mysql/go/query.sql.go b/internal/endtoend/testdata/identical_tables/mysql/go/query.sql.go index 548417408e..3d72df8d22 100644 --- a/internal/endtoend/testdata/identical_tables/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/identical_tables/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/identical_tables/mysql/query.sql b/internal/endtoend/testdata/identical_tables/mysql/query.sql index c995d0f183..2e71d9a787 100644 --- a/internal/endtoend/testdata/identical_tables/mysql/query.sql +++ b/internal/endtoend/testdata/identical_tables/mysql/query.sql @@ -1,5 +1,2 @@ -CREATE TABLE foo (id text not null); -CREATE TABLE bar (id text not null); - -- name: IdenticalTable :many SELECT * FROM foo; diff --git a/internal/endtoend/testdata/identical_tables/mysql/schema.sql b/internal/endtoend/testdata/identical_tables/mysql/schema.sql new file mode 100644 index 0000000000..0dbf9f6910 --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/mysql/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (id text not null); +CREATE TABLE bar (id text not null); + diff --git a/internal/endtoend/testdata/identical_tables/mysql/sqlc.json b/internal/endtoend/testdata/identical_tables/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/identical_tables/mysql/sqlc.json +++ b/internal/endtoend/testdata/identical_tables/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/models.go index 26342a2ed7..962e8d9e66 100644 --- a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID string } diff --git a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/query.sql.go index d6c4912e1a..6e424bf50d 100644 --- a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/query.sql index c995d0f183..2e71d9a787 100644 --- a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/query.sql @@ -1,5 +1,2 @@ -CREATE TABLE foo (id text not null); -CREATE TABLE bar (id text not null); - -- name: IdenticalTable :many SELECT * FROM foo; diff --git a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..0dbf9f6910 --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (id text not null); +CREATE TABLE bar (id text not null); + diff --git a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/models.go index 26342a2ed7..962e8d9e66 100644 --- a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID string } diff --git a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/query.sql.go index d6c4912e1a..6e424bf50d 100644 --- a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/query.sql index c995d0f183..2e71d9a787 100644 --- a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/query.sql @@ -1,5 +1,2 @@ -CREATE TABLE foo (id text not null); -CREATE TABLE bar (id text not null); - -- name: IdenticalTable :many SELECT * FROM foo; diff --git a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..0dbf9f6910 --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (id text not null); +CREATE TABLE bar (id text not null); + diff --git a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/models.go index 26342a2ed7..962e8d9e66 100644 --- a/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID string } diff --git a/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/query.sql.go index 548417408e..3d72df8d22 100644 --- a/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/identical_tables/postgresql/stdlib/query.sql b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/query.sql index c995d0f183..2e71d9a787 100644 --- a/internal/endtoend/testdata/identical_tables/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/query.sql @@ -1,5 +1,2 @@ -CREATE TABLE foo (id text not null); -CREATE TABLE bar (id text not null); - -- name: IdenticalTable :many SELECT * FROM foo; diff --git a/internal/endtoend/testdata/identical_tables/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..0dbf9f6910 --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (id text not null); +CREATE TABLE bar (id text not null); + diff --git a/internal/endtoend/testdata/identical_tables/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/identical_tables/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/identical_tables/sqlite/go/db.go b/internal/endtoend/testdata/identical_tables/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/identical_tables/sqlite/go/db.go +++ b/internal/endtoend/testdata/identical_tables/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/identical_tables/sqlite/go/models.go b/internal/endtoend/testdata/identical_tables/sqlite/go/models.go index 26342a2ed7..962e8d9e66 100644 --- a/internal/endtoend/testdata/identical_tables/sqlite/go/models.go +++ b/internal/endtoend/testdata/identical_tables/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID string } diff --git a/internal/endtoend/testdata/identical_tables/sqlite/go/query.sql.go b/internal/endtoend/testdata/identical_tables/sqlite/go/query.sql.go index 548417408e..3d72df8d22 100644 --- a/internal/endtoend/testdata/identical_tables/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/identical_tables/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/identical_tables/sqlite/query.sql b/internal/endtoend/testdata/identical_tables/sqlite/query.sql index c995d0f183..2e71d9a787 100644 --- a/internal/endtoend/testdata/identical_tables/sqlite/query.sql +++ b/internal/endtoend/testdata/identical_tables/sqlite/query.sql @@ -1,5 +1,2 @@ -CREATE TABLE foo (id text not null); -CREATE TABLE bar (id text not null); - -- name: IdenticalTable :many SELECT * FROM foo; diff --git a/internal/endtoend/testdata/identical_tables/sqlite/schema.sql b/internal/endtoend/testdata/identical_tables/sqlite/schema.sql new file mode 100644 index 0000000000..0dbf9f6910 --- /dev/null +++ b/internal/endtoend/testdata/identical_tables/sqlite/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (id text not null); +CREATE TABLE bar (id text not null); + diff --git a/internal/endtoend/testdata/identical_tables/sqlite/sqlc.json b/internal/endtoend/testdata/identical_tables/sqlite/sqlc.json index fcb288cb35..d4963e751f 100644 --- a/internal/endtoend/testdata/identical_tables/sqlite/sqlc.json +++ b/internal/endtoend/testdata/identical_tables/sqlite/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "sqlite", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/identifier_case_sensitivity/db/db.go b/internal/endtoend/testdata/identifier_case_sensitivity/db/db.go index 3d2b5bf3a3..cd5bbb8e08 100644 --- a/internal/endtoend/testdata/identifier_case_sensitivity/db/db.go +++ b/internal/endtoend/testdata/identifier_case_sensitivity/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/identifier_case_sensitivity/db/models.go b/internal/endtoend/testdata/identifier_case_sensitivity/db/models.go index f8bcd76317..5041799d54 100644 --- a/internal/endtoend/testdata/identifier_case_sensitivity/db/models.go +++ b/internal/endtoend/testdata/identifier_case_sensitivity/db/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/identifier_case_sensitivity/db/query.sql.go b/internal/endtoend/testdata/identifier_case_sensitivity/db/query.sql.go index f3a6ef1e3b..7e01490d7d 100644 --- a/internal/endtoend/testdata/identifier_case_sensitivity/db/query.sql.go +++ b/internal/endtoend/testdata/identifier_case_sensitivity/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package db diff --git a/internal/endtoend/testdata/identifier_case_sensitivity/query.sql b/internal/endtoend/testdata/identifier_case_sensitivity/query.sql index ac19cf948a..c9a3b0c508 100644 --- a/internal/endtoend/testdata/identifier_case_sensitivity/query.sql +++ b/internal/endtoend/testdata/identifier_case_sensitivity/query.sql @@ -1,9 +1,3 @@ -CREATE TABLE Authors ( - ID BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, - Name text NOT NULL, - Bio text -); - -- name: GetAuthor :one SELECT * FROM Authors WHERE ID = ? LIMIT 1; diff --git a/internal/endtoend/testdata/identifier_case_sensitivity/schema.sql b/internal/endtoend/testdata/identifier_case_sensitivity/schema.sql new file mode 100644 index 0000000000..474238ca9c --- /dev/null +++ b/internal/endtoend/testdata/identifier_case_sensitivity/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE Authors ( + ID BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, + Name text NOT NULL, + Bio text +); + diff --git a/internal/endtoend/testdata/identifier_case_sensitivity/sqlc.json b/internal/endtoend/testdata/identifier_case_sensitivity/sqlc.json index 72d8821559..32a13d6fc6 100644 --- a/internal/endtoend/testdata/identifier_case_sensitivity/sqlc.json +++ b/internal/endtoend/testdata/identifier_case_sensitivity/sqlc.json @@ -4,7 +4,7 @@ { "path": "db", "engine": "mysql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/identifier_dollar_sign/db/db.go b/internal/endtoend/testdata/identifier_dollar_sign/db/db.go index 3d2b5bf3a3..cd5bbb8e08 100644 --- a/internal/endtoend/testdata/identifier_dollar_sign/db/db.go +++ b/internal/endtoend/testdata/identifier_dollar_sign/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/identifier_dollar_sign/db/models.go b/internal/endtoend/testdata/identifier_dollar_sign/db/models.go index 929031fd0a..32099017df 100644 --- a/internal/endtoend/testdata/identifier_dollar_sign/db/models.go +++ b/internal/endtoend/testdata/identifier_dollar_sign/db/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db - -import () diff --git a/internal/endtoend/testdata/identifier_dollar_sign/db/query.sql.go b/internal/endtoend/testdata/identifier_dollar_sign/db/query.sql.go index 2924bdc819..357c440e49 100644 --- a/internal/endtoend/testdata/identifier_dollar_sign/db/query.sql.go +++ b/internal/endtoend/testdata/identifier_dollar_sign/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package db diff --git a/internal/endtoend/testdata/identifier_dollar_sign/query.sql b/internal/endtoend/testdata/identifier_dollar_sign/query.sql index fc5ceffca4..6b17cdf2dc 100644 --- a/internal/endtoend/testdata/identifier_dollar_sign/query.sql +++ b/internal/endtoend/testdata/identifier_dollar_sign/query.sql @@ -1,5 +1,2 @@ -CREATE FUNCTION f$n() RETURNS integer - AS $$ SELECT 1 $$ LANGUAGE SQL; - -- name: Fn :one SELECT f$n(); diff --git a/internal/endtoend/testdata/identifier_dollar_sign/schema.sql b/internal/endtoend/testdata/identifier_dollar_sign/schema.sql new file mode 100644 index 0000000000..fd248d2245 --- /dev/null +++ b/internal/endtoend/testdata/identifier_dollar_sign/schema.sql @@ -0,0 +1,3 @@ +CREATE FUNCTION f$n() RETURNS integer + AS $$ SELECT 1 $$ LANGUAGE SQL; + diff --git a/internal/endtoend/testdata/identifier_dollar_sign/sqlc.json b/internal/endtoend/testdata/identifier_dollar_sign/sqlc.json index ff443fe1b9..2a46100899 100644 --- a/internal/endtoend/testdata/identifier_dollar_sign/sqlc.json +++ b/internal/endtoend/testdata/identifier_dollar_sign/sqlc.json @@ -4,7 +4,7 @@ { "path": "db", "engine": "postgresql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/in_union/mysql/go/db.go b/internal/endtoend/testdata/in_union/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/in_union/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/in_union/mysql/go/models.go b/internal/endtoend/testdata/in_union/mysql/go/models.go new file mode 100644 index 0000000000..cde8844271 --- /dev/null +++ b/internal/endtoend/testdata/in_union/mysql/go/models.go @@ -0,0 +1,25 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int32 + Name string + Bio sql.NullString +} + +type Book1 struct { + AuthorID int32 + Name sql.NullString +} + +type Book2 struct { + AuthorID int32 + Name sql.NullString +} diff --git a/internal/endtoend/testdata/in_union/mysql/go/query.sql.go b/internal/endtoend/testdata/in_union/mysql/go/query.sql.go new file mode 100644 index 0000000000..4da95c2e62 --- /dev/null +++ b/internal/endtoend/testdata/in_union/mysql/go/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAuthors = `-- name: GetAuthors :many +SELECT id, name, bio FROM authors +WHERE author_id IN (SELECT author_id FROM book1 UNION SELECT author_id FROM book2) +` + +func (q *Queries) GetAuthors(ctx context.Context) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, getAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan(&i.ID, &i.Name, &i.Bio); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/in_union/mysql/query.sql b/internal/endtoend/testdata/in_union/mysql/query.sql new file mode 100644 index 0000000000..69606f538b --- /dev/null +++ b/internal/endtoend/testdata/in_union/mysql/query.sql @@ -0,0 +1,3 @@ +-- name: GetAuthors :many +SELECT * FROM authors +WHERE author_id IN (SELECT author_id FROM book1 UNION SELECT author_id FROM book2); diff --git a/internal/endtoend/testdata/in_union/mysql/schema.sql b/internal/endtoend/testdata/in_union/mysql/schema.sql new file mode 100644 index 0000000000..47264e2bbc --- /dev/null +++ b/internal/endtoend/testdata/in_union/mysql/schema.sql @@ -0,0 +1,15 @@ +CREATE TABLE authors ( + id int PRIMARY KEY, + name text NOT NULL, + bio text +); +CREATE TABLE book1 ( + author_id int PRIMARY KEY, + name text, + FOREIGN KEY (`author_id`) REFERENCES `authors` (`id`) ON DELETE CASCADE +); +CREATE TABLE book2 ( + author_id int PRIMARY KEY, + name text, + FOREIGN KEY (`author_id`) REFERENCES `authors` (`id`) ON DELETE CASCADE +); diff --git a/internal/endtoend/testdata/in_union/mysql/sqlc.json b/internal/endtoend/testdata/in_union/mysql/sqlc.json new file mode 100644 index 0000000000..974aa9ff9e --- /dev/null +++ b/internal/endtoend/testdata/in_union/mysql/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "engine": "mysql", + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/inflection/mysql/go/db.go b/internal/endtoend/testdata/inflection/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/inflection/mysql/go/db.go +++ b/internal/endtoend/testdata/inflection/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/inflection/mysql/go/models.go b/internal/endtoend/testdata/inflection/mysql/go/models.go index fa74f16bdd..dc018924d5 100644 --- a/internal/endtoend/testdata/inflection/mysql/go/models.go +++ b/internal/endtoend/testdata/inflection/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Calorie struct { ID string } @@ -14,6 +12,10 @@ type Campus struct { ID string } +type ProductMetadatum struct { + ID string +} + type ProductMetum struct { ID string } diff --git a/internal/endtoend/testdata/inflection/mysql/go/query.sql.go b/internal/endtoend/testdata/inflection/mysql/go/query.sql.go index cc92aa1adf..9dc173e9bc 100644 --- a/internal/endtoend/testdata/inflection/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/inflection/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -9,6 +9,33 @@ import ( "context" ) +const getProductMetadata = `-- name: GetProductMetadata :many +SELECT id FROM product_metadata +` + +func (q *Queries) GetProductMetadata(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, getProductMetadata) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var id string + if err := rows.Scan(&id); err != nil { + return nil, err + } + items = append(items, id) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const listCalories = `-- name: ListCalories :many SELECT id FROM calories ` diff --git a/internal/endtoend/testdata/inflection/mysql/query.sql b/internal/endtoend/testdata/inflection/mysql/query.sql index 24ca8bdadd..74e1aaf8c3 100644 --- a/internal/endtoend/testdata/inflection/mysql/query.sql +++ b/internal/endtoend/testdata/inflection/mysql/query.sql @@ -1,8 +1,3 @@ -CREATE TABLE campus (id text not null); -CREATE TABLE students (id text not null); -CREATE TABLE product_meta (id text not null); -CREATE TABLE calories (id text not null); - /* name: ListCampuses :many */ SELECT * FROM campus; @@ -14,3 +9,6 @@ SELECT * FROM product_meta; /* name: ListCalories :many */ SELECT * FROM calories; + +/* name: GetProductMetadata :many */ +SELECT * FROM product_metadata; \ No newline at end of file diff --git a/internal/endtoend/testdata/inflection/mysql/schema.sql b/internal/endtoend/testdata/inflection/mysql/schema.sql new file mode 100644 index 0000000000..f7d5c7c2a5 --- /dev/null +++ b/internal/endtoend/testdata/inflection/mysql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE campus (id text not null); +CREATE TABLE students (id text not null); +CREATE TABLE product_meta (id text not null); +CREATE TABLE calories (id text not null); +CREATE TABLE product_metadata (id text not null); diff --git a/internal/endtoend/testdata/inflection/mysql/sqlc.json b/internal/endtoend/testdata/inflection/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/inflection/mysql/sqlc.json +++ b/internal/endtoend/testdata/inflection/mysql/sqlc.json @@ -5,7 +5,7 @@ "engine": "mysql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/models.go index fa74f16bdd..dc018924d5 100644 --- a/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Calorie struct { ID string } @@ -14,6 +12,10 @@ type Campus struct { ID string } +type ProductMetadatum struct { + ID string +} + type ProductMetum struct { ID string } diff --git a/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/query.sql.go index f4b1d37ffc..1f9673c638 100644 --- a/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -9,6 +9,30 @@ import ( "context" ) +const getProductMetadata = `-- name: GetProductMetadata :many +SELECT id FROM product_metadata +` + +func (q *Queries) GetProductMetadata(ctx context.Context) ([]string, error) { + rows, err := q.db.Query(ctx, getProductMetadata) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var id string + if err := rows.Scan(&id); err != nil { + return nil, err + } + items = append(items, id) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const listCalories = `-- name: ListCalories :many SELECT id FROM calories ` diff --git a/internal/endtoend/testdata/inflection/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/query.sql index f1958fa869..abc0da2ef2 100644 --- a/internal/endtoend/testdata/inflection/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/query.sql @@ -1,8 +1,3 @@ -CREATE TABLE campus (id text not null); -CREATE TABLE students (id text not null); -CREATE TABLE product_meta (id text not null); -CREATE TABLE calories (id text not null); - -- name: ListCampuses :many SELECT * FROM campus; @@ -14,3 +9,6 @@ SELECT * FROM product_meta; -- name: ListCalories :many SELECT * FROM calories; + +-- name: GetProductMetadata :many +SELECT * FROM product_metadata; \ No newline at end of file diff --git a/internal/endtoend/testdata/inflection/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..ad17ad7427 --- /dev/null +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE campus (id text not null); +CREATE TABLE students (id text not null); +CREATE TABLE product_meta (id text not null); +CREATE TABLE calories (id text not null); +CREATE TABLE product_metadata (id text not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/inflection/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/inflection/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/models.go index fa74f16bdd..dc018924d5 100644 --- a/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Calorie struct { ID string } @@ -14,6 +12,10 @@ type Campus struct { ID string } +type ProductMetadatum struct { + ID string +} + type ProductMetum struct { ID string } diff --git a/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/query.sql.go index f4b1d37ffc..1f9673c638 100644 --- a/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -9,6 +9,30 @@ import ( "context" ) +const getProductMetadata = `-- name: GetProductMetadata :many +SELECT id FROM product_metadata +` + +func (q *Queries) GetProductMetadata(ctx context.Context) ([]string, error) { + rows, err := q.db.Query(ctx, getProductMetadata) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var id string + if err := rows.Scan(&id); err != nil { + return nil, err + } + items = append(items, id) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const listCalories = `-- name: ListCalories :many SELECT id FROM calories ` diff --git a/internal/endtoend/testdata/inflection/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/query.sql index f1958fa869..abc0da2ef2 100644 --- a/internal/endtoend/testdata/inflection/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/query.sql @@ -1,8 +1,3 @@ -CREATE TABLE campus (id text not null); -CREATE TABLE students (id text not null); -CREATE TABLE product_meta (id text not null); -CREATE TABLE calories (id text not null); - -- name: ListCampuses :many SELECT * FROM campus; @@ -14,3 +9,6 @@ SELECT * FROM product_meta; -- name: ListCalories :many SELECT * FROM calories; + +-- name: GetProductMetadata :many +SELECT * FROM product_metadata; \ No newline at end of file diff --git a/internal/endtoend/testdata/inflection/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..ad17ad7427 --- /dev/null +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE campus (id text not null); +CREATE TABLE students (id text not null); +CREATE TABLE product_meta (id text not null); +CREATE TABLE calories (id text not null); +CREATE TABLE product_metadata (id text not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/inflection/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/inflection/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/inflection/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/inflection/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/inflection/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/inflection/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/inflection/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/inflection/postgresql/stdlib/go/models.go index fa74f16bdd..dc018924d5 100644 --- a/internal/endtoend/testdata/inflection/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/inflection/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Calorie struct { ID string } @@ -14,6 +12,10 @@ type Campus struct { ID string } +type ProductMetadatum struct { + ID string +} + type ProductMetum struct { ID string } diff --git a/internal/endtoend/testdata/inflection/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/inflection/postgresql/stdlib/go/query.sql.go index cc92aa1adf..9dc173e9bc 100644 --- a/internal/endtoend/testdata/inflection/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/inflection/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -9,6 +9,33 @@ import ( "context" ) +const getProductMetadata = `-- name: GetProductMetadata :many +SELECT id FROM product_metadata +` + +func (q *Queries) GetProductMetadata(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, getProductMetadata) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var id string + if err := rows.Scan(&id); err != nil { + return nil, err + } + items = append(items, id) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const listCalories = `-- name: ListCalories :many SELECT id FROM calories ` diff --git a/internal/endtoend/testdata/inflection/postgresql/stdlib/query.sql b/internal/endtoend/testdata/inflection/postgresql/stdlib/query.sql index f1958fa869..abc0da2ef2 100644 --- a/internal/endtoend/testdata/inflection/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/inflection/postgresql/stdlib/query.sql @@ -1,8 +1,3 @@ -CREATE TABLE campus (id text not null); -CREATE TABLE students (id text not null); -CREATE TABLE product_meta (id text not null); -CREATE TABLE calories (id text not null); - -- name: ListCampuses :many SELECT * FROM campus; @@ -14,3 +9,6 @@ SELECT * FROM product_meta; -- name: ListCalories :many SELECT * FROM calories; + +-- name: GetProductMetadata :many +SELECT * FROM product_metadata; \ No newline at end of file diff --git a/internal/endtoend/testdata/inflection/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/inflection/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..ad17ad7427 --- /dev/null +++ b/internal/endtoend/testdata/inflection/postgresql/stdlib/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE campus (id text not null); +CREATE TABLE students (id text not null); +CREATE TABLE product_meta (id text not null); +CREATE TABLE calories (id text not null); +CREATE TABLE product_metadata (id text not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/inflection/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/inflection/postgresql/stdlib/sqlc.json index de427d069f..cd518671ac 100644 --- a/internal/endtoend/testdata/inflection/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/inflection/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "engine": "postgresql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/inflection/sqlite/go/db.go b/internal/endtoend/testdata/inflection/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/inflection/sqlite/go/db.go +++ b/internal/endtoend/testdata/inflection/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/inflection/sqlite/go/models.go b/internal/endtoend/testdata/inflection/sqlite/go/models.go index fa74f16bdd..dc018924d5 100644 --- a/internal/endtoend/testdata/inflection/sqlite/go/models.go +++ b/internal/endtoend/testdata/inflection/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Calorie struct { ID string } @@ -14,6 +12,10 @@ type Campus struct { ID string } +type ProductMetadatum struct { + ID string +} + type ProductMetum struct { ID string } diff --git a/internal/endtoend/testdata/inflection/sqlite/go/query.sql.go b/internal/endtoend/testdata/inflection/sqlite/go/query.sql.go index cc92aa1adf..9dc173e9bc 100644 --- a/internal/endtoend/testdata/inflection/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/inflection/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -9,6 +9,33 @@ import ( "context" ) +const getProductMetadata = `-- name: GetProductMetadata :many +SELECT id FROM product_metadata +` + +func (q *Queries) GetProductMetadata(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, getProductMetadata) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var id string + if err := rows.Scan(&id); err != nil { + return nil, err + } + items = append(items, id) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const listCalories = `-- name: ListCalories :many SELECT id FROM calories ` diff --git a/internal/endtoend/testdata/inflection/sqlite/query.sql b/internal/endtoend/testdata/inflection/sqlite/query.sql index 24ca8bdadd..74e1aaf8c3 100644 --- a/internal/endtoend/testdata/inflection/sqlite/query.sql +++ b/internal/endtoend/testdata/inflection/sqlite/query.sql @@ -1,8 +1,3 @@ -CREATE TABLE campus (id text not null); -CREATE TABLE students (id text not null); -CREATE TABLE product_meta (id text not null); -CREATE TABLE calories (id text not null); - /* name: ListCampuses :many */ SELECT * FROM campus; @@ -14,3 +9,6 @@ SELECT * FROM product_meta; /* name: ListCalories :many */ SELECT * FROM calories; + +/* name: GetProductMetadata :many */ +SELECT * FROM product_metadata; \ No newline at end of file diff --git a/internal/endtoend/testdata/inflection/sqlite/schema.sql b/internal/endtoend/testdata/inflection/sqlite/schema.sql new file mode 100644 index 0000000000..ad17ad7427 --- /dev/null +++ b/internal/endtoend/testdata/inflection/sqlite/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE campus (id text not null); +CREATE TABLE students (id text not null); +CREATE TABLE product_meta (id text not null); +CREATE TABLE calories (id text not null); +CREATE TABLE product_metadata (id text not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/inflection/sqlite/sqlc.json b/internal/endtoend/testdata/inflection/sqlite/sqlc.json index 13e65f3ffd..f8e8051087 100644 --- a/internal/endtoend/testdata/inflection/sqlite/sqlc.json +++ b/internal/endtoend/testdata/inflection/sqlite/sqlc.json @@ -5,7 +5,7 @@ "engine": "sqlite", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/models.go index 50f2002c8f..42c15bfccc 100644 --- a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 Name string diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/query.sql.go index 1c2dbbb5e2..a1f8824ce5 100644 --- a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/query.sql index aefc8ebec5..f279a10738 100644 --- a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/query.sql @@ -1,7 +1,3 @@ -CREATE TABLE bars (id serial not null, name text not null, primary key (id)); -CREATE TABLE my_data (id serial not null, name text not null, primary key (id)); -CREATE TABLE exclusions (id serial not null, name text not null, primary key (id)); - -- name: DeleteBarByID :one DELETE FROM bars WHERE id = $1 RETURNING id, name; diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..ea5b797e08 --- /dev/null +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE bars (id serial not null, name text not null, primary key (id)); +CREATE TABLE my_data (id serial not null, name text not null, primary key (id)); +CREATE TABLE exclusions (id serial not null, name text not null, primary key (id)); + diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/sqlc.json index 3146d254af..6c17458e27 100644 --- a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/sqlc.json @@ -3,7 +3,7 @@ "sql": [ { "engine": "postgresql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "gen": { "go": { diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/models.go index 50f2002c8f..42c15bfccc 100644 --- a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 Name string diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/query.sql.go index 1c2dbbb5e2..a1f8824ce5 100644 --- a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/query.sql index aefc8ebec5..f279a10738 100644 --- a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/query.sql @@ -1,7 +1,3 @@ -CREATE TABLE bars (id serial not null, name text not null, primary key (id)); -CREATE TABLE my_data (id serial not null, name text not null, primary key (id)); -CREATE TABLE exclusions (id serial not null, name text not null, primary key (id)); - -- name: DeleteBarByID :one DELETE FROM bars WHERE id = $1 RETURNING id, name; diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..ea5b797e08 --- /dev/null +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE bars (id serial not null, name text not null, primary key (id)); +CREATE TABLE my_data (id serial not null, name text not null, primary key (id)); +CREATE TABLE exclusions (id serial not null, name text not null, primary key (id)); + diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/sqlc.json index 223be926c4..3d058c34c6 100644 --- a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/sqlc.json @@ -3,7 +3,7 @@ "sql": [ { "engine": "postgresql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "gen": { "go": { diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/python_postgresql/python/models.py b/internal/endtoend/testdata/inflection_exclude_table_names/python_postgresql/python/models.py deleted file mode 100644 index 5f70f12ae1..0000000000 --- a/internal/endtoend/testdata/inflection_exclude_table_names/python_postgresql/python/models.py +++ /dev/null @@ -1,22 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -import dataclasses - - -@dataclasses.dataclass() -class Bar: - id: int - name: str - - -@dataclasses.dataclass() -class Exclusions: - id: int - name: str - - -@dataclasses.dataclass() -class MyData: - id: int - name: str diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/python_postgresql/python/query.py b/internal/endtoend/testdata/inflection_exclude_table_names/python_postgresql/python/query.py deleted file mode 100644 index f95e44bf32..0000000000 --- a/internal/endtoend/testdata/inflection_exclude_table_names/python_postgresql/python/query.py +++ /dev/null @@ -1,89 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -# source: query.sql -from typing import Optional - -import sqlalchemy -import sqlalchemy.ext.asyncio - -from querytest import models - - -DELETE_BAR_BY_ID = """-- name: delete_bar_by_id \\:one -DELETE FROM bars WHERE id = :p1 RETURNING id, name -""" - - -DELETE_EXCLUSION_BY_ID = """-- name: delete_exclusion_by_id \\:one -DELETE FROM exclusions WHERE id = :p1 RETURNING id, name -""" - - -DELETE_MY_DATA_BY_ID = """-- name: delete_my_data_by_id \\:one -DELETE FROM my_data WHERE id = :p1 RETURNING id, name -""" - - -class Querier: - def __init__(self, conn: sqlalchemy.engine.Connection): - self._conn = conn - - def delete_bar_by_id(self, *, id: int) -> Optional[models.Bar]: - row = self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID), {"p1": id}).first() - if row is None: - return None - return models.Bar( - id=row[0], - name=row[1], - ) - - def delete_exclusion_by_id(self, *, id: int) -> Optional[models.Exclusions]: - row = self._conn.execute(sqlalchemy.text(DELETE_EXCLUSION_BY_ID), {"p1": id}).first() - if row is None: - return None - return models.Exclusions( - id=row[0], - name=row[1], - ) - - def delete_my_data_by_id(self, *, id: int) -> Optional[models.MyData]: - row = self._conn.execute(sqlalchemy.text(DELETE_MY_DATA_BY_ID), {"p1": id}).first() - if row is None: - return None - return models.MyData( - id=row[0], - name=row[1], - ) - - -class AsyncQuerier: - def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection): - self._conn = conn - - async def delete_bar_by_id(self, *, id: int) -> Optional[models.Bar]: - row = (await self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID), {"p1": id})).first() - if row is None: - return None - return models.Bar( - id=row[0], - name=row[1], - ) - - async def delete_exclusion_by_id(self, *, id: int) -> Optional[models.Exclusions]: - row = (await self._conn.execute(sqlalchemy.text(DELETE_EXCLUSION_BY_ID), {"p1": id})).first() - if row is None: - return None - return models.Exclusions( - id=row[0], - name=row[1], - ) - - async def delete_my_data_by_id(self, *, id: int) -> Optional[models.MyData]: - row = (await self._conn.execute(sqlalchemy.text(DELETE_MY_DATA_BY_ID), {"p1": id})).first() - if row is None: - return None - return models.MyData( - id=row[0], - name=row[1], - ) diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/python_postgresql/query.sql b/internal/endtoend/testdata/inflection_exclude_table_names/python_postgresql/query.sql deleted file mode 100644 index aefc8ebec5..0000000000 --- a/internal/endtoend/testdata/inflection_exclude_table_names/python_postgresql/query.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE bars (id serial not null, name text not null, primary key (id)); -CREATE TABLE my_data (id serial not null, name text not null, primary key (id)); -CREATE TABLE exclusions (id serial not null, name text not null, primary key (id)); - --- name: DeleteBarByID :one -DELETE FROM bars WHERE id = $1 RETURNING id, name; - --- name: DeleteMyDataByID :one -DELETE FROM my_data WHERE id = $1 RETURNING id, name; - --- name: DeleteExclusionByID :one -DELETE FROM exclusions WHERE id = $1 RETURNING id, name; diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/python_postgresql/sqlc.json b/internal/endtoend/testdata/inflection_exclude_table_names/python_postgresql/sqlc.json deleted file mode 100644 index 4139d2037b..0000000000 --- a/internal/endtoend/testdata/inflection_exclude_table_names/python_postgresql/sqlc.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "version": "2", - "plugins": [ - { - "name": "py", - "wasm": { - "url": "https://downloads.sqlc.dev/plugin/sqlc-gen-python_1.0.0.wasm", - "sha256": "aca83e1f59f8ffdc604774c2f6f9eb321a2b23e07dc83fc12289d25305fa065b" - } - } - ], - "sql": [ - { - "schema": "query.sql", - "queries": "query.sql", - "engine": "postgresql", - "codegen": [ - { - "plugin": "py", - "out": "python", - "options": { - "package": "querytest", - "emit_sync_querier": true, - "emit_async_querier": true, - "inflection_exclude_table_names": [ - "my_data", - "exclusions" - ] - } - } - ] - } - ] -} diff --git a/internal/endtoend/testdata/insert_cte/pgx/v4/go/db.go b/internal/endtoend/testdata/insert_cte/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/insert_cte/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/insert_cte/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_cte/pgx/v4/go/models.go b/internal/endtoend/testdata/insert_cte/pgx/v4/go/models.go index 78aa133e28..fda938bb99 100644 --- a/internal/endtoend/testdata/insert_cte/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/insert_cte/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_cte/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/insert_cte/pgx/v4/go/query.sql.go index 743c9d6e67..732bcac74a 100644 --- a/internal/endtoend/testdata/insert_cte/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/insert_cte/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -11,7 +11,6 @@ import ( ) const insertCode = `-- name: InsertCode :one - WITH cc AS ( INSERT INTO td3.codes(created_by, updated_by, code, hash, is_private) VALUES ($1, $1, $2, $3, false) @@ -31,7 +30,6 @@ type InsertCodeParams struct { TestID int32 } -// FILE: query.sql func (q *Queries) InsertCode(ctx context.Context, arg InsertCodeParams) (Td3TestCode, error) { row := q.db.QueryRow(ctx, insertCode, arg.CreatedBy, diff --git a/internal/endtoend/testdata/insert_cte/pgx/v4/query.sql b/internal/endtoend/testdata/insert_cte/pgx/v4/query.sql index c3673b24b1..7e7483f128 100644 --- a/internal/endtoend/testdata/insert_cte/pgx/v4/query.sql +++ b/internal/endtoend/testdata/insert_cte/pgx/v4/query.sql @@ -1,34 +1,3 @@ --- FILE: schema.sql - -DROP SCHEMA IF EXISTS td3 CASCADE; -CREATE SCHEMA td3; - -CREATE TABLE td3.codes ( - id SERIAL PRIMARY KEY, - ts_created timestamptz DEFAULT now() NOT NULL, - ts_updated timestamptz DEFAULT now() NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL, - - code text, - hash text, - is_private boolean -); - - -CREATE TABLE td3.test_codes ( - id SERIAL PRIMARY KEY, - ts_created timestamptz DEFAULT now() NOT NULL, - ts_updated timestamptz DEFAULT now() NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL, - - test_id integer NOT NULL, - code_hash text NOT NULL -); - --- FILE: query.sql - -- name: InsertCode :one WITH cc AS ( INSERT INTO td3.codes(created_by, updated_by, code, hash, is_private) diff --git a/internal/endtoend/testdata/insert_cte/pgx/v4/schema.sql b/internal/endtoend/testdata/insert_cte/pgx/v4/schema.sql new file mode 100644 index 0000000000..1eb3dcf4ac --- /dev/null +++ b/internal/endtoend/testdata/insert_cte/pgx/v4/schema.sql @@ -0,0 +1,31 @@ +-- FILE: schema.sql + +DROP SCHEMA IF EXISTS td3 CASCADE; +CREATE SCHEMA td3; + +CREATE TABLE td3.codes ( + id SERIAL PRIMARY KEY, + ts_created timestamptz DEFAULT now() NOT NULL, + ts_updated timestamptz DEFAULT now() NOT NULL, + created_by text NOT NULL, + updated_by text NOT NULL, + + code text, + hash text, + is_private boolean +); + + +CREATE TABLE td3.test_codes ( + id SERIAL PRIMARY KEY, + ts_created timestamptz DEFAULT now() NOT NULL, + ts_updated timestamptz DEFAULT now() NOT NULL, + created_by text NOT NULL, + updated_by text NOT NULL, + + test_id integer NOT NULL, + code_hash text NOT NULL +); + +-- FILE: query.sql + diff --git a/internal/endtoend/testdata/insert_cte/pgx/v4/sqlc.json b/internal/endtoend/testdata/insert_cte/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/insert_cte/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/insert_cte/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/insert_cte/pgx/v5/go/db.go b/internal/endtoend/testdata/insert_cte/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/insert_cte/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/insert_cte/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_cte/pgx/v5/go/models.go b/internal/endtoend/testdata/insert_cte/pgx/v5/go/models.go index b4aaf069a0..5f27f6c6bd 100644 --- a/internal/endtoend/testdata/insert_cte/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/insert_cte/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_cte/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/insert_cte/pgx/v5/go/query.sql.go index 32614e5d0a..451bae46cb 100644 --- a/internal/endtoend/testdata/insert_cte/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/insert_cte/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -12,7 +12,6 @@ import ( ) const insertCode = `-- name: InsertCode :one - WITH cc AS ( INSERT INTO td3.codes(created_by, updated_by, code, hash, is_private) VALUES ($1, $1, $2, $3, false) @@ -32,7 +31,6 @@ type InsertCodeParams struct { TestID int32 } -// FILE: query.sql func (q *Queries) InsertCode(ctx context.Context, arg InsertCodeParams) (Td3TestCode, error) { row := q.db.QueryRow(ctx, insertCode, arg.CreatedBy, diff --git a/internal/endtoend/testdata/insert_cte/pgx/v5/query.sql b/internal/endtoend/testdata/insert_cte/pgx/v5/query.sql index c3673b24b1..7e7483f128 100644 --- a/internal/endtoend/testdata/insert_cte/pgx/v5/query.sql +++ b/internal/endtoend/testdata/insert_cte/pgx/v5/query.sql @@ -1,34 +1,3 @@ --- FILE: schema.sql - -DROP SCHEMA IF EXISTS td3 CASCADE; -CREATE SCHEMA td3; - -CREATE TABLE td3.codes ( - id SERIAL PRIMARY KEY, - ts_created timestamptz DEFAULT now() NOT NULL, - ts_updated timestamptz DEFAULT now() NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL, - - code text, - hash text, - is_private boolean -); - - -CREATE TABLE td3.test_codes ( - id SERIAL PRIMARY KEY, - ts_created timestamptz DEFAULT now() NOT NULL, - ts_updated timestamptz DEFAULT now() NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL, - - test_id integer NOT NULL, - code_hash text NOT NULL -); - --- FILE: query.sql - -- name: InsertCode :one WITH cc AS ( INSERT INTO td3.codes(created_by, updated_by, code, hash, is_private) diff --git a/internal/endtoend/testdata/insert_cte/pgx/v5/schema.sql b/internal/endtoend/testdata/insert_cte/pgx/v5/schema.sql new file mode 100644 index 0000000000..1eb3dcf4ac --- /dev/null +++ b/internal/endtoend/testdata/insert_cte/pgx/v5/schema.sql @@ -0,0 +1,31 @@ +-- FILE: schema.sql + +DROP SCHEMA IF EXISTS td3 CASCADE; +CREATE SCHEMA td3; + +CREATE TABLE td3.codes ( + id SERIAL PRIMARY KEY, + ts_created timestamptz DEFAULT now() NOT NULL, + ts_updated timestamptz DEFAULT now() NOT NULL, + created_by text NOT NULL, + updated_by text NOT NULL, + + code text, + hash text, + is_private boolean +); + + +CREATE TABLE td3.test_codes ( + id SERIAL PRIMARY KEY, + ts_created timestamptz DEFAULT now() NOT NULL, + ts_updated timestamptz DEFAULT now() NOT NULL, + created_by text NOT NULL, + updated_by text NOT NULL, + + test_id integer NOT NULL, + code_hash text NOT NULL +); + +-- FILE: query.sql + diff --git a/internal/endtoend/testdata/insert_cte/pgx/v5/sqlc.json b/internal/endtoend/testdata/insert_cte/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/insert_cte/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/insert_cte/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/insert_cte/stdlib/go/db.go b/internal/endtoend/testdata/insert_cte/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/insert_cte/stdlib/go/db.go +++ b/internal/endtoend/testdata/insert_cte/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_cte/stdlib/go/models.go b/internal/endtoend/testdata/insert_cte/stdlib/go/models.go index 78aa133e28..fda938bb99 100644 --- a/internal/endtoend/testdata/insert_cte/stdlib/go/models.go +++ b/internal/endtoend/testdata/insert_cte/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_cte/stdlib/go/query.sql.go b/internal/endtoend/testdata/insert_cte/stdlib/go/query.sql.go index d269fad5d7..383b87b276 100644 --- a/internal/endtoend/testdata/insert_cte/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/insert_cte/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -11,7 +11,6 @@ import ( ) const insertCode = `-- name: InsertCode :one - WITH cc AS ( INSERT INTO td3.codes(created_by, updated_by, code, hash, is_private) VALUES ($1, $1, $2, $3, false) @@ -31,7 +30,6 @@ type InsertCodeParams struct { TestID int32 } -// FILE: query.sql func (q *Queries) InsertCode(ctx context.Context, arg InsertCodeParams) (Td3TestCode, error) { row := q.db.QueryRowContext(ctx, insertCode, arg.CreatedBy, diff --git a/internal/endtoend/testdata/insert_cte/stdlib/query.sql b/internal/endtoend/testdata/insert_cte/stdlib/query.sql index c3673b24b1..7e7483f128 100644 --- a/internal/endtoend/testdata/insert_cte/stdlib/query.sql +++ b/internal/endtoend/testdata/insert_cte/stdlib/query.sql @@ -1,34 +1,3 @@ --- FILE: schema.sql - -DROP SCHEMA IF EXISTS td3 CASCADE; -CREATE SCHEMA td3; - -CREATE TABLE td3.codes ( - id SERIAL PRIMARY KEY, - ts_created timestamptz DEFAULT now() NOT NULL, - ts_updated timestamptz DEFAULT now() NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL, - - code text, - hash text, - is_private boolean -); - - -CREATE TABLE td3.test_codes ( - id SERIAL PRIMARY KEY, - ts_created timestamptz DEFAULT now() NOT NULL, - ts_updated timestamptz DEFAULT now() NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL, - - test_id integer NOT NULL, - code_hash text NOT NULL -); - --- FILE: query.sql - -- name: InsertCode :one WITH cc AS ( INSERT INTO td3.codes(created_by, updated_by, code, hash, is_private) diff --git a/internal/endtoend/testdata/insert_cte/stdlib/schema.sql b/internal/endtoend/testdata/insert_cte/stdlib/schema.sql new file mode 100644 index 0000000000..1eb3dcf4ac --- /dev/null +++ b/internal/endtoend/testdata/insert_cte/stdlib/schema.sql @@ -0,0 +1,31 @@ +-- FILE: schema.sql + +DROP SCHEMA IF EXISTS td3 CASCADE; +CREATE SCHEMA td3; + +CREATE TABLE td3.codes ( + id SERIAL PRIMARY KEY, + ts_created timestamptz DEFAULT now() NOT NULL, + ts_updated timestamptz DEFAULT now() NOT NULL, + created_by text NOT NULL, + updated_by text NOT NULL, + + code text, + hash text, + is_private boolean +); + + +CREATE TABLE td3.test_codes ( + id SERIAL PRIMARY KEY, + ts_created timestamptz DEFAULT now() NOT NULL, + ts_updated timestamptz DEFAULT now() NOT NULL, + created_by text NOT NULL, + updated_by text NOT NULL, + + test_id integer NOT NULL, + code_hash text NOT NULL +); + +-- FILE: query.sql + diff --git a/internal/endtoend/testdata/insert_cte/stdlib/sqlc.json b/internal/endtoend/testdata/insert_cte/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/insert_cte/stdlib/sqlc.json +++ b/internal/endtoend/testdata/insert_cte/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/insert_default_values/sqlite/go/db.go b/internal/endtoend/testdata/insert_default_values/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/insert_default_values/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/insert_default_values/sqlite/go/models.go b/internal/endtoend/testdata/insert_default_values/sqlite/go/models.go new file mode 100644 index 0000000000..0dcacbeefd --- /dev/null +++ b/internal/endtoend/testdata/insert_default_values/sqlite/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Workspace struct { + ID int64 +} diff --git a/internal/endtoend/testdata/insert_default_values/sqlite/go/query.sql.go b/internal/endtoend/testdata/insert_default_values/sqlite/go/query.sql.go new file mode 100644 index 0000000000..669b57b2df --- /dev/null +++ b/internal/endtoend/testdata/insert_default_values/sqlite/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const insertWorkspace = `-- name: InsertWorkspace :exec +INSERT INTO workspace DEFAULT VALUES +` + +func (q *Queries) InsertWorkspace(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, insertWorkspace) + return err +} diff --git a/internal/endtoend/testdata/insert_default_values/sqlite/query.sql b/internal/endtoend/testdata/insert_default_values/sqlite/query.sql new file mode 100644 index 0000000000..107afbe8b5 --- /dev/null +++ b/internal/endtoend/testdata/insert_default_values/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: InsertWorkspace :exec +INSERT INTO workspace DEFAULT VALUES; \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_default_values/sqlite/schema.sql b/internal/endtoend/testdata/insert_default_values/sqlite/schema.sql new file mode 100644 index 0000000000..f142b7c831 --- /dev/null +++ b/internal/endtoend/testdata/insert_default_values/sqlite/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE workspace ( + id INTEGER PRIMARY KEY AUTOINCREMENT +); \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_default_values/sqlite/sqlc.json b/internal/endtoend/testdata/insert_default_values/sqlite/sqlc.json new file mode 100644 index 0000000000..f8e8051087 --- /dev/null +++ b/internal/endtoend/testdata/insert_default_values/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "engine": "sqlite", + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select/mysql/go/db.go b/internal/endtoend/testdata/insert_select/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/insert_select/mysql/go/db.go +++ b/internal/endtoend/testdata/insert_select/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_select/mysql/go/models.go b/internal/endtoend/testdata/insert_select/mysql/go/models.go index c40078c62d..16bc8a120c 100644 --- a/internal/endtoend/testdata/insert_select/mysql/go/models.go +++ b/internal/endtoend/testdata/insert_select/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { Name string Ready bool diff --git a/internal/endtoend/testdata/insert_select/mysql/go/query.sql.go b/internal/endtoend/testdata/insert_select/mysql/go/query.sql.go index 7b69fe26c5..cc635082ee 100644 --- a/internal/endtoend/testdata/insert_select/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/insert_select/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_select/mysql/query.sql b/internal/endtoend/testdata/insert_select/mysql/query.sql index 69aee7f0e9..880f083f9e 100644 --- a/internal/endtoend/testdata/insert_select/mysql/query.sql +++ b/internal/endtoend/testdata/insert_select/mysql/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE bar (name text not null, ready bool not null); -CREATE TABLE foo (name text not null, meta text not null); - /* name: InsertSelect :exec */ INSERT INTO foo (name, meta) SELECT name, ? diff --git a/internal/endtoend/testdata/insert_select/mysql/schema.sql b/internal/endtoend/testdata/insert_select/mysql/schema.sql new file mode 100644 index 0000000000..1a394f8c44 --- /dev/null +++ b/internal/endtoend/testdata/insert_select/mysql/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE bar (name text not null, ready bool not null); +CREATE TABLE foo (name text not null, meta text not null); + diff --git a/internal/endtoend/testdata/insert_select/mysql/sqlc.json b/internal/endtoend/testdata/insert_select/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/insert_select/mysql/sqlc.json +++ b/internal/endtoend/testdata/insert_select/mysql/sqlc.json @@ -5,7 +5,7 @@ "engine": "mysql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/models.go index c40078c62d..16bc8a120c 100644 --- a/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { Name string Ready bool diff --git a/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/query.sql.go index 7f6ade20cc..9e8dec1fb9 100644 --- a/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/query.sql index 04bd65e84b..8478c05f05 100644 --- a/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE bar (name text not null, ready bool not null); -CREATE TABLE foo (name text not null, meta text not null); - -- name: InsertSelect :exec INSERT INTO foo (name, meta) SELECT name, $1 diff --git a/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..1a394f8c44 --- /dev/null +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE bar (name text not null, ready bool not null); +CREATE TABLE foo (name text not null, meta text not null); + diff --git a/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/models.go index c40078c62d..16bc8a120c 100644 --- a/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { Name string Ready bool diff --git a/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/query.sql.go index 7f6ade20cc..9e8dec1fb9 100644 --- a/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/query.sql index 04bd65e84b..8478c05f05 100644 --- a/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE bar (name text not null, ready bool not null); -CREATE TABLE foo (name text not null, meta text not null); - -- name: InsertSelect :exec INSERT INTO foo (name, meta) SELECT name, $1 diff --git a/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..1a394f8c44 --- /dev/null +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE bar (name text not null, ready bool not null); +CREATE TABLE foo (name text not null, meta text not null); + diff --git a/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/models.go index c40078c62d..16bc8a120c 100644 --- a/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { Name string Ready bool diff --git a/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/query.sql.go index e5d9918ab7..ab34ae3502 100644 --- a/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_select/postgresql/stdlib/query.sql b/internal/endtoend/testdata/insert_select/postgresql/stdlib/query.sql index 04bd65e84b..8478c05f05 100644 --- a/internal/endtoend/testdata/insert_select/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/insert_select/postgresql/stdlib/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE bar (name text not null, ready bool not null); -CREATE TABLE foo (name text not null, meta text not null); - -- name: InsertSelect :exec INSERT INTO foo (name, meta) SELECT name, $1 diff --git a/internal/endtoend/testdata/insert_select/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/insert_select/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..1a394f8c44 --- /dev/null +++ b/internal/endtoend/testdata/insert_select/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE bar (name text not null, ready bool not null); +CREATE TABLE foo (name text not null, meta text not null); + diff --git a/internal/endtoend/testdata/insert_select/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/insert_select/postgresql/stdlib/sqlc.json index de427d069f..cd518671ac 100644 --- a/internal/endtoend/testdata/insert_select/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/insert_select/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "engine": "postgresql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/insert_select/sqlite/go/db.go b/internal/endtoend/testdata/insert_select/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/insert_select/sqlite/go/db.go +++ b/internal/endtoend/testdata/insert_select/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_select/sqlite/go/models.go b/internal/endtoend/testdata/insert_select/sqlite/go/models.go index c40078c62d..16bc8a120c 100644 --- a/internal/endtoend/testdata/insert_select/sqlite/go/models.go +++ b/internal/endtoend/testdata/insert_select/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { Name string Ready bool diff --git a/internal/endtoend/testdata/insert_select/sqlite/go/query.sql.go b/internal/endtoend/testdata/insert_select/sqlite/go/query.sql.go index 7b69fe26c5..cc635082ee 100644 --- a/internal/endtoend/testdata/insert_select/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/insert_select/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_select/sqlite/query.sql b/internal/endtoend/testdata/insert_select/sqlite/query.sql index 69aee7f0e9..880f083f9e 100644 --- a/internal/endtoend/testdata/insert_select/sqlite/query.sql +++ b/internal/endtoend/testdata/insert_select/sqlite/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE bar (name text not null, ready bool not null); -CREATE TABLE foo (name text not null, meta text not null); - /* name: InsertSelect :exec */ INSERT INTO foo (name, meta) SELECT name, ? diff --git a/internal/endtoend/testdata/insert_select/sqlite/schema.sql b/internal/endtoend/testdata/insert_select/sqlite/schema.sql new file mode 100644 index 0000000000..1a394f8c44 --- /dev/null +++ b/internal/endtoend/testdata/insert_select/sqlite/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE bar (name text not null, ready bool not null); +CREATE TABLE foo (name text not null, meta text not null); + diff --git a/internal/endtoend/testdata/insert_select/sqlite/sqlc.json b/internal/endtoend/testdata/insert_select/sqlite/sqlc.json index 13e65f3ffd..f8e8051087 100644 --- a/internal/endtoend/testdata/insert_select/sqlite/sqlc.json +++ b/internal/endtoend/testdata/insert_select/sqlite/sqlc.json @@ -5,7 +5,7 @@ "engine": "sqlite", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/insert_select_case/issue.md b/internal/endtoend/testdata/insert_select_case/issue.md new file mode 100644 index 0000000000..f4090f863a --- /dev/null +++ b/internal/endtoend/testdata/insert_select_case/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1646 diff --git a/internal/endtoend/testdata/insert_select_case/postgresql/pgx/exec.json b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/insert_select_case/postgresql/pgx/go/db.go b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/insert_select_case/postgresql/pgx/go/models.go b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..284ebb005e --- /dev/null +++ b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Order struct { + ID pgtype.Int8 + Name pgtype.Text +} diff --git a/internal/endtoend/testdata/insert_select_case/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..aee709a672 --- /dev/null +++ b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/go/query.sql.go @@ -0,0 +1,28 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const insertOrders = `-- name: InsertOrders :exec +insert into Orders (id,name) +select id , CASE WHEN $1::BOOLEAN THEN $2 ELSE s.name END +from Orders s +` + +type InsertOrdersParams struct { + NameDoUpdate pgtype.Bool + Name pgtype.Text +} + +func (q *Queries) InsertOrders(ctx context.Context, arg InsertOrdersParams) error { + _, err := q.db.Exec(ctx, insertOrders, arg.NameDoUpdate, arg.Name) + return err +} diff --git a/internal/endtoend/testdata/insert_select_case/postgresql/pgx/query.sql b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/query.sql new file mode 100644 index 0000000000..4396b7bf20 --- /dev/null +++ b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/query.sql @@ -0,0 +1,4 @@ +-- name: InsertOrders :exec +insert into Orders (id,name) +select id , CASE WHEN @name_do_update::BOOLEAN THEN @name ELSE s.name END +from Orders s ; diff --git a/internal/endtoend/testdata/insert_select_case/postgresql/pgx/schema.sql b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..cbc21a5b7b --- /dev/null +++ b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE orders( + id bigserial, + name text +); diff --git a/internal/endtoend/testdata/insert_select_case/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..ee50c7b6e8 --- /dev/null +++ b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/sqlc.yaml @@ -0,0 +1,12 @@ +version: "2" +cloud: + project: "01HAQMMECEYQYKFJN8MP16QC41" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/insert_select_invalid/mysql/query.sql b/internal/endtoend/testdata/insert_select_invalid/mysql/query.sql index cfd90fe55d..3311b32009 100644 --- a/internal/endtoend/testdata/insert_select_invalid/mysql/query.sql +++ b/internal/endtoend/testdata/insert_select_invalid/mysql/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar text); - -- name: InsertFoo :exec INSERT INTO foo (bar) SELECT 1, ?, ?; diff --git a/internal/endtoend/testdata/insert_select_invalid/mysql/schema.sql b/internal/endtoend/testdata/insert_select_invalid/mysql/schema.sql new file mode 100644 index 0000000000..d849628fb1 --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/mysql/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (bar text); diff --git a/internal/endtoend/testdata/insert_select_invalid/mysql/sqlc.json b/internal/endtoend/testdata/insert_select_invalid/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/insert_select_invalid/mysql/sqlc.json +++ b/internal/endtoend/testdata/insert_select_invalid/mysql/sqlc.json @@ -5,7 +5,7 @@ "engine": "mysql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/insert_select_invalid/mysql/stderr.txt b/internal/endtoend/testdata/insert_select_invalid/mysql/stderr.txt index 063b2a149a..91d0b8a06c 100644 --- a/internal/endtoend/testdata/insert_select_invalid/mysql/stderr.txt +++ b/internal/endtoend/testdata/insert_select_invalid/mysql/stderr.txt @@ -1,2 +1,2 @@ # package querytest -query.sql:4:1: INSERT has more expressions than target columns +query.sql:1:1: INSERT has more expressions than target columns diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/query.sql index 41b0289d23..fad60fef89 100644 --- a/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar text); - -- name: InsertFoo :exec INSERT INTO foo (bar) -SELECT 1, $1, $2; +SELECT 1, $1, $2; \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..be35e943bd --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (bar text); \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/stderr.txt b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/stderr.txt deleted file mode 100644 index 063b2a149a..0000000000 --- a/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -# package querytest -query.sql:4:1: INSERT has more expressions than target columns diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/stderr/base.txt b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/stderr/base.txt new file mode 100644 index 0000000000..77fedb8c3a --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/stderr/base.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:1:1: INSERT has more expressions than target columns \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/stderr/managed-db.txt b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/stderr/managed-db.txt new file mode 100644 index 0000000000..7448a74a95 --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v4/stderr/managed-db.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:3:11: INSERT has more expressions than target columns \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/query.sql index 41b0289d23..fad60fef89 100644 --- a/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar text); - -- name: InsertFoo :exec INSERT INTO foo (bar) -SELECT 1, $1, $2; +SELECT 1, $1, $2; \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..be35e943bd --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (bar text); \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/stderr.txt b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/stderr.txt deleted file mode 100644 index 063b2a149a..0000000000 --- a/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -# package querytest -query.sql:4:1: INSERT has more expressions than target columns diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/stderr/base.txt b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/stderr/base.txt new file mode 100644 index 0000000000..77fedb8c3a --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/stderr/base.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:1:1: INSERT has more expressions than target columns \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/stderr/managed-db.txt b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/stderr/managed-db.txt new file mode 100644 index 0000000000..7448a74a95 --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/postgresql/pgx/v5/stderr/managed-db.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:3:11: INSERT has more expressions than target columns \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/query.sql b/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/query.sql index 41b0289d23..fad60fef89 100644 --- a/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar text); - -- name: InsertFoo :exec INSERT INTO foo (bar) -SELECT 1, $1, $2; +SELECT 1, $1, $2; \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..be35e943bd --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (bar text); \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/sqlc.json index de427d069f..cd518671ac 100644 --- a/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "engine": "postgresql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/stderr.txt b/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/stderr.txt deleted file mode 100644 index 063b2a149a..0000000000 --- a/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -# package querytest -query.sql:4:1: INSERT has more expressions than target columns diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/stderr/base.txt b/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/stderr/base.txt new file mode 100644 index 0000000000..77fedb8c3a --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/stderr/base.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:1:1: INSERT has more expressions than target columns \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/stderr/managed-db.txt b/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/stderr/managed-db.txt new file mode 100644 index 0000000000..95a26a4d4f --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/postgresql/stdlib/stderr/managed-db.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:3:11: INSERT has more expressions than target columns diff --git a/internal/endtoend/testdata/insert_select_param/issue.md b/internal/endtoend/testdata/insert_select_param/issue.md new file mode 100644 index 0000000000..bbb421e88d --- /dev/null +++ b/internal/endtoend/testdata/insert_select_param/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1328 \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select_param/postgresql/pgx/exec.json b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/db.go b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/models.go b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..e4cf9d17ae --- /dev/null +++ b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Author struct { + ID int64 + Name string + Bio pgtype.Text +} diff --git a/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..999d9b755d --- /dev/null +++ b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/query.sql.go @@ -0,0 +1,29 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const insertSelect = `-- name: InsertSelect :exec +INSERT INTO authors (id, name, bio) +SELECT $1, name, bio +FROM authors +WHERE name = $2 +` + +type InsertSelectParams struct { + ID pgtype.Int8 + Name pgtype.Text +} + +func (q *Queries) InsertSelect(ctx context.Context, arg InsertSelectParams) error { + _, err := q.db.Exec(ctx, insertSelect, arg.ID, arg.Name) + return err +} diff --git a/internal/endtoend/testdata/insert_select_param/postgresql/pgx/query.sql b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/query.sql new file mode 100644 index 0000000000..ab990b0339 --- /dev/null +++ b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/query.sql @@ -0,0 +1,5 @@ +-- name: InsertSelect :exec +INSERT INTO authors (id, name, bio) +SELECT @id, name, bio +FROM authors +WHERE name = @name; \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select_param/postgresql/pgx/schema.sql b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..6684317695 --- /dev/null +++ b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select_param/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..01489e0ffc --- /dev/null +++ b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_values/mysql/go/db.go b/internal/endtoend/testdata/insert_values/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/insert_values/mysql/go/db.go +++ b/internal/endtoend/testdata/insert_values/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_values/mysql/go/models.go b/internal/endtoend/testdata/insert_values/mysql/go/models.go index 674ec3cb70..f2005088fc 100644 --- a/internal/endtoend/testdata/insert_values/mysql/go/models.go +++ b/internal/endtoend/testdata/insert_values/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_values/mysql/go/query.sql.go b/internal/endtoend/testdata/insert_values/mysql/go/query.sql.go index 1f22c5b055..48ad158166 100644 --- a/internal/endtoend/testdata/insert_values/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_values/mysql/query.sql b/internal/endtoend/testdata/insert_values/mysql/query.sql index 2a669b3619..774165baa8 100644 --- a/internal/endtoend/testdata/insert_values/mysql/query.sql +++ b/internal/endtoend/testdata/insert_values/mysql/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (a text, b integer); - /* name: InsertValues :exec */ INSERT INTO foo (a, b) VALUES (?, ?); diff --git a/internal/endtoend/testdata/insert_values/mysql/schema.sql b/internal/endtoend/testdata/insert_values/mysql/schema.sql new file mode 100644 index 0000000000..ca4d437be0 --- /dev/null +++ b/internal/endtoend/testdata/insert_values/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b integer); + diff --git a/internal/endtoend/testdata/insert_values/mysql/sqlc.json b/internal/endtoend/testdata/insert_values/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/insert_values/mysql/sqlc.json +++ b/internal/endtoend/testdata/insert_values/mysql/sqlc.json @@ -5,7 +5,7 @@ "engine": "mysql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/models.go index 674ec3cb70..f2005088fc 100644 --- a/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/query.sql.go index 7e60934302..87e661b275 100644 --- a/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/query.sql index 757a65e9c1..0c2b0d6ea4 100644 --- a/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (a text, b integer); - -- name: InsertValues :exec INSERT INTO foo (a, b) VALUES ($1, $2); diff --git a/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..ca4d437be0 --- /dev/null +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b integer); + diff --git a/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/models.go index 1fc74d22e6..903f1becc4 100644 --- a/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/query.sql.go index 9d184c0ac0..1d1700f3a7 100644 --- a/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/query.sql index 757a65e9c1..0c2b0d6ea4 100644 --- a/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (a text, b integer); - -- name: InsertValues :exec INSERT INTO foo (a, b) VALUES ($1, $2); diff --git a/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..ca4d437be0 --- /dev/null +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b integer); + diff --git a/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/models.go index 674ec3cb70..f2005088fc 100644 --- a/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/query.sql.go index 6a14a1d0eb..1fc6cf6420 100644 --- a/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_values/postgresql/stdlib/query.sql b/internal/endtoend/testdata/insert_values/postgresql/stdlib/query.sql index 757a65e9c1..0c2b0d6ea4 100644 --- a/internal/endtoend/testdata/insert_values/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/insert_values/postgresql/stdlib/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (a text, b integer); - -- name: InsertValues :exec INSERT INTO foo (a, b) VALUES ($1, $2); diff --git a/internal/endtoend/testdata/insert_values/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/insert_values/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..ca4d437be0 --- /dev/null +++ b/internal/endtoend/testdata/insert_values/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b integer); + diff --git a/internal/endtoend/testdata/insert_values/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/insert_values/postgresql/stdlib/sqlc.json index de427d069f..cd518671ac 100644 --- a/internal/endtoend/testdata/insert_values/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/insert_values/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "engine": "postgresql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/insert_values/sqlite/go/db.go b/internal/endtoend/testdata/insert_values/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/insert_values/sqlite/go/db.go +++ b/internal/endtoend/testdata/insert_values/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_values/sqlite/go/models.go b/internal/endtoend/testdata/insert_values/sqlite/go/models.go index 3f5303e7ab..dd3059b3f4 100644 --- a/internal/endtoend/testdata/insert_values/sqlite/go/models.go +++ b/internal/endtoend/testdata/insert_values/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_values/sqlite/go/query.sql.go b/internal/endtoend/testdata/insert_values/sqlite/go/query.sql.go index ae058ecf2c..020dbedda1 100644 --- a/internal/endtoend/testdata/insert_values/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_values/sqlite/query.sql b/internal/endtoend/testdata/insert_values/sqlite/query.sql index 2a669b3619..774165baa8 100644 --- a/internal/endtoend/testdata/insert_values/sqlite/query.sql +++ b/internal/endtoend/testdata/insert_values/sqlite/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (a text, b integer); - /* name: InsertValues :exec */ INSERT INTO foo (a, b) VALUES (?, ?); diff --git a/internal/endtoend/testdata/insert_values/sqlite/schema.sql b/internal/endtoend/testdata/insert_values/sqlite/schema.sql new file mode 100644 index 0000000000..ca4d437be0 --- /dev/null +++ b/internal/endtoend/testdata/insert_values/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b integer); + diff --git a/internal/endtoend/testdata/insert_values/sqlite/sqlc.json b/internal/endtoend/testdata/insert_values/sqlite/sqlc.json index 13e65f3ffd..f8e8051087 100644 --- a/internal/endtoend/testdata/insert_values/sqlite/sqlc.json +++ b/internal/endtoend/testdata/insert_values/sqlite/sqlc.json @@ -5,7 +5,7 @@ "engine": "sqlite", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/insert_values_only/issue.md b/internal/endtoend/testdata/insert_values_only/issue.md new file mode 100644 index 0000000000..a7ea8fc1ac --- /dev/null +++ b/internal/endtoend/testdata/insert_values_only/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/938 \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_values_only/postgresql/pgx/exec.json b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/insert_values_only/postgresql/pgx/go/db.go b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/insert_values_only/postgresql/pgx/go/models.go b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..5e934e1313 --- /dev/null +++ b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Status struct { + ID int32 + Name string +} diff --git a/internal/endtoend/testdata/insert_values_only/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..a265e061b4 --- /dev/null +++ b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/go/query.sql.go @@ -0,0 +1,26 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const insertStatus = `-- name: InsertStatus :exec +INSERT INTO status VALUES ($1, $2) +` + +type InsertStatusParams struct { + Column1 pgtype.Int4 + Column2 pgtype.Text +} + +func (q *Queries) InsertStatus(ctx context.Context, arg InsertStatusParams) error { + _, err := q.db.Exec(ctx, insertStatus, arg.Column1, arg.Column2) + return err +} diff --git a/internal/endtoend/testdata/insert_values_only/postgresql/pgx/query.sql b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/query.sql new file mode 100644 index 0000000000..97313e7b17 --- /dev/null +++ b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/query.sql @@ -0,0 +1,2 @@ +-- name: InsertStatus :exec +INSERT INTO status VALUES ($1, $2); \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_values_only/postgresql/pgx/schema.sql b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..fc8f305d1e --- /dev/null +++ b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE status +( + id integer, + name varchar(100) NOT NULL, + PRIMARY KEY(id) +); \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_values_only/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/insert_values_public/mysql/go/db.go b/internal/endtoend/testdata/insert_values_public/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/insert_values_public/mysql/go/db.go +++ b/internal/endtoend/testdata/insert_values_public/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_values_public/mysql/go/models.go b/internal/endtoend/testdata/insert_values_public/mysql/go/models.go index 674ec3cb70..f2005088fc 100644 --- a/internal/endtoend/testdata/insert_values_public/mysql/go/models.go +++ b/internal/endtoend/testdata/insert_values_public/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_values_public/mysql/go/query.sql.go b/internal/endtoend/testdata/insert_values_public/mysql/go/query.sql.go index 3860a045f2..e8bba2efbd 100644 --- a/internal/endtoend/testdata/insert_values_public/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values_public/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_values_public/mysql/query.sql b/internal/endtoend/testdata/insert_values_public/mysql/query.sql index 3d101ce31e..22caf7b339 100644 --- a/internal/endtoend/testdata/insert_values_public/mysql/query.sql +++ b/internal/endtoend/testdata/insert_values_public/mysql/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (a text, b integer); - /* name: InsertValues :exec */ INSERT INTO public.foo (a, b) VALUES (?, ?); diff --git a/internal/endtoend/testdata/insert_values_public/mysql/schema.sql b/internal/endtoend/testdata/insert_values_public/mysql/schema.sql new file mode 100644 index 0000000000..ca4d437be0 --- /dev/null +++ b/internal/endtoend/testdata/insert_values_public/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b integer); + diff --git a/internal/endtoend/testdata/insert_values_public/mysql/sqlc.json b/internal/endtoend/testdata/insert_values_public/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/insert_values_public/mysql/sqlc.json +++ b/internal/endtoend/testdata/insert_values_public/mysql/sqlc.json @@ -5,7 +5,7 @@ "engine": "mysql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/models.go index 674ec3cb70..f2005088fc 100644 --- a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/query.sql.go index 547c8dfde2..7661064e22 100644 --- a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/query.sql index 01aa79ad19..9b6c822ab1 100644 --- a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (a text, b integer); - -- name: InsertValues :exec INSERT INTO public.foo (a, b) VALUES ($1, $2); diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..ca4d437be0 --- /dev/null +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b integer); + diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/models.go index 1fc74d22e6..903f1becc4 100644 --- a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/query.sql.go index 2306531840..1f43dec81c 100644 --- a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/query.sql index 01aa79ad19..9b6c822ab1 100644 --- a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (a text, b integer); - -- name: InsertValues :exec INSERT INTO public.foo (a, b) VALUES ($1, $2); diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..ca4d437be0 --- /dev/null +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b integer); + diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/models.go index 674ec3cb70..f2005088fc 100644 --- a/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/query.sql.go index 93d444f916..3d43beeadb 100644 --- a/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/query.sql b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/query.sql index 01aa79ad19..9b6c822ab1 100644 --- a/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (a text, b integer); - -- name: InsertValues :exec INSERT INTO public.foo (a, b) VALUES ($1, $2); diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..ca4d437be0 --- /dev/null +++ b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b integer); + diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/sqlc.json index de427d069f..cd518671ac 100644 --- a/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "engine": "postgresql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/interval/pgx/v4/exec.json b/internal/endtoend/testdata/interval/pgx/v4/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/interval/pgx/v4/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/interval/pgx/v4/go/db.go b/internal/endtoend/testdata/interval/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/interval/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/interval/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/interval/pgx/v4/go/models.go b/internal/endtoend/testdata/interval/pgx/v4/go/models.go index a429fb036a..9fec5373e2 100644 --- a/internal/endtoend/testdata/interval/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/interval/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Bar bool Interval int64 diff --git a/internal/endtoend/testdata/interval/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/interval/pgx/v4/go/query.sql.go index 76304205eb..db86257899 100644 --- a/internal/endtoend/testdata/interval/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/interval/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/interval/pgx/v4/query.sql b/internal/endtoend/testdata/interval/pgx/v4/query.sql index ce0d11b319..27cd9d79ec 100644 --- a/internal/endtoend/testdata/interval/pgx/v4/query.sql +++ b/internal/endtoend/testdata/interval/pgx/v4/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (bar bool not null, "interval" interval not null); - -- name: Get :many SELECT bar, "interval" FROM foo LIMIT $1; diff --git a/internal/endtoend/testdata/interval/pgx/v4/schema.sql b/internal/endtoend/testdata/interval/pgx/v4/schema.sql new file mode 100644 index 0000000000..feec037283 --- /dev/null +++ b/internal/endtoend/testdata/interval/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar bool not null, "interval" interval not null); + diff --git a/internal/endtoend/testdata/interval/pgx/v4/sqlc.json b/internal/endtoend/testdata/interval/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/interval/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/interval/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/interval/pgx/v5/exec.json b/internal/endtoend/testdata/interval/pgx/v5/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/interval/pgx/v5/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/interval/pgx/v5/go/db.go b/internal/endtoend/testdata/interval/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/interval/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/interval/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/interval/pgx/v5/go/models.go b/internal/endtoend/testdata/interval/pgx/v5/go/models.go index 7d3aea19b6..95996c8d15 100644 --- a/internal/endtoend/testdata/interval/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/interval/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/interval/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/interval/pgx/v5/go/query.sql.go index 76304205eb..db86257899 100644 --- a/internal/endtoend/testdata/interval/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/interval/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/interval/pgx/v5/query.sql b/internal/endtoend/testdata/interval/pgx/v5/query.sql index ce0d11b319..27cd9d79ec 100644 --- a/internal/endtoend/testdata/interval/pgx/v5/query.sql +++ b/internal/endtoend/testdata/interval/pgx/v5/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (bar bool not null, "interval" interval not null); - -- name: Get :many SELECT bar, "interval" FROM foo LIMIT $1; diff --git a/internal/endtoend/testdata/interval/pgx/v5/schema.sql b/internal/endtoend/testdata/interval/pgx/v5/schema.sql new file mode 100644 index 0000000000..feec037283 --- /dev/null +++ b/internal/endtoend/testdata/interval/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar bool not null, "interval" interval not null); + diff --git a/internal/endtoend/testdata/interval/pgx/v5/sqlc.json b/internal/endtoend/testdata/interval/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/interval/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/interval/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/interval/stdlib/exec.json b/internal/endtoend/testdata/interval/stdlib/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/interval/stdlib/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/interval/stdlib/go/db.go b/internal/endtoend/testdata/interval/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/interval/stdlib/go/db.go +++ b/internal/endtoend/testdata/interval/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/interval/stdlib/go/models.go b/internal/endtoend/testdata/interval/stdlib/go/models.go index a429fb036a..9fec5373e2 100644 --- a/internal/endtoend/testdata/interval/stdlib/go/models.go +++ b/internal/endtoend/testdata/interval/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Bar bool Interval int64 diff --git a/internal/endtoend/testdata/interval/stdlib/go/query.sql.go b/internal/endtoend/testdata/interval/stdlib/go/query.sql.go index 9782f271eb..5576d7614f 100644 --- a/internal/endtoend/testdata/interval/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/interval/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/interval/stdlib/query.sql b/internal/endtoend/testdata/interval/stdlib/query.sql index ce0d11b319..27cd9d79ec 100644 --- a/internal/endtoend/testdata/interval/stdlib/query.sql +++ b/internal/endtoend/testdata/interval/stdlib/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (bar bool not null, "interval" interval not null); - -- name: Get :many SELECT bar, "interval" FROM foo LIMIT $1; diff --git a/internal/endtoend/testdata/interval/stdlib/schema.sql b/internal/endtoend/testdata/interval/stdlib/schema.sql new file mode 100644 index 0000000000..feec037283 --- /dev/null +++ b/internal/endtoend/testdata/interval/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar bool not null, "interval" interval not null); + diff --git a/internal/endtoend/testdata/interval/stdlib/sqlc.json b/internal/endtoend/testdata/interval/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/interval/stdlib/sqlc.json +++ b/internal/endtoend/testdata/interval/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/invalid_func_args/pgx/v4/query.sql b/internal/endtoend/testdata/invalid_func_args/pgx/v4/query.sql index 46dbe9fa2d..e92c21d811 100644 --- a/internal/endtoend/testdata/invalid_func_args/pgx/v4/query.sql +++ b/internal/endtoend/testdata/invalid_func_args/pgx/v4/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT random(1); diff --git a/internal/endtoend/testdata/invalid_func_args/pgx/v4/schema.sql b/internal/endtoend/testdata/invalid_func_args/pgx/v4/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/invalid_func_args/pgx/v4/sqlc.json b/internal/endtoend/testdata/invalid_func_args/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/invalid_func_args/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/invalid_func_args/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/invalid_func_args/pgx/v4/stderr.txt b/internal/endtoend/testdata/invalid_func_args/pgx/v4/stderr.txt deleted file mode 100644 index 09d46d1f95..0000000000 --- a/internal/endtoend/testdata/invalid_func_args/pgx/v4/stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -# package querytest -query.sql:1:8: function random(unknown) does not exist diff --git a/internal/endtoend/testdata/invalid_func_args/pgx/v4/stderr/base.txt b/internal/endtoend/testdata/invalid_func_args/pgx/v4/stderr/base.txt new file mode 100644 index 0000000000..2693a08462 --- /dev/null +++ b/internal/endtoend/testdata/invalid_func_args/pgx/v4/stderr/base.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:2:8: function random(unknown) does not exist diff --git a/internal/endtoend/testdata/invalid_func_args/pgx/v4/stderr/managed-db.txt b/internal/endtoend/testdata/invalid_func_args/pgx/v4/stderr/managed-db.txt new file mode 100644 index 0000000000..d211139c8a --- /dev/null +++ b/internal/endtoend/testdata/invalid_func_args/pgx/v4/stderr/managed-db.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:2:8: function random(integer) does not exist diff --git a/internal/endtoend/testdata/invalid_func_args/pgx/v5/query.sql b/internal/endtoend/testdata/invalid_func_args/pgx/v5/query.sql index 46dbe9fa2d..e92c21d811 100644 --- a/internal/endtoend/testdata/invalid_func_args/pgx/v5/query.sql +++ b/internal/endtoend/testdata/invalid_func_args/pgx/v5/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT random(1); diff --git a/internal/endtoend/testdata/invalid_func_args/pgx/v5/schema.sql b/internal/endtoend/testdata/invalid_func_args/pgx/v5/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/invalid_func_args/pgx/v5/sqlc.json b/internal/endtoend/testdata/invalid_func_args/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/invalid_func_args/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/invalid_func_args/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/invalid_func_args/pgx/v5/stderr.txt b/internal/endtoend/testdata/invalid_func_args/pgx/v5/stderr.txt deleted file mode 100644 index 09d46d1f95..0000000000 --- a/internal/endtoend/testdata/invalid_func_args/pgx/v5/stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -# package querytest -query.sql:1:8: function random(unknown) does not exist diff --git a/internal/endtoend/testdata/invalid_func_args/pgx/v5/stderr/base.txt b/internal/endtoend/testdata/invalid_func_args/pgx/v5/stderr/base.txt new file mode 100644 index 0000000000..2693a08462 --- /dev/null +++ b/internal/endtoend/testdata/invalid_func_args/pgx/v5/stderr/base.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:2:8: function random(unknown) does not exist diff --git a/internal/endtoend/testdata/invalid_func_args/pgx/v5/stderr/managed-db.txt b/internal/endtoend/testdata/invalid_func_args/pgx/v5/stderr/managed-db.txt new file mode 100644 index 0000000000..d211139c8a --- /dev/null +++ b/internal/endtoend/testdata/invalid_func_args/pgx/v5/stderr/managed-db.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:2:8: function random(integer) does not exist diff --git a/internal/endtoend/testdata/invalid_func_args/stdlib/query.sql b/internal/endtoend/testdata/invalid_func_args/stdlib/query.sql index 46dbe9fa2d..e92c21d811 100644 --- a/internal/endtoend/testdata/invalid_func_args/stdlib/query.sql +++ b/internal/endtoend/testdata/invalid_func_args/stdlib/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT random(1); diff --git a/internal/endtoend/testdata/invalid_func_args/stdlib/schema.sql b/internal/endtoend/testdata/invalid_func_args/stdlib/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/invalid_func_args/stdlib/sqlc.json b/internal/endtoend/testdata/invalid_func_args/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/invalid_func_args/stdlib/sqlc.json +++ b/internal/endtoend/testdata/invalid_func_args/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/invalid_func_args/stdlib/stderr.txt b/internal/endtoend/testdata/invalid_func_args/stdlib/stderr.txt deleted file mode 100644 index 09d46d1f95..0000000000 --- a/internal/endtoend/testdata/invalid_func_args/stdlib/stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -# package querytest -query.sql:1:8: function random(unknown) does not exist diff --git a/internal/endtoend/testdata/invalid_func_args/stdlib/stderr/base.txt b/internal/endtoend/testdata/invalid_func_args/stdlib/stderr/base.txt new file mode 100644 index 0000000000..2693a08462 --- /dev/null +++ b/internal/endtoend/testdata/invalid_func_args/stdlib/stderr/base.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:2:8: function random(unknown) does not exist diff --git a/internal/endtoend/testdata/invalid_func_args/stdlib/stderr/managed-db.txt b/internal/endtoend/testdata/invalid_func_args/stdlib/stderr/managed-db.txt new file mode 100644 index 0000000000..d211139c8a --- /dev/null +++ b/internal/endtoend/testdata/invalid_func_args/stdlib/stderr/managed-db.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:2:8: function random(integer) does not exist diff --git a/internal/endtoend/testdata/invalid_group_by_reference/mysql/exec.json b/internal/endtoend/testdata/invalid_group_by_reference/mysql/exec.json new file mode 100644 index 0000000000..0775566a14 --- /dev/null +++ b/internal/endtoend/testdata/invalid_group_by_reference/mysql/exec.json @@ -0,0 +1,6 @@ +{ + "meta": { + "invalid_schema": true + } +} + diff --git a/internal/endtoend/testdata/invalid_group_by_reference/mysql/query.sql b/internal/endtoend/testdata/invalid_group_by_reference/mysql/query.sql index 75a8e210fd..b036fba240 100644 --- a/internal/endtoend/testdata/invalid_group_by_reference/mysql/query.sql +++ b/internal/endtoend/testdata/invalid_group_by_reference/mysql/query.sql @@ -1,10 +1,3 @@ -CREATE TABLE authors ( - id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, - name text NOT NULL, - bio text, - UNIQUE(name) -); - -- name: ListAuthors :many SELECT * FROM authors diff --git a/internal/endtoend/testdata/invalid_group_by_reference/mysql/schema.sql b/internal/endtoend/testdata/invalid_group_by_reference/mysql/schema.sql new file mode 100644 index 0000000000..5333d484a6 --- /dev/null +++ b/internal/endtoend/testdata/invalid_group_by_reference/mysql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/invalid_group_by_reference/mysql/sqlc.json b/internal/endtoend/testdata/invalid_group_by_reference/mysql/sqlc.json index 534b7e24e9..0390f67889 100644 --- a/internal/endtoend/testdata/invalid_group_by_reference/mysql/sqlc.json +++ b/internal/endtoend/testdata/invalid_group_by_reference/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/invalid_group_by_reference/mysql/stderr.txt b/internal/endtoend/testdata/invalid_group_by_reference/mysql/stderr.txt index 1fc9998d4c..d686d4f4d8 100644 --- a/internal/endtoend/testdata/invalid_group_by_reference/mysql/stderr.txt +++ b/internal/endtoend/testdata/invalid_group_by_reference/mysql/stderr.txt @@ -1,2 +1,2 @@ # package querytest -query.sql:11:10: column reference "invalid_reference" not found +query.sql:4:10: column reference "invalid_reference" not found diff --git a/internal/endtoend/testdata/invalid_group_by_reference/postgresql/query.sql b/internal/endtoend/testdata/invalid_group_by_reference/postgresql/query.sql index fdfa7e4e05..8275f8cfe1 100644 --- a/internal/endtoend/testdata/invalid_group_by_reference/postgresql/query.sql +++ b/internal/endtoend/testdata/invalid_group_by_reference/postgresql/query.sql @@ -1,10 +1,4 @@ -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - name text NOT NULL, - bio text -); - -- name: ListAuthors :many SELECT * FROM authors -GROUP BY invalid_reference; +GROUP BY invalid_reference; \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_group_by_reference/postgresql/schema.sql b/internal/endtoend/testdata/invalid_group_by_reference/postgresql/schema.sql new file mode 100644 index 0000000000..69b607d902 --- /dev/null +++ b/internal/endtoend/testdata/invalid_group_by_reference/postgresql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/invalid_group_by_reference/postgresql/sqlc.json b/internal/endtoend/testdata/invalid_group_by_reference/postgresql/sqlc.json index af57681f66..a590361309 100644 --- a/internal/endtoend/testdata/invalid_group_by_reference/postgresql/sqlc.json +++ b/internal/endtoend/testdata/invalid_group_by_reference/postgresql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/invalid_group_by_reference/postgresql/stderr.txt b/internal/endtoend/testdata/invalid_group_by_reference/postgresql/stderr.txt deleted file mode 100644 index e9dd12bc6f..0000000000 --- a/internal/endtoend/testdata/invalid_group_by_reference/postgresql/stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -# package querytest -query.sql:10:10: column reference "invalid_reference" not found diff --git a/internal/endtoend/testdata/invalid_group_by_reference/postgresql/stderr/base.txt b/internal/endtoend/testdata/invalid_group_by_reference/postgresql/stderr/base.txt new file mode 100644 index 0000000000..d686d4f4d8 --- /dev/null +++ b/internal/endtoend/testdata/invalid_group_by_reference/postgresql/stderr/base.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:4:10: column reference "invalid_reference" not found diff --git a/internal/endtoend/testdata/invalid_group_by_reference/postgresql/stderr/managed-db.txt b/internal/endtoend/testdata/invalid_group_by_reference/postgresql/stderr/managed-db.txt new file mode 100644 index 0000000000..d13cdbaf62 --- /dev/null +++ b/internal/endtoend/testdata/invalid_group_by_reference/postgresql/stderr/managed-db.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:4:22: column "invalid_reference" does not exist diff --git a/internal/endtoend/testdata/invalid_insert_unknown_column/issue.md b/internal/endtoend/testdata/invalid_insert_unknown_column/issue.md new file mode 100644 index 0000000000..70cc5f22a5 --- /dev/null +++ b/internal/endtoend/testdata/invalid_insert_unknown_column/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/381 diff --git a/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/db/db.go b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/db/db.go new file mode 100644 index 0000000000..9d485b5f16 --- /dev/null +++ b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/db/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/db/models.go b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/db/models.go new file mode 100644 index 0000000000..d3515f1ede --- /dev/null +++ b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/db/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Author struct { + ID int64 + Name string + Bio pgtype.Text +} diff --git a/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/db/query.sql.go b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/db/query.sql.go new file mode 100644 index 0000000000..2ce1040c41 --- /dev/null +++ b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/db/query.sql.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const createAuthor = `-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio, missing_column +) VALUES ( + $1, $2, true +) +RETURNING id, name, bio +` + +type CreateAuthorParams struct { + Name string + Bio pgtype.Text +} + +func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { + row := q.db.QueryRow(ctx, createAuthor, arg.Name, arg.Bio) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} diff --git a/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/exec.json b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/query.sql b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/query.sql new file mode 100644 index 0000000000..db75df36e8 --- /dev/null +++ b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/query.sql @@ -0,0 +1,7 @@ +-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio, missing_column +) VALUES ( + $1, $2, true +) +RETURNING *; diff --git a/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/schema.sql b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..69b607d902 --- /dev/null +++ b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/sqlc.json b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/sqlc.json new file mode 100644 index 0000000000..7b7c623e56 --- /dev/null +++ b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/sqlc.json @@ -0,0 +1,19 @@ +{ + "version": "1", + "cloud": { + "project": "01HAQMMECEYQYKFJN8MP16QC41" + }, + "packages": [ + { + "path": "db", + "engine": "postgresql", + "database": { + "managed": true + }, + "sql_package": "pgx/v5", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} + diff --git a/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/stderr.txt b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/stderr.txt new file mode 100644 index 0000000000..60421d56bd --- /dev/null +++ b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/stderr.txt @@ -0,0 +1,2 @@ +# package db +query.sql:3:14: column "missing_column" of relation "authors" does not exist \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_named_params/mysql/query.sql b/internal/endtoend/testdata/invalid_named_params/mysql/query.sql index 1ea4a9e5dc..349d2c2ccb 100644 --- a/internal/endtoend/testdata/invalid_named_params/mysql/query.sql +++ b/internal/endtoend/testdata/invalid_named_params/mysql/query.sql @@ -1,8 +1,3 @@ -CREATE TABLE authors ( - id BIGINT PRIMARY KEY, - bio TEXT -); - -- name: ListAuthors :one SELECT * FROM authors diff --git a/internal/endtoend/testdata/invalid_named_params/mysql/schema.sql b/internal/endtoend/testdata/invalid_named_params/mysql/schema.sql new file mode 100644 index 0000000000..9804a5cd1b --- /dev/null +++ b/internal/endtoend/testdata/invalid_named_params/mysql/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE authors ( + id BIGINT PRIMARY KEY, + bio TEXT +); diff --git a/internal/endtoend/testdata/invalid_named_params/mysql/sqlc.json b/internal/endtoend/testdata/invalid_named_params/mysql/sqlc.json index 534b7e24e9..0390f67889 100644 --- a/internal/endtoend/testdata/invalid_named_params/mysql/sqlc.json +++ b/internal/endtoend/testdata/invalid_named_params/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/invalid_params/pgx/v4/query.sql b/internal/endtoend/testdata/invalid_params/pgx/v4/query.sql index e65eb9970d..8a798cbb8c 100644 --- a/internal/endtoend/testdata/invalid_params/pgx/v4/query.sql +++ b/internal/endtoend/testdata/invalid_params/pgx/v4/query.sql @@ -1,9 +1,7 @@ -CREATE TABLE bar (id serial not null); - -- name: baz :one SELECT foo FROM bar WHERE baz = $4; --- name: bar +-- name: bar :one SELECT foo FROM bar WHERE baz = $1 AND baz = $3; -- name: foo :one diff --git a/internal/endtoend/testdata/invalid_params/pgx/v4/schema.sql b/internal/endtoend/testdata/invalid_params/pgx/v4/schema.sql new file mode 100644 index 0000000000..b7ee888d47 --- /dev/null +++ b/internal/endtoend/testdata/invalid_params/pgx/v4/schema.sql @@ -0,0 +1 @@ +CREATE TABLE bar (id serial not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_params/pgx/v4/sqlc.json b/internal/endtoend/testdata/invalid_params/pgx/v4/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/invalid_params/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/invalid_params/pgx/v4/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/invalid_params/pgx/v4/stderr.txt b/internal/endtoend/testdata/invalid_params/pgx/v4/stderr.txt deleted file mode 100644 index 722c3e2408..0000000000 --- a/internal/endtoend/testdata/invalid_params/pgx/v4/stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -# package querytest -query.sql:4:1: could not determine data type of parameter $1 -query.sql:7:1: could not determine data type of parameter $2 -query.sql:10:8: column "foo" does not exist -query.sql:13:1: could not determine data type of parameter $2 diff --git a/internal/endtoend/testdata/invalid_params/pgx/v4/stderr/base.txt b/internal/endtoend/testdata/invalid_params/pgx/v4/stderr/base.txt new file mode 100644 index 0000000000..c74f98d2c2 --- /dev/null +++ b/internal/endtoend/testdata/invalid_params/pgx/v4/stderr/base.txt @@ -0,0 +1,5 @@ +# package querytest +query.sql:1:1: could not determine data type of parameter $1 +query.sql:5:1: could not determine data type of parameter $2 +query.sql:8:8: column "foo" does not exist +query.sql:11:1: could not determine data type of parameter $2 diff --git a/internal/endtoend/testdata/invalid_params/pgx/v4/stderr/managed-db.txt b/internal/endtoend/testdata/invalid_params/pgx/v4/stderr/managed-db.txt new file mode 100644 index 0000000000..a7eff89c6a --- /dev/null +++ b/internal/endtoend/testdata/invalid_params/pgx/v4/stderr/managed-db.txt @@ -0,0 +1,5 @@ +# package querytest +query.sql:2:8: column "foo" does not exist +query.sql:5:8: column "foo" does not exist +query.sql:8:8: column "foo" does not exist +query.sql:8:20: could not determine data type of parameter $3 diff --git a/internal/endtoend/testdata/invalid_params/pgx/v5/query.sql b/internal/endtoend/testdata/invalid_params/pgx/v5/query.sql index e65eb9970d..8a798cbb8c 100644 --- a/internal/endtoend/testdata/invalid_params/pgx/v5/query.sql +++ b/internal/endtoend/testdata/invalid_params/pgx/v5/query.sql @@ -1,9 +1,7 @@ -CREATE TABLE bar (id serial not null); - -- name: baz :one SELECT foo FROM bar WHERE baz = $4; --- name: bar +-- name: bar :one SELECT foo FROM bar WHERE baz = $1 AND baz = $3; -- name: foo :one diff --git a/internal/endtoend/testdata/invalid_params/pgx/v5/schema.sql b/internal/endtoend/testdata/invalid_params/pgx/v5/schema.sql new file mode 100644 index 0000000000..b7ee888d47 --- /dev/null +++ b/internal/endtoend/testdata/invalid_params/pgx/v5/schema.sql @@ -0,0 +1 @@ +CREATE TABLE bar (id serial not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_params/pgx/v5/sqlc.json b/internal/endtoend/testdata/invalid_params/pgx/v5/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/invalid_params/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/invalid_params/pgx/v5/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/invalid_params/pgx/v5/stderr.txt b/internal/endtoend/testdata/invalid_params/pgx/v5/stderr.txt deleted file mode 100644 index 722c3e2408..0000000000 --- a/internal/endtoend/testdata/invalid_params/pgx/v5/stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -# package querytest -query.sql:4:1: could not determine data type of parameter $1 -query.sql:7:1: could not determine data type of parameter $2 -query.sql:10:8: column "foo" does not exist -query.sql:13:1: could not determine data type of parameter $2 diff --git a/internal/endtoend/testdata/invalid_params/pgx/v5/stderr/base.txt b/internal/endtoend/testdata/invalid_params/pgx/v5/stderr/base.txt new file mode 100644 index 0000000000..c74f98d2c2 --- /dev/null +++ b/internal/endtoend/testdata/invalid_params/pgx/v5/stderr/base.txt @@ -0,0 +1,5 @@ +# package querytest +query.sql:1:1: could not determine data type of parameter $1 +query.sql:5:1: could not determine data type of parameter $2 +query.sql:8:8: column "foo" does not exist +query.sql:11:1: could not determine data type of parameter $2 diff --git a/internal/endtoend/testdata/invalid_params/pgx/v5/stderr/managed-db.txt b/internal/endtoend/testdata/invalid_params/pgx/v5/stderr/managed-db.txt new file mode 100644 index 0000000000..a7eff89c6a --- /dev/null +++ b/internal/endtoend/testdata/invalid_params/pgx/v5/stderr/managed-db.txt @@ -0,0 +1,5 @@ +# package querytest +query.sql:2:8: column "foo" does not exist +query.sql:5:8: column "foo" does not exist +query.sql:8:8: column "foo" does not exist +query.sql:8:20: could not determine data type of parameter $3 diff --git a/internal/endtoend/testdata/invalid_params/stdlib/query.sql b/internal/endtoend/testdata/invalid_params/stdlib/query.sql index e65eb9970d..8a798cbb8c 100644 --- a/internal/endtoend/testdata/invalid_params/stdlib/query.sql +++ b/internal/endtoend/testdata/invalid_params/stdlib/query.sql @@ -1,9 +1,7 @@ -CREATE TABLE bar (id serial not null); - -- name: baz :one SELECT foo FROM bar WHERE baz = $4; --- name: bar +-- name: bar :one SELECT foo FROM bar WHERE baz = $1 AND baz = $3; -- name: foo :one diff --git a/internal/endtoend/testdata/invalid_params/stdlib/schema.sql b/internal/endtoend/testdata/invalid_params/stdlib/schema.sql new file mode 100644 index 0000000000..b7ee888d47 --- /dev/null +++ b/internal/endtoend/testdata/invalid_params/stdlib/schema.sql @@ -0,0 +1 @@ +CREATE TABLE bar (id serial not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_params/stdlib/sqlc.json b/internal/endtoend/testdata/invalid_params/stdlib/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/invalid_params/stdlib/sqlc.json +++ b/internal/endtoend/testdata/invalid_params/stdlib/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/invalid_params/stdlib/stderr.txt b/internal/endtoend/testdata/invalid_params/stdlib/stderr.txt deleted file mode 100644 index 722c3e2408..0000000000 --- a/internal/endtoend/testdata/invalid_params/stdlib/stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -# package querytest -query.sql:4:1: could not determine data type of parameter $1 -query.sql:7:1: could not determine data type of parameter $2 -query.sql:10:8: column "foo" does not exist -query.sql:13:1: could not determine data type of parameter $2 diff --git a/internal/endtoend/testdata/invalid_params/stdlib/stderr/base.txt b/internal/endtoend/testdata/invalid_params/stdlib/stderr/base.txt new file mode 100644 index 0000000000..c74f98d2c2 --- /dev/null +++ b/internal/endtoend/testdata/invalid_params/stdlib/stderr/base.txt @@ -0,0 +1,5 @@ +# package querytest +query.sql:1:1: could not determine data type of parameter $1 +query.sql:5:1: could not determine data type of parameter $2 +query.sql:8:8: column "foo" does not exist +query.sql:11:1: could not determine data type of parameter $2 diff --git a/internal/endtoend/testdata/invalid_params/stdlib/stderr/managed-db.txt b/internal/endtoend/testdata/invalid_params/stdlib/stderr/managed-db.txt new file mode 100644 index 0000000000..a7eff89c6a --- /dev/null +++ b/internal/endtoend/testdata/invalid_params/stdlib/stderr/managed-db.txt @@ -0,0 +1,5 @@ +# package querytest +query.sql:2:8: column "foo" does not exist +query.sql:5:8: column "foo" does not exist +query.sql:8:8: column "foo" does not exist +query.sql:8:20: could not determine data type of parameter $3 diff --git a/internal/endtoend/testdata/invalid_params_type_mismatch/issue.md b/internal/endtoend/testdata/invalid_params_type_mismatch/issue.md new file mode 100644 index 0000000000..93fc67215f --- /dev/null +++ b/internal/endtoend/testdata/invalid_params_type_mismatch/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/297 diff --git a/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/exec.json b/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/query.sql b/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/query.sql new file mode 100644 index 0000000000..c00d547905 --- /dev/null +++ b/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/query.sql @@ -0,0 +1,4 @@ +-- name: UpdateAuthor :exec +UPDATE authors +SET name = $1 +WHERE id = $1; diff --git a/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/schema.sql b/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..e37a99f69f --- /dev/null +++ b/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name boolean NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/sqlc.json b/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/sqlc.json new file mode 100644 index 0000000000..14bbe813d1 --- /dev/null +++ b/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "db", + "engine": "postgresql", + "sql_package": "pgx/v5", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} + diff --git a/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/stderr.txt b/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/stderr.txt new file mode 100644 index 0000000000..459c2d432f --- /dev/null +++ b/internal/endtoend/testdata/invalid_params_type_mismatch/postgresql/pgx/stderr.txt @@ -0,0 +1,2 @@ +# package db +query.sql:3:12: column "name" is of type boolean but expression is of type bigint diff --git a/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/query.sql b/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/query.sql index 49d9d60f1f..19aaf34061 100644 --- a/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/query.sql +++ b/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/query.sql @@ -1,3 +1,5 @@ -CREATE TABLE foo (bar text not null, baz text not null); +-- name: InsertBarBaz :exec INSERT INTO foo (bar, baz) VALUES ($1); + +-- name: InsertBar :exec INSERT INTO foo (bar) VALUES ($1, $2); diff --git a/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/schema.sql b/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/schema.sql new file mode 100644 index 0000000000..4904704639 --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (bar text not null, baz text not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/sqlc.json b/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/stderr.txt b/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/stderr.txt deleted file mode 100644 index a496038cd1..0000000000 --- a/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/stderr.txt +++ /dev/null @@ -1,3 +0,0 @@ -# package querytest -query.sql:2:1: INSERT has more target columns than expressions -query.sql:3:1: INSERT has more expressions than target columns diff --git a/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/stderr/base.txt b/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/stderr/base.txt new file mode 100644 index 0000000000..1e06800df3 --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/stderr/base.txt @@ -0,0 +1,3 @@ +# package querytest +query.sql:1:1: INSERT has more target columns than expressions +query.sql:5:1: INSERT has more expressions than target columns diff --git a/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/stderr/managed-db.txt b/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/stderr/managed-db.txt new file mode 100644 index 0000000000..143dcf6c0d --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_bar/pgx/v4/stderr/managed-db.txt @@ -0,0 +1,3 @@ +# package querytest +query.sql:2:23: INSERT has more target columns than expressions +query.sql:5:35: INSERT has more expressions than target columns diff --git a/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/query.sql b/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/query.sql index 49d9d60f1f..ef02b5e99c 100644 --- a/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/query.sql +++ b/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/query.sql @@ -1,3 +1,5 @@ -CREATE TABLE foo (bar text not null, baz text not null); +-- name: InsertBarBaz :exec INSERT INTO foo (bar, baz) VALUES ($1); -INSERT INTO foo (bar) VALUES ($1, $2); + +-- name: InsertBar :exec +INSERT INTO foo (bar) VALUES ($1, $2); \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/schema.sql b/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/schema.sql new file mode 100644 index 0000000000..4904704639 --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (bar text not null, baz text not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/sqlc.json b/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/stderr.txt b/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/stderr.txt deleted file mode 100644 index a496038cd1..0000000000 --- a/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/stderr.txt +++ /dev/null @@ -1,3 +0,0 @@ -# package querytest -query.sql:2:1: INSERT has more target columns than expressions -query.sql:3:1: INSERT has more expressions than target columns diff --git a/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/stderr/base.txt b/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/stderr/base.txt new file mode 100644 index 0000000000..1e06800df3 --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/stderr/base.txt @@ -0,0 +1,3 @@ +# package querytest +query.sql:1:1: INSERT has more target columns than expressions +query.sql:5:1: INSERT has more expressions than target columns diff --git a/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/stderr/managed-db.txt b/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/stderr/managed-db.txt new file mode 100644 index 0000000000..143dcf6c0d --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_bar/pgx/v5/stderr/managed-db.txt @@ -0,0 +1,3 @@ +# package querytest +query.sql:2:23: INSERT has more target columns than expressions +query.sql:5:35: INSERT has more expressions than target columns diff --git a/internal/endtoend/testdata/invalid_queries_bar/stdlib/query.sql b/internal/endtoend/testdata/invalid_queries_bar/stdlib/query.sql index 49d9d60f1f..ef02b5e99c 100644 --- a/internal/endtoend/testdata/invalid_queries_bar/stdlib/query.sql +++ b/internal/endtoend/testdata/invalid_queries_bar/stdlib/query.sql @@ -1,3 +1,5 @@ -CREATE TABLE foo (bar text not null, baz text not null); +-- name: InsertBarBaz :exec INSERT INTO foo (bar, baz) VALUES ($1); -INSERT INTO foo (bar) VALUES ($1, $2); + +-- name: InsertBar :exec +INSERT INTO foo (bar) VALUES ($1, $2); \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_queries_bar/stdlib/schema.sql b/internal/endtoend/testdata/invalid_queries_bar/stdlib/schema.sql new file mode 100644 index 0000000000..4904704639 --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_bar/stdlib/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (bar text not null, baz text not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_queries_bar/stdlib/sqlc.json b/internal/endtoend/testdata/invalid_queries_bar/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/invalid_queries_bar/stdlib/sqlc.json +++ b/internal/endtoend/testdata/invalid_queries_bar/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/invalid_queries_bar/stdlib/stderr.txt b/internal/endtoend/testdata/invalid_queries_bar/stdlib/stderr.txt deleted file mode 100644 index a496038cd1..0000000000 --- a/internal/endtoend/testdata/invalid_queries_bar/stdlib/stderr.txt +++ /dev/null @@ -1,3 +0,0 @@ -# package querytest -query.sql:2:1: INSERT has more target columns than expressions -query.sql:3:1: INSERT has more expressions than target columns diff --git a/internal/endtoend/testdata/invalid_queries_bar/stdlib/stderr/base.txt b/internal/endtoend/testdata/invalid_queries_bar/stdlib/stderr/base.txt new file mode 100644 index 0000000000..1e06800df3 --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_bar/stdlib/stderr/base.txt @@ -0,0 +1,3 @@ +# package querytest +query.sql:1:1: INSERT has more target columns than expressions +query.sql:5:1: INSERT has more expressions than target columns diff --git a/internal/endtoend/testdata/invalid_queries_bar/stdlib/stderr/managed-db.txt b/internal/endtoend/testdata/invalid_queries_bar/stdlib/stderr/managed-db.txt new file mode 100644 index 0000000000..143dcf6c0d --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_bar/stdlib/stderr/managed-db.txt @@ -0,0 +1,3 @@ +# package querytest +query.sql:2:23: INSERT has more target columns than expressions +query.sql:5:35: INSERT has more expressions than target columns diff --git a/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/query.sql b/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/query.sql index ef84ae740c..06644a2cd3 100644 --- a/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/query.sql +++ b/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (id text not null); - -- name: ListFoos SELECT id FROM foo; @@ -17,3 +15,6 @@ UPDATE foo SET id = $2 WHERE id = $1; -- name: InsertFoo :one INSERT INTO foo (id) VALUES ($1); + +-- name: InsertFoo :batchone +INSERT INTO foo (id) VALUES ($1); diff --git a/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/schema.sql b/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/schema.sql new file mode 100644 index 0000000000..de835103e1 --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (id text not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/sqlc.json b/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/stderr.txt b/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/stderr.txt index cbe1df4446..8c745b7e3b 100644 --- a/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/stderr.txt +++ b/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/stderr.txt @@ -1,7 +1,8 @@ # package querytest -query.sql:4:1: invalid query comment: -- name: ListFoos -query.sql:7:1: invalid query comment: -- name: ListFoos :one :many -query.sql:10:1: invalid query type: :two -query.sql:13:1: query "DeleteFoo" specifies parameter ":one" without containing a RETURNING clause -query.sql:16:1: query "UpdateFoo" specifies parameter ":one" without containing a RETURNING clause -query.sql:19:1: query "InsertFoo" specifies parameter ":one" without containing a RETURNING clause +query.sql:1:1: missing query type [':one', ':many', ':exec', ':execrows', ':execlastid', ':execresult', ':copyfrom', 'batchexec', 'batchmany', 'batchone']: -- name: ListFoos +query.sql:5:1: invalid query comment: -- name: ListFoos :one :many +query.sql:8:1: invalid query type: :two +query.sql:11:1: query "DeleteFoo" specifies parameter ":one" without containing a RETURNING clause +query.sql:14:1: query "UpdateFoo" specifies parameter ":one" without containing a RETURNING clause +query.sql:17:1: query "InsertFoo" specifies parameter ":one" without containing a RETURNING clause +query.sql:20:1: query "InsertFoo" specifies parameter ":batchone" without containing a RETURNING clause diff --git a/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/query.sql b/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/query.sql index ef84ae740c..06644a2cd3 100644 --- a/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/query.sql +++ b/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (id text not null); - -- name: ListFoos SELECT id FROM foo; @@ -17,3 +15,6 @@ UPDATE foo SET id = $2 WHERE id = $1; -- name: InsertFoo :one INSERT INTO foo (id) VALUES ($1); + +-- name: InsertFoo :batchone +INSERT INTO foo (id) VALUES ($1); diff --git a/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/schema.sql b/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/schema.sql new file mode 100644 index 0000000000..de835103e1 --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (id text not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/sqlc.json b/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/stderr.txt b/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/stderr.txt index cbe1df4446..8c745b7e3b 100644 --- a/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/stderr.txt +++ b/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/stderr.txt @@ -1,7 +1,8 @@ # package querytest -query.sql:4:1: invalid query comment: -- name: ListFoos -query.sql:7:1: invalid query comment: -- name: ListFoos :one :many -query.sql:10:1: invalid query type: :two -query.sql:13:1: query "DeleteFoo" specifies parameter ":one" without containing a RETURNING clause -query.sql:16:1: query "UpdateFoo" specifies parameter ":one" without containing a RETURNING clause -query.sql:19:1: query "InsertFoo" specifies parameter ":one" without containing a RETURNING clause +query.sql:1:1: missing query type [':one', ':many', ':exec', ':execrows', ':execlastid', ':execresult', ':copyfrom', 'batchexec', 'batchmany', 'batchone']: -- name: ListFoos +query.sql:5:1: invalid query comment: -- name: ListFoos :one :many +query.sql:8:1: invalid query type: :two +query.sql:11:1: query "DeleteFoo" specifies parameter ":one" without containing a RETURNING clause +query.sql:14:1: query "UpdateFoo" specifies parameter ":one" without containing a RETURNING clause +query.sql:17:1: query "InsertFoo" specifies parameter ":one" without containing a RETURNING clause +query.sql:20:1: query "InsertFoo" specifies parameter ":batchone" without containing a RETURNING clause diff --git a/internal/endtoend/testdata/invalid_queries_foo/stdlib/query.sql b/internal/endtoend/testdata/invalid_queries_foo/stdlib/query.sql index ef84ae740c..0e98fb622d 100644 --- a/internal/endtoend/testdata/invalid_queries_foo/stdlib/query.sql +++ b/internal/endtoend/testdata/invalid_queries_foo/stdlib/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (id text not null); - -- name: ListFoos SELECT id FROM foo; diff --git a/internal/endtoend/testdata/invalid_queries_foo/stdlib/schema.sql b/internal/endtoend/testdata/invalid_queries_foo/stdlib/schema.sql new file mode 100644 index 0000000000..de835103e1 --- /dev/null +++ b/internal/endtoend/testdata/invalid_queries_foo/stdlib/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (id text not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_queries_foo/stdlib/sqlc.json b/internal/endtoend/testdata/invalid_queries_foo/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/invalid_queries_foo/stdlib/sqlc.json +++ b/internal/endtoend/testdata/invalid_queries_foo/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/invalid_queries_foo/stdlib/stderr.txt b/internal/endtoend/testdata/invalid_queries_foo/stdlib/stderr.txt index cbe1df4446..06ec54327f 100644 --- a/internal/endtoend/testdata/invalid_queries_foo/stdlib/stderr.txt +++ b/internal/endtoend/testdata/invalid_queries_foo/stdlib/stderr.txt @@ -1,7 +1,7 @@ # package querytest -query.sql:4:1: invalid query comment: -- name: ListFoos -query.sql:7:1: invalid query comment: -- name: ListFoos :one :many -query.sql:10:1: invalid query type: :two -query.sql:13:1: query "DeleteFoo" specifies parameter ":one" without containing a RETURNING clause -query.sql:16:1: query "UpdateFoo" specifies parameter ":one" without containing a RETURNING clause -query.sql:19:1: query "InsertFoo" specifies parameter ":one" without containing a RETURNING clause +query.sql:1:1: missing query type [':one', ':many', ':exec', ':execrows', ':execlastid', ':execresult', ':copyfrom', 'batchexec', 'batchmany', 'batchone']: -- name: ListFoos +query.sql:5:1: invalid query comment: -- name: ListFoos :one :many +query.sql:8:1: invalid query type: :two +query.sql:11:1: query "DeleteFoo" specifies parameter ":one" without containing a RETURNING clause +query.sql:14:1: query "UpdateFoo" specifies parameter ":one" without containing a RETURNING clause +query.sql:17:1: query "InsertFoo" specifies parameter ":one" without containing a RETURNING clause \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_table_alias/mysql/query.sql b/internal/endtoend/testdata/invalid_table_alias/mysql/query.sql index 22482fb724..52f5aae051 100644 --- a/internal/endtoend/testdata/invalid_table_alias/mysql/query.sql +++ b/internal/endtoend/testdata/invalid_table_alias/mysql/query.sql @@ -1,10 +1,3 @@ --- https://github.com/sqlc-dev/sqlc/issues/437 -CREATE TABLE authors ( - id INT PRIMARY KEY, - name VARCHAR(255) NOT NULL, - bio text -); - -- name: GetAuthor :one SELECT * FROM authors a diff --git a/internal/endtoend/testdata/invalid_table_alias/mysql/schema.sql b/internal/endtoend/testdata/invalid_table_alias/mysql/schema.sql new file mode 100644 index 0000000000..ee27f30abe --- /dev/null +++ b/internal/endtoend/testdata/invalid_table_alias/mysql/schema.sql @@ -0,0 +1,7 @@ +-- https://github.com/sqlc-dev/sqlc/issues/437 +CREATE TABLE authors ( + id INT PRIMARY KEY, + name VARCHAR(255) NOT NULL, + bio text +); + diff --git a/internal/endtoend/testdata/invalid_table_alias/mysql/sqlc.json b/internal/endtoend/testdata/invalid_table_alias/mysql/sqlc.json index 534b7e24e9..0390f67889 100644 --- a/internal/endtoend/testdata/invalid_table_alias/mysql/sqlc.json +++ b/internal/endtoend/testdata/invalid_table_alias/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/invalid_table_alias/mysql/stderr.txt b/internal/endtoend/testdata/invalid_table_alias/mysql/stderr.txt index 810c893a70..1eddeaac99 100644 --- a/internal/endtoend/testdata/invalid_table_alias/mysql/stderr.txt +++ b/internal/endtoend/testdata/invalid_table_alias/mysql/stderr.txt @@ -1,2 +1,2 @@ # package querytest -query.sql:11:9: table alias "p" does not exist +query.sql:4:9: table alias "p" does not exist diff --git a/internal/endtoend/testdata/invalid_table_alias/postgresql/exec.json b/internal/endtoend/testdata/invalid_table_alias/postgresql/exec.json new file mode 100644 index 0000000000..9f208fb2df --- /dev/null +++ b/internal/endtoend/testdata/invalid_table_alias/postgresql/exec.json @@ -0,0 +1,3 @@ +{ + "os": ["darwin", "linux"] +} diff --git a/internal/endtoend/testdata/invalid_table_alias/postgresql/query.sql b/internal/endtoend/testdata/invalid_table_alias/postgresql/query.sql index 76e872ab65..f09a94b585 100644 --- a/internal/endtoend/testdata/invalid_table_alias/postgresql/query.sql +++ b/internal/endtoend/testdata/invalid_table_alias/postgresql/query.sql @@ -1,10 +1,3 @@ --- https://github.com/sqlc-dev/sqlc/issues/437 -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - name text NOT NULL, - bio text -); - -- name: GetAuthor :one SELECT * FROM authors a diff --git a/internal/endtoend/testdata/invalid_table_alias/postgresql/schema.sql b/internal/endtoend/testdata/invalid_table_alias/postgresql/schema.sql new file mode 100644 index 0000000000..9c4b796adb --- /dev/null +++ b/internal/endtoend/testdata/invalid_table_alias/postgresql/schema.sql @@ -0,0 +1,6 @@ +-- https://github.com/sqlc-dev/sqlc/issues/437 +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_table_alias/postgresql/sqlc.json b/internal/endtoend/testdata/invalid_table_alias/postgresql/sqlc.json index af57681f66..a590361309 100644 --- a/internal/endtoend/testdata/invalid_table_alias/postgresql/sqlc.json +++ b/internal/endtoend/testdata/invalid_table_alias/postgresql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/invalid_table_alias/postgresql/stderr.txt b/internal/endtoend/testdata/invalid_table_alias/postgresql/stderr.txt deleted file mode 100644 index 810c893a70..0000000000 --- a/internal/endtoend/testdata/invalid_table_alias/postgresql/stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -# package querytest -query.sql:11:9: table alias "p" does not exist diff --git a/internal/endtoend/testdata/invalid_table_alias/postgresql/stderr/base.txt b/internal/endtoend/testdata/invalid_table_alias/postgresql/stderr/base.txt new file mode 100644 index 0000000000..1eddeaac99 --- /dev/null +++ b/internal/endtoend/testdata/invalid_table_alias/postgresql/stderr/base.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:4:9: table alias "p" does not exist diff --git a/internal/endtoend/testdata/invalid_table_alias/postgresql/stderr/managed-db.txt b/internal/endtoend/testdata/invalid_table_alias/postgresql/stderr/managed-db.txt new file mode 100644 index 0000000000..2de34ae434 --- /dev/null +++ b/internal/endtoend/testdata/invalid_table_alias/postgresql/stderr/managed-db.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:5:3: missing FROM-clause entry for table "p" diff --git a/internal/endtoend/testdata/invalid_update_unknown_column/issue.md b/internal/endtoend/testdata/invalid_update_unknown_column/issue.md new file mode 100644 index 0000000000..822c605060 --- /dev/null +++ b/internal/endtoend/testdata/invalid_update_unknown_column/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/884 \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_update_unknown_column/postgresql/pgx/exec.json b/internal/endtoend/testdata/invalid_update_unknown_column/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/invalid_update_unknown_column/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/invalid_update_unknown_column/postgresql/pgx/query.sql b/internal/endtoend/testdata/invalid_update_unknown_column/postgresql/pgx/query.sql new file mode 100644 index 0000000000..59d42df34b --- /dev/null +++ b/internal/endtoend/testdata/invalid_update_unknown_column/postgresql/pgx/query.sql @@ -0,0 +1,7 @@ +-- name: UpdateArticles :exec +UPDATE + public.articles +SET + is_deleted = TRUE +WHERE + id = $1; \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_update_unknown_column/postgresql/pgx/schema.sql b/internal/endtoend/testdata/invalid_update_unknown_column/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..6f94b60c66 --- /dev/null +++ b/internal/endtoend/testdata/invalid_update_unknown_column/postgresql/pgx/schema.sql @@ -0,0 +1,10 @@ +CREATE TABLE public.articles ( + id integer NOT NULL, + company integer NOT NULL, + name text NOT NULL, + sort_order integer DEFAULT 0 NOT NULL, + object_type smallint NOT NULL, + image text, + "group" integer, + notes text DEFAULT ''::text NOT NULL +); \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_update_unknown_column/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/invalid_update_unknown_column/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..01489e0ffc --- /dev/null +++ b/internal/endtoend/testdata/invalid_update_unknown_column/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" \ No newline at end of file diff --git a/internal/endtoend/testdata/invalid_update_unknown_column/postgresql/pgx/stderr.txt b/internal/endtoend/testdata/invalid_update_unknown_column/postgresql/pgx/stderr.txt new file mode 100644 index 0000000000..8260c8f792 --- /dev/null +++ b/internal/endtoend/testdata/invalid_update_unknown_column/postgresql/pgx/stderr.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:5:2: column "is_deleted" of relation "articles" does not exist \ No newline at end of file diff --git a/internal/endtoend/testdata/join_alias/mysql/go/db.go b/internal/endtoend/testdata/join_alias/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/join_alias/mysql/go/db.go +++ b/internal/endtoend/testdata/join_alias/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_alias/mysql/go/models.go b/internal/endtoend/testdata/join_alias/mysql/go/models.go index 2ba276cd1f..4dae8de5db 100644 --- a/internal/endtoend/testdata/join_alias/mysql/go/models.go +++ b/internal/endtoend/testdata/join_alias/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_alias/mysql/go/query.sql.go b/internal/endtoend/testdata/join_alias/mysql/go/query.sql.go index 4d4884bcb9..932153ec78 100644 --- a/internal/endtoend/testdata/join_alias/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/join_alias/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_alias/mysql/query.sql b/internal/endtoend/testdata/join_alias/mysql/query.sql index 32aa93eb77..9b087bcae7 100644 --- a/internal/endtoend/testdata/join_alias/mysql/query.sql +++ b/internal/endtoend/testdata/join_alias/mysql/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE foo (id serial not null); -CREATE TABLE bar (id serial not null references foo(id), title text); - -- name: AliasJoin :many SELECT f.id, b.title FROM foo f diff --git a/internal/endtoend/testdata/join_alias/mysql/schema.sql b/internal/endtoend/testdata/join_alias/mysql/schema.sql new file mode 100644 index 0000000000..1eab1cf5f4 --- /dev/null +++ b/internal/endtoend/testdata/join_alias/mysql/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (id serial not null); +CREATE TABLE bar (id serial not null references foo(id), title text); + diff --git a/internal/endtoend/testdata/join_alias/mysql/sqlc.json b/internal/endtoend/testdata/join_alias/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/join_alias/mysql/sqlc.json +++ b/internal/endtoend/testdata/join_alias/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/models.go index ed24fefdd7..3ae25caf06 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/query.sql.go index 465f212dcc..13a5ad6ceb 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/query.sql index df3a0a5e55..23f38254b4 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE foo (id serial not null unique); -CREATE TABLE bar (id serial not null references foo(id), title text); - -- name: AliasJoin :many SELECT f.id, b.title FROM foo f diff --git a/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..d2fdc3090d --- /dev/null +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (id serial not null unique); +CREATE TABLE bar (id serial not null references foo(id), title text); + diff --git a/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/models.go index 05fdb91517..69068f3a7f 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/query.sql.go index 18b76d4d58..5761c7cd02 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/query.sql index df3a0a5e55..23f38254b4 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE foo (id serial not null unique); -CREATE TABLE bar (id serial not null references foo(id), title text); - -- name: AliasJoin :many SELECT f.id, b.title FROM foo f diff --git a/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..d2fdc3090d --- /dev/null +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (id serial not null unique); +CREATE TABLE bar (id serial not null references foo(id), title text); + diff --git a/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/models.go index ed24fefdd7..3ae25caf06 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/query.sql.go index 7c0ac02745..c304c38c04 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_alias/postgresql/stdlib/query.sql b/internal/endtoend/testdata/join_alias/postgresql/stdlib/query.sql index df3a0a5e55..23f38254b4 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/join_alias/postgresql/stdlib/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE foo (id serial not null unique); -CREATE TABLE bar (id serial not null references foo(id), title text); - -- name: AliasJoin :many SELECT f.id, b.title FROM foo f diff --git a/internal/endtoend/testdata/join_alias/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/join_alias/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..d2fdc3090d --- /dev/null +++ b/internal/endtoend/testdata/join_alias/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (id serial not null unique); +CREATE TABLE bar (id serial not null references foo(id), title text); + diff --git a/internal/endtoend/testdata/join_alias/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/join_alias/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/join_alias/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_alias/sqlite/go/db.go b/internal/endtoend/testdata/join_alias/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/join_alias/sqlite/go/db.go +++ b/internal/endtoend/testdata/join_alias/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_alias/sqlite/go/models.go b/internal/endtoend/testdata/join_alias/sqlite/go/models.go index 0a79e82d73..5a3a4a1b05 100644 --- a/internal/endtoend/testdata/join_alias/sqlite/go/models.go +++ b/internal/endtoend/testdata/join_alias/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_alias/sqlite/go/query.sql.go b/internal/endtoend/testdata/join_alias/sqlite/go/query.sql.go index d6b4f43d01..8ac1da98d8 100644 --- a/internal/endtoend/testdata/join_alias/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/join_alias/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_alias/sqlite/query.sql b/internal/endtoend/testdata/join_alias/sqlite/query.sql index c8d3044460..9b087bcae7 100644 --- a/internal/endtoend/testdata/join_alias/sqlite/query.sql +++ b/internal/endtoend/testdata/join_alias/sqlite/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE foo (id integer not null); -CREATE TABLE bar (id integer not null references foo(id), title text); - -- name: AliasJoin :many SELECT f.id, b.title FROM foo f diff --git a/internal/endtoend/testdata/join_alias/sqlite/schema.sql b/internal/endtoend/testdata/join_alias/sqlite/schema.sql new file mode 100644 index 0000000000..b622f98fcb --- /dev/null +++ b/internal/endtoend/testdata/join_alias/sqlite/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (id integer not null); +CREATE TABLE bar (id integer not null references foo(id), title text); + diff --git a/internal/endtoend/testdata/join_alias/sqlite/sqlc.json b/internal/endtoend/testdata/join_alias/sqlite/sqlc.json index fcb288cb35..d4963e751f 100644 --- a/internal/endtoend/testdata/join_alias/sqlite/sqlc.json +++ b/internal/endtoend/testdata/join_alias/sqlite/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "sqlite", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_clauses_order/postgresql/go/db.go b/internal/endtoend/testdata/join_clauses_order/postgresql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/join_clauses_order/postgresql/go/db.go +++ b/internal/endtoend/testdata/join_clauses_order/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_clauses_order/postgresql/go/models.go b/internal/endtoend/testdata/join_clauses_order/postgresql/go/models.go index 2446af1281..f069a6fbed 100644 --- a/internal/endtoend/testdata/join_clauses_order/postgresql/go/models.go +++ b/internal/endtoend/testdata/join_clauses_order/postgresql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type A struct { ID int64 A string diff --git a/internal/endtoend/testdata/join_clauses_order/postgresql/go/query.sql.go b/internal/endtoend/testdata/join_clauses_order/postgresql/go/query.sql.go index fc49e70005..ee33f2706a 100644 --- a/internal/endtoend/testdata/join_clauses_order/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/join_clauses_order/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_clauses_order/postgresql/query.sql b/internal/endtoend/testdata/join_clauses_order/postgresql/query.sql index c86a022018..3980181178 100644 --- a/internal/endtoend/testdata/join_clauses_order/postgresql/query.sql +++ b/internal/endtoend/testdata/join_clauses_order/postgresql/query.sql @@ -1,32 +1,3 @@ -CREATE TABLE a ( - id BIGSERIAL PRIMARY KEY, - a TEXT NOT NULL -); - -CREATE TABLE b ( - id BIGSERIAL PRIMARY KEY, - b TEXT NOT NULL, - a_id BIGINT NOT NULL REFERENCES a (id) -); - -CREATE TABLE c ( - id BIGSERIAL PRIMARY KEY, - c TEXT NOT NULL, - a_id BIGINT NOT NULL REFERENCES a (id) -); - -CREATE TABLE d ( - id BIGSERIAL PRIMARY KEY, - d TEXT NOT NULL, - a_id BIGINT NOT NULL REFERENCES a (id) -); - -CREATE TABLE e ( - id BIGSERIAL PRIMARY KEY, - e TEXT NOT NULL, - a_id BIGINT NOT NULL REFERENCES a (id) -); - -- name: TestLeftInner :many SELECT a.a, b.b, c.c FROM a diff --git a/internal/endtoend/testdata/join_clauses_order/postgresql/schema.sql b/internal/endtoend/testdata/join_clauses_order/postgresql/schema.sql new file mode 100644 index 0000000000..890f94fc6f --- /dev/null +++ b/internal/endtoend/testdata/join_clauses_order/postgresql/schema.sql @@ -0,0 +1,29 @@ +CREATE TABLE a ( + id BIGSERIAL PRIMARY KEY, + a TEXT NOT NULL +); + +CREATE TABLE b ( + id BIGSERIAL PRIMARY KEY, + b TEXT NOT NULL, + a_id BIGINT NOT NULL REFERENCES a (id) +); + +CREATE TABLE c ( + id BIGSERIAL PRIMARY KEY, + c TEXT NOT NULL, + a_id BIGINT NOT NULL REFERENCES a (id) +); + +CREATE TABLE d ( + id BIGSERIAL PRIMARY KEY, + d TEXT NOT NULL, + a_id BIGINT NOT NULL REFERENCES a (id) +); + +CREATE TABLE e ( + id BIGSERIAL PRIMARY KEY, + e TEXT NOT NULL, + a_id BIGINT NOT NULL REFERENCES a (id) +); + diff --git a/internal/endtoend/testdata/join_clauses_order/postgresql/sqlc.json b/internal/endtoend/testdata/join_clauses_order/postgresql/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/join_clauses_order/postgresql/sqlc.json +++ b/internal/endtoend/testdata/join_clauses_order/postgresql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_from/mysql/go/db.go b/internal/endtoend/testdata/join_from/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/join_from/mysql/go/db.go +++ b/internal/endtoend/testdata/join_from/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_from/mysql/go/models.go b/internal/endtoend/testdata/join_from/mysql/go/models.go index 44dcbcf383..024b8245df 100644 --- a/internal/endtoend/testdata/join_from/mysql/go/models.go +++ b/internal/endtoend/testdata/join_from/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { Login string } diff --git a/internal/endtoend/testdata/join_from/mysql/go/query.sql.go b/internal/endtoend/testdata/join_from/mysql/go/query.sql.go index 7cc63dc953..67c067f458 100644 --- a/internal/endtoend/testdata/join_from/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/join_from/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_from/mysql/query.sql b/internal/endtoend/testdata/join_from/mysql/query.sql index 588d859578..377aeaebab 100644 --- a/internal/endtoend/testdata/join_from/mysql/query.sql +++ b/internal/endtoend/testdata/join_from/mysql/query.sql @@ -1,5 +1,2 @@ -CREATE TABLE foo (email text not null); -CREATE TABLE bar (login text not null); - -- name: MultiFrom :many SELECT email FROM bar, foo WHERE login = ?; diff --git a/internal/endtoend/testdata/join_from/mysql/schema.sql b/internal/endtoend/testdata/join_from/mysql/schema.sql new file mode 100644 index 0000000000..c1c6f4888f --- /dev/null +++ b/internal/endtoend/testdata/join_from/mysql/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (email text not null); +CREATE TABLE bar (login text not null); + diff --git a/internal/endtoend/testdata/join_from/mysql/sqlc.json b/internal/endtoend/testdata/join_from/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/join_from/mysql/sqlc.json +++ b/internal/endtoend/testdata/join_from/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/models.go index 44dcbcf383..024b8245df 100644 --- a/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { Login string } diff --git a/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/query.sql.go index f726c3cd9b..c30f5d428d 100644 --- a/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_from/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/query.sql index a8cefc9245..c4eec21958 100644 --- a/internal/endtoend/testdata/join_from/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/query.sql @@ -1,5 +1,2 @@ -CREATE TABLE foo (email text not null); -CREATE TABLE bar (login text not null); - -- name: MultiFrom :many SELECT email FROM bar, foo WHERE login = $1; diff --git a/internal/endtoend/testdata/join_from/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..c1c6f4888f --- /dev/null +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (email text not null); +CREATE TABLE bar (login text not null); + diff --git a/internal/endtoend/testdata/join_from/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/join_from/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/models.go index 44dcbcf383..024b8245df 100644 --- a/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { Login string } diff --git a/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/query.sql.go index f726c3cd9b..c30f5d428d 100644 --- a/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_from/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/join_from/postgresql/pgx/v5/query.sql index a8cefc9245..c4eec21958 100644 --- a/internal/endtoend/testdata/join_from/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v5/query.sql @@ -1,5 +1,2 @@ -CREATE TABLE foo (email text not null); -CREATE TABLE bar (login text not null); - -- name: MultiFrom :many SELECT email FROM bar, foo WHERE login = $1; diff --git a/internal/endtoend/testdata/join_from/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/join_from/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..c1c6f4888f --- /dev/null +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (email text not null); +CREATE TABLE bar (login text not null); + diff --git a/internal/endtoend/testdata/join_from/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/join_from/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/join_from/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_from/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/join_from/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/join_from/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/join_from/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_from/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/join_from/postgresql/stdlib/go/models.go index 44dcbcf383..024b8245df 100644 --- a/internal/endtoend/testdata/join_from/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/join_from/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { Login string } diff --git a/internal/endtoend/testdata/join_from/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/join_from/postgresql/stdlib/go/query.sql.go index 61d5dc964e..ff1c5fd82d 100644 --- a/internal/endtoend/testdata/join_from/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/join_from/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_from/postgresql/stdlib/query.sql b/internal/endtoend/testdata/join_from/postgresql/stdlib/query.sql index a8cefc9245..c4eec21958 100644 --- a/internal/endtoend/testdata/join_from/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/join_from/postgresql/stdlib/query.sql @@ -1,5 +1,2 @@ -CREATE TABLE foo (email text not null); -CREATE TABLE bar (login text not null); - -- name: MultiFrom :many SELECT email FROM bar, foo WHERE login = $1; diff --git a/internal/endtoend/testdata/join_from/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/join_from/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..c1c6f4888f --- /dev/null +++ b/internal/endtoend/testdata/join_from/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (email text not null); +CREATE TABLE bar (login text not null); + diff --git a/internal/endtoend/testdata/join_from/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/join_from/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/join_from/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/join_from/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_from/sqlite/go/db.go b/internal/endtoend/testdata/join_from/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/join_from/sqlite/go/db.go +++ b/internal/endtoend/testdata/join_from/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_from/sqlite/go/models.go b/internal/endtoend/testdata/join_from/sqlite/go/models.go index 44dcbcf383..024b8245df 100644 --- a/internal/endtoend/testdata/join_from/sqlite/go/models.go +++ b/internal/endtoend/testdata/join_from/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { Login string } diff --git a/internal/endtoend/testdata/join_from/sqlite/go/query.sql.go b/internal/endtoend/testdata/join_from/sqlite/go/query.sql.go index 7cc63dc953..67c067f458 100644 --- a/internal/endtoend/testdata/join_from/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/join_from/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_from/sqlite/query.sql b/internal/endtoend/testdata/join_from/sqlite/query.sql index 588d859578..377aeaebab 100644 --- a/internal/endtoend/testdata/join_from/sqlite/query.sql +++ b/internal/endtoend/testdata/join_from/sqlite/query.sql @@ -1,5 +1,2 @@ -CREATE TABLE foo (email text not null); -CREATE TABLE bar (login text not null); - -- name: MultiFrom :many SELECT email FROM bar, foo WHERE login = ?; diff --git a/internal/endtoend/testdata/join_from/sqlite/schema.sql b/internal/endtoend/testdata/join_from/sqlite/schema.sql new file mode 100644 index 0000000000..c1c6f4888f --- /dev/null +++ b/internal/endtoend/testdata/join_from/sqlite/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (email text not null); +CREATE TABLE bar (login text not null); + diff --git a/internal/endtoend/testdata/join_from/sqlite/sqlc.json b/internal/endtoend/testdata/join_from/sqlite/sqlc.json index fcb288cb35..d4963e751f 100644 --- a/internal/endtoend/testdata/join_from/sqlite/sqlc.json +++ b/internal/endtoend/testdata/join_from/sqlite/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "sqlite", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_full/postgresql/go/db.go b/internal/endtoend/testdata/join_full/postgresql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/join_full/postgresql/go/db.go +++ b/internal/endtoend/testdata/join_full/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_full/postgresql/go/models.go b/internal/endtoend/testdata/join_full/postgresql/go/models.go index f09478c274..7453c9d172 100644 --- a/internal/endtoend/testdata/join_full/postgresql/go/models.go +++ b/internal/endtoend/testdata/join_full/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_full/postgresql/go/query.sql.go b/internal/endtoend/testdata/join_full/postgresql/go/query.sql.go index 728987c725..3e92e19ac6 100644 --- a/internal/endtoend/testdata/join_full/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/join_full/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_full/postgresql/query.sql b/internal/endtoend/testdata/join_full/postgresql/query.sql index 320cf9c25a..d5ddf2b01d 100644 --- a/internal/endtoend/testdata/join_full/postgresql/query.sql +++ b/internal/endtoend/testdata/join_full/postgresql/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE bar (id serial not null unique); -CREATE TABLE foo (id serial not null, bar_id int references bar(id)); - -- name: FullJoin :many SELECT f.id, f.bar_id, b.id FROM foo f diff --git a/internal/endtoend/testdata/join_full/postgresql/schema.sql b/internal/endtoend/testdata/join_full/postgresql/schema.sql new file mode 100644 index 0000000000..c7d2a76585 --- /dev/null +++ b/internal/endtoend/testdata/join_full/postgresql/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE bar (id serial not null unique); +CREATE TABLE foo (id serial not null, bar_id int references bar(id)); + diff --git a/internal/endtoend/testdata/join_full/postgresql/sqlc.json b/internal/endtoend/testdata/join_full/postgresql/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/join_full/postgresql/sqlc.json +++ b/internal/endtoend/testdata/join_full/postgresql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/models.go index 7b21a566df..ae9173ef9e 100644 --- a/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Email string } diff --git a/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/query.sql.go index eb2ff54882..aceacc4058 100644 --- a/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/query.sql b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/query.sql index c0f410b505..3d04553e16 100644 --- a/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (email text not null); - -- name: ColumnAsGroupBy :many SELECT a.email AS id FROM foo a JOIN foo b ON a.email = b.email diff --git a/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..da8ec19c5d --- /dev/null +++ b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (email text not null); + diff --git a/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/sqlc.json index de427d069f..cd518671ac 100644 --- a/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "engine": "postgresql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_inner/postgresql/go/db.go b/internal/endtoend/testdata/join_inner/postgresql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/join_inner/postgresql/go/db.go +++ b/internal/endtoend/testdata/join_inner/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_inner/postgresql/go/models.go b/internal/endtoend/testdata/join_inner/postgresql/go/models.go index b67846fcaf..2d9d727572 100644 --- a/internal/endtoend/testdata/join_inner/postgresql/go/models.go +++ b/internal/endtoend/testdata/join_inner/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_inner/postgresql/go/query.sql.go b/internal/endtoend/testdata/join_inner/postgresql/go/query.sql.go index 19584f71f6..6f5396e796 100644 --- a/internal/endtoend/testdata/join_inner/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/join_inner/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_inner/postgresql/query.sql b/internal/endtoend/testdata/join_inner/postgresql/query.sql index 2d975cf8d6..dbea737cb8 100644 --- a/internal/endtoend/testdata/join_inner/postgresql/query.sql +++ b/internal/endtoend/testdata/join_inner/postgresql/query.sql @@ -1,15 +1,3 @@ -create table events -( - ID int -); - -create table handled_events -( - last_handled_id int, - handler text -); - - -- name: SelectAllJoinedAlias :many select e.* from events e inner join handled_events he diff --git a/internal/endtoend/testdata/join_inner/postgresql/schema.sql b/internal/endtoend/testdata/join_inner/postgresql/schema.sql new file mode 100644 index 0000000000..5283e3a992 --- /dev/null +++ b/internal/endtoend/testdata/join_inner/postgresql/schema.sql @@ -0,0 +1,12 @@ +create table events +( + ID int +); + +create table handled_events +( + last_handled_id int, + handler text +); + + diff --git a/internal/endtoend/testdata/join_inner/postgresql/sqlc.json b/internal/endtoend/testdata/join_inner/postgresql/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/join_inner/postgresql/sqlc.json +++ b/internal/endtoend/testdata/join_inner/postgresql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_left/mysql/go/db.go b/internal/endtoend/testdata/join_left/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/join_left/mysql/go/db.go +++ b/internal/endtoend/testdata/join_left/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_left/mysql/go/models.go b/internal/endtoend/testdata/join_left/mysql/go/models.go index de2c774a86..3b3296b874 100644 --- a/internal/endtoend/testdata/join_left/mysql/go/models.go +++ b/internal/endtoend/testdata/join_left/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_left/mysql/go/query.sql.go b/internal/endtoend/testdata/join_left/mysql/go/query.sql.go index e503037773..1fdd44a0bd 100644 --- a/internal/endtoend/testdata/join_left/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/join_left/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_left/mysql/query.sql b/internal/endtoend/testdata/join_left/mysql/query.sql index d6dd5edfca..ff96bb9cc9 100644 --- a/internal/endtoend/testdata/join_left/mysql/query.sql +++ b/internal/endtoend/testdata/join_left/mysql/query.sql @@ -1,17 +1,3 @@ --- https://github.com/sqlc-dev/sqlc/issues/604 -CREATE TABLE users ( - user_id INT PRIMARY KEY, - city_id INT -- nullable -); -CREATE TABLE cities ( - city_id INT PRIMARY KEY, - mayor_id INT NOT NULL -); -CREATE TABLE mayors ( - mayor_id INT PRIMARY KEY, - full_name TEXT NOT NULL -); - -- name: GetMayors :many SELECT user_id, @@ -29,19 +15,6 @@ FROM users LEFT JOIN cities USING (city_id) LEFT JOIN mayors USING (mayor_id); --- https://github.com/sqlc-dev/sqlc/issues/1334 -CREATE TABLE authors ( - id INT PRIMARY KEY, - name TEXT NOT NULL, - parent_id INT -- nullable -); - -CREATE TABLE super_authors ( - super_id INT PRIMARY KEY, - super_name TEXT NOT NULL, - super_parent_id INT -- nullable -); - -- name: AllAuthors :many SELECT * FROM authors a @@ -78,36 +51,6 @@ FROM authors a LEFT JOIN super_authors sa ON a.parent_id = sa.super_id; --- https://github.com/sqlc-dev/sqlc/issues/1334 -CREATE TABLE users_2 ( - user_id INT PRIMARY KEY, - user_nickname VARCHAR(30) UNIQUE NOT NULL, - user_email TEXT UNIQUE NOT NULL, - user_display_name TEXT NOT NULL, - user_password TEXT NULL, - user_google_id TEXT UNIQUE NULL, - user_apple_id TEXT UNIQUE NULL, - user_bio VARCHAR(160) NOT NULL DEFAULT '', - user_created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - user_avatar_id INT UNIQUE NULL -); - -CREATE TABLE media ( - media_id INT PRIMARY KEY, - media_created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - media_hash TEXT NOT NULL, - media_directory TEXT NOT NULL, - media_author_id INT NOT NULL, - media_width INT NOT NULL, - media_height INT NOT NULL -); - -ALTER TABLE users_2 -ADD FOREIGN KEY (user_avatar_id) -REFERENCES media(media_id) -ON DELETE SET DEFAULT -ON UPDATE CASCADE; - -- name: GetSuggestedUsersByID :many SELECT DISTINCT u.*, m.* FROM users_2 u diff --git a/internal/endtoend/testdata/join_left/mysql/schema.sql b/internal/endtoend/testdata/join_left/mysql/schema.sql new file mode 100644 index 0000000000..9b15eaea36 --- /dev/null +++ b/internal/endtoend/testdata/join_left/mysql/schema.sql @@ -0,0 +1,55 @@ +-- https://github.com/sqlc-dev/sqlc/issues/604 +CREATE TABLE users ( + user_id INT PRIMARY KEY, + city_id INT -- nullable +); +CREATE TABLE cities ( + city_id INT PRIMARY KEY, + mayor_id INT NOT NULL +); +CREATE TABLE mayors ( + mayor_id INT PRIMARY KEY, + full_name TEXT NOT NULL +); +-- https://github.com/sqlc-dev/sqlc/issues/1334 +CREATE TABLE authors ( + id INT PRIMARY KEY, + name TEXT NOT NULL, + parent_id INT -- nullable +); + +CREATE TABLE super_authors ( + super_id INT PRIMARY KEY, + super_name TEXT NOT NULL, + super_parent_id INT -- nullable +); + +-- https://github.com/sqlc-dev/sqlc/issues/1334 +CREATE TABLE users_2 ( + user_id INT PRIMARY KEY, + user_nickname VARCHAR(30) UNIQUE NOT NULL, + user_email VARCHAR(20) UNIQUE NOT NULL, + user_display_name TEXT NOT NULL, + user_password TEXT NULL, + user_google_id VARCHAR(20) UNIQUE NULL, + user_apple_id VARCHAR(20) UNIQUE NULL, + user_bio VARCHAR(160) NOT NULL DEFAULT '', + user_created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + user_avatar_id INT UNIQUE NULL +); + +CREATE TABLE media ( + media_id INT PRIMARY KEY, + media_created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + media_hash TEXT NOT NULL, + media_directory TEXT NOT NULL, + media_author_id INT NOT NULL, + media_width INT NOT NULL, + media_height INT NOT NULL +); + +ALTER TABLE users_2 +ADD FOREIGN KEY (user_avatar_id) +REFERENCES media(media_id) +ON DELETE SET DEFAULT +ON UPDATE CASCADE; diff --git a/internal/endtoend/testdata/join_left/mysql/sqlc.json b/internal/endtoend/testdata/join_left/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/join_left/mysql/sqlc.json +++ b/internal/endtoend/testdata/join_left/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_left/postgresql/exec.json b/internal/endtoend/testdata/join_left/postgresql/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/join_left/postgresql/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/join_left/postgresql/go/db.go b/internal/endtoend/testdata/join_left/postgresql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/join_left/postgresql/go/db.go +++ b/internal/endtoend/testdata/join_left/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_left/postgresql/go/models.go b/internal/endtoend/testdata/join_left/postgresql/go/models.go index 3f3538a33d..37edc6151f 100644 --- a/internal/endtoend/testdata/join_left/postgresql/go/models.go +++ b/internal/endtoend/testdata/join_left/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_left/postgresql/go/query.sql.go b/internal/endtoend/testdata/join_left/postgresql/go/query.sql.go index 95ca61b115..5be30a8b98 100644 --- a/internal/endtoend/testdata/join_left/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/join_left/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_left/postgresql/query.sql b/internal/endtoend/testdata/join_left/postgresql/query.sql index 861bd34f0a..15e3d6e580 100644 --- a/internal/endtoend/testdata/join_left/postgresql/query.sql +++ b/internal/endtoend/testdata/join_left/postgresql/query.sql @@ -1,17 +1,3 @@ ---- https://github.com/sqlc-dev/sqlc/issues/604 -CREATE TABLE users ( - user_id INT PRIMARY KEY, - city_id INT -- nullable -); -CREATE TABLE cities ( - city_id INT PRIMARY KEY, - mayor_id INT NOT NULL -); -CREATE TABLE mayors ( - mayor_id INT PRIMARY KEY, - full_name TEXT NOT NULL -); - -- name: GetMayors :many SELECT user_id, @@ -28,19 +14,6 @@ FROM users LEFT JOIN cities USING (city_id) LEFT JOIN mayors USING (mayor_id); --- https://github.com/sqlc-dev/sqlc/issues/1334 -CREATE TABLE authors ( - id INT PRIMARY KEY, - name TEXT NOT NULL, - parent_id INT -- nullable -); - -CREATE TABLE super_authors ( - super_id INT PRIMARY KEY, - super_name TEXT NOT NULL, - super_parent_id INT -- nullable -); - -- name: AllAuthors :many SELECT * FROM authors a @@ -77,33 +50,6 @@ FROM authors a LEFT JOIN super_authors sa ON a.parent_id = sa.super_id; --- https://github.com/sqlc-dev/sqlc/issues/1334 -CREATE TABLE "users_2" ( - "user_id" uuid PRIMARY KEY, - "user_nickname" VARCHAR(30) UNIQUE NOT NULL, - "user_email" TEXT UNIQUE NOT NULL, - "user_display_name" TEXT NOT NULL, - "user_password" TEXT NULL, - "user_google_id" TEXT UNIQUE NULL, - "user_apple_id" TEXT UNIQUE NULL, - "user_bio" VARCHAR(160) NOT NULL DEFAULT '', - "user_created_at" TIMESTAMP NOT NULL DEFAULT (NOW()), - "user_avatar_id" uuid UNIQUE NULL -); - -CREATE TABLE "media" ( - "media_id" uuid PRIMARY KEY, - "media_created_at" TIMESTAMP NOT NULL DEFAULT (NOW()), - "media_hash" TEXT NOT NULL, - "media_directory" TEXT NOT NULL, - "media_author_id" uuid NOT NULL, - "media_width" INT NOT NULL, - "media_height" INT NOT NULL -); - -ALTER TABLE "users_2" - ADD FOREIGN KEY ("user_avatar_id") REFERENCES "media" ("media_id") ON DELETE SET DEFAULT ON UPDATE CASCADE; - -- name: GetSuggestedUsersByID :many SELECT DISTINCT u.*, m.* FROM users_2 u diff --git a/internal/endtoend/testdata/join_left/postgresql/schema.sql b/internal/endtoend/testdata/join_left/postgresql/schema.sql new file mode 100644 index 0000000000..3cb9197a9c --- /dev/null +++ b/internal/endtoend/testdata/join_left/postgresql/schema.sql @@ -0,0 +1,53 @@ +--- https://github.com/sqlc-dev/sqlc/issues/604 +CREATE TABLE users ( + user_id INT PRIMARY KEY, + city_id INT -- nullable +); +CREATE TABLE cities ( + city_id INT PRIMARY KEY, + mayor_id INT NOT NULL +); +CREATE TABLE mayors ( + mayor_id INT PRIMARY KEY, + full_name TEXT NOT NULL +); + +-- https://github.com/sqlc-dev/sqlc/issues/1334 +CREATE TABLE authors ( + id INT PRIMARY KEY, + name TEXT NOT NULL, + parent_id INT -- nullable +); + +CREATE TABLE super_authors ( + super_id INT PRIMARY KEY, + super_name TEXT NOT NULL, + super_parent_id INT -- nullable +); + +-- https://github.com/sqlc-dev/sqlc/issues/1334 +CREATE TABLE "users_2" ( + "user_id" uuid PRIMARY KEY, + "user_nickname" VARCHAR(30) UNIQUE NOT NULL, + "user_email" TEXT UNIQUE NOT NULL, + "user_display_name" TEXT NOT NULL, + "user_password" TEXT NULL, + "user_google_id" TEXT UNIQUE NULL, + "user_apple_id" TEXT UNIQUE NULL, + "user_bio" VARCHAR(160) NOT NULL DEFAULT '', + "user_created_at" TIMESTAMP NOT NULL DEFAULT (NOW()), + "user_avatar_id" uuid UNIQUE NULL +); + +CREATE TABLE "media" ( + "media_id" uuid PRIMARY KEY, + "media_created_at" TIMESTAMP NOT NULL DEFAULT (NOW()), + "media_hash" TEXT NOT NULL, + "media_directory" TEXT NOT NULL, + "media_author_id" uuid NOT NULL, + "media_width" INT NOT NULL, + "media_height" INT NOT NULL +); + +ALTER TABLE "users_2" + ADD FOREIGN KEY ("user_avatar_id") REFERENCES "media" ("media_id") ON DELETE SET DEFAULT ON UPDATE CASCADE; diff --git a/internal/endtoend/testdata/join_left/postgresql/sqlc.json b/internal/endtoend/testdata/join_left/postgresql/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/join_left/postgresql/sqlc.json +++ b/internal/endtoend/testdata/join_left/postgresql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_left/sqlite/go/db.go b/internal/endtoend/testdata/join_left/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/join_left/sqlite/go/db.go +++ b/internal/endtoend/testdata/join_left/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_left/sqlite/go/models.go b/internal/endtoend/testdata/join_left/sqlite/go/models.go index e73456b4d4..92f5ad97a9 100644 --- a/internal/endtoend/testdata/join_left/sqlite/go/models.go +++ b/internal/endtoend/testdata/join_left/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_left/sqlite/go/query.sql.go b/internal/endtoend/testdata/join_left/sqlite/go/query.sql.go index 61b1479104..6bdea7c263 100644 --- a/internal/endtoend/testdata/join_left/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/join_left/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_left/sqlite/query.sql b/internal/endtoend/testdata/join_left/sqlite/query.sql index 639e2d8bd2..d9ccaede83 100644 --- a/internal/endtoend/testdata/join_left/sqlite/query.sql +++ b/internal/endtoend/testdata/join_left/sqlite/query.sql @@ -1,17 +1,3 @@ --- https://github.com/sqlc-dev/sqlc/issues/604 -CREATE TABLE users ( - user_id INT PRIMARY KEY, - city_id INT -- nullable -); -CREATE TABLE cities ( - city_id INT PRIMARY KEY, - mayor_id INT NOT NULL -); -CREATE TABLE mayors ( - mayor_id INT PRIMARY KEY, - full_name TEXT NOT NULL -); - -- name: GetMayors :many SELECT user_id, @@ -29,19 +15,6 @@ FROM users LEFT JOIN cities USING (city_id) LEFT JOIN mayors USING (mayor_id); --- https://github.com/sqlc-dev/sqlc/issues/1334 -CREATE TABLE authors ( - id INT PRIMARY KEY, - name TEXT NOT NULL, - parent_id INT -- nullable -); - -CREATE TABLE super_authors ( - super_id INT PRIMARY KEY, - super_name TEXT NOT NULL, - super_parent_id INT -- nullable -); - -- name: AllAuthors :many SELECT * FROM authors AS a @@ -78,30 +51,6 @@ FROM authors AS a LEFT JOIN super_authors AS sa ON a.parent_id = sa.super_id; --- https://github.com/sqlc-dev/sqlc/issues/1334 -CREATE TABLE users_2 ( - user_id INT PRIMARY KEY, - user_nickname VARCHAR(30) UNIQUE NOT NULL, - user_email TEXT UNIQUE NOT NULL, - user_display_name TEXT NOT NULL, - user_password TEXT , - user_google_id TEXT UNIQUE , - user_apple_id TEXT UNIQUE , - user_bio VARCHAR(160) NOT NULL DEFAULT '', - user_created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - user_avatar_id INT UNIQUE -); - -CREATE TABLE media ( - media_id INT PRIMARY KEY, - media_created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - media_hash TEXT NOT NULL, - media_directory TEXT NOT NULL, - media_author_id INT NOT NULL, - media_width INT NOT NULL, - media_height INT NOT NULL -); - -- name: GetSuggestedUsersByID :many SELECT DISTINCT u.*, m.* FROM users_2 AS u @@ -114,4 +63,4 @@ SELECT users_2.user_id FROM users_2 LEFT JOIN media AS m ON user_avatar_id = m.media_id -WHERE user_id != @user_id; \ No newline at end of file +WHERE user_id != @user_id; diff --git a/internal/endtoend/testdata/join_left/sqlite/schema.sql b/internal/endtoend/testdata/join_left/sqlite/schema.sql new file mode 100644 index 0000000000..e5b2db5a1b --- /dev/null +++ b/internal/endtoend/testdata/join_left/sqlite/schema.sql @@ -0,0 +1,50 @@ +-- https://github.com/sqlc-dev/sqlc/issues/604 +CREATE TABLE users ( + user_id INT PRIMARY KEY, + city_id INT -- nullable +); +CREATE TABLE cities ( + city_id INT PRIMARY KEY, + mayor_id INT NOT NULL +); +CREATE TABLE mayors ( + mayor_id INT PRIMARY KEY, + full_name TEXT NOT NULL +); + +-- https://github.com/sqlc-dev/sqlc/issues/1334 +CREATE TABLE authors ( + id INT PRIMARY KEY, + name TEXT NOT NULL, + parent_id INT -- nullable +); + +CREATE TABLE super_authors ( + super_id INT PRIMARY KEY, + super_name TEXT NOT NULL, + super_parent_id INT -- nullable +); + +-- https://github.com/sqlc-dev/sqlc/issues/1334 +CREATE TABLE users_2 ( + user_id INT PRIMARY KEY, + user_nickname VARCHAR(30) UNIQUE NOT NULL, + user_email TEXT UNIQUE NOT NULL, + user_display_name TEXT NOT NULL, + user_password TEXT , + user_google_id TEXT UNIQUE , + user_apple_id TEXT UNIQUE , + user_bio VARCHAR(160) NOT NULL DEFAULT '', + user_created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + user_avatar_id INT UNIQUE +); + +CREATE TABLE media ( + media_id INT PRIMARY KEY, + media_created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + media_hash TEXT NOT NULL, + media_directory TEXT NOT NULL, + media_author_id INT NOT NULL, + media_width INT NOT NULL, + media_height INT NOT NULL +); diff --git a/internal/endtoend/testdata/join_left/sqlite/sqlc.json b/internal/endtoend/testdata/join_left/sqlite/sqlc.json index fcb288cb35..d4963e751f 100644 --- a/internal/endtoend/testdata/join_left/sqlite/sqlc.json +++ b/internal/endtoend/testdata/join_left/sqlite/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "sqlite", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_left_same_table/mysql/go/db.go b/internal/endtoend/testdata/join_left_same_table/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/join_left_same_table/mysql/go/db.go +++ b/internal/endtoend/testdata/join_left_same_table/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_left_same_table/mysql/go/models.go b/internal/endtoend/testdata/join_left_same_table/mysql/go/models.go index 5cd950f4e3..fc10ae1ebe 100644 --- a/internal/endtoend/testdata/join_left_same_table/mysql/go/models.go +++ b/internal/endtoend/testdata/join_left_same_table/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_left_same_table/mysql/go/query.sql.go b/internal/endtoend/testdata/join_left_same_table/mysql/go/query.sql.go index a5b53b7f27..50025f9f94 100644 --- a/internal/endtoend/testdata/join_left_same_table/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/join_left_same_table/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_left_same_table/mysql/query.sql b/internal/endtoend/testdata/join_left_same_table/mysql/query.sql index f62b234fac..26bd026ee5 100644 --- a/internal/endtoend/testdata/join_left_same_table/mysql/query.sql +++ b/internal/endtoend/testdata/join_left_same_table/mysql/query.sql @@ -1,10 +1,3 @@ -CREATE TABLE authors ( - id INT(10) NOT NULL, - name VARCHAR(255) NOT NULL, - parent_id INT(10), - PRIMARY KEY (id) -); - -- name: AllAuthors :many SELECT a.id, a.name, diff --git a/internal/endtoend/testdata/join_left_same_table/mysql/schema.sql b/internal/endtoend/testdata/join_left_same_table/mysql/schema.sql new file mode 100644 index 0000000000..e5431317d9 --- /dev/null +++ b/internal/endtoend/testdata/join_left_same_table/mysql/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE authors ( + id INT(10) NOT NULL, + name VARCHAR(255) NOT NULL, + parent_id INT(10), + PRIMARY KEY (id) +); + diff --git a/internal/endtoend/testdata/join_left_same_table/mysql/sqlc.json b/internal/endtoend/testdata/join_left_same_table/mysql/sqlc.json index 534b7e24e9..0390f67889 100644 --- a/internal/endtoend/testdata/join_left_same_table/mysql/sqlc.json +++ b/internal/endtoend/testdata/join_left_same_table/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_left_same_table/postgres/go/db.go b/internal/endtoend/testdata/join_left_same_table/postgres/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/join_left_same_table/postgres/go/db.go +++ b/internal/endtoend/testdata/join_left_same_table/postgres/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_left_same_table/postgres/go/models.go b/internal/endtoend/testdata/join_left_same_table/postgres/go/models.go index 5cd950f4e3..fc10ae1ebe 100644 --- a/internal/endtoend/testdata/join_left_same_table/postgres/go/models.go +++ b/internal/endtoend/testdata/join_left_same_table/postgres/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_left_same_table/postgres/go/query.sql.go b/internal/endtoend/testdata/join_left_same_table/postgres/go/query.sql.go index db78621bb9..f72cc64440 100644 --- a/internal/endtoend/testdata/join_left_same_table/postgres/go/query.sql.go +++ b/internal/endtoend/testdata/join_left_same_table/postgres/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_left_same_table/postgres/query.sql b/internal/endtoend/testdata/join_left_same_table/postgres/query.sql index 661b3edfec..6fb2fced54 100644 --- a/internal/endtoend/testdata/join_left_same_table/postgres/query.sql +++ b/internal/endtoend/testdata/join_left_same_table/postgres/query.sql @@ -1,9 +1,3 @@ -CREATE TABLE authors ( - id INT PRIMARY KEY, - name TEXT NOT NULL, - parent_id INT -- nullable -); - -- name: AllAuthors :many SELECT a.id, a.name, diff --git a/internal/endtoend/testdata/join_left_same_table/postgres/schema.sql b/internal/endtoend/testdata/join_left_same_table/postgres/schema.sql new file mode 100644 index 0000000000..b15882baf3 --- /dev/null +++ b/internal/endtoend/testdata/join_left_same_table/postgres/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE authors ( + id INT PRIMARY KEY, + name TEXT NOT NULL, + parent_id INT -- nullable +); + diff --git a/internal/endtoend/testdata/join_left_same_table/postgres/sqlc.json b/internal/endtoend/testdata/join_left_same_table/postgres/sqlc.json index af57681f66..a590361309 100644 --- a/internal/endtoend/testdata/join_left_same_table/postgres/sqlc.json +++ b/internal/endtoend/testdata/join_left_same_table/postgres/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_left_same_table/sqlite/go/db.go b/internal/endtoend/testdata/join_left_same_table/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/join_left_same_table/sqlite/go/db.go +++ b/internal/endtoend/testdata/join_left_same_table/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_left_same_table/sqlite/go/models.go b/internal/endtoend/testdata/join_left_same_table/sqlite/go/models.go index 43b7d88ce8..7d416b37c4 100644 --- a/internal/endtoend/testdata/join_left_same_table/sqlite/go/models.go +++ b/internal/endtoend/testdata/join_left_same_table/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_left_same_table/sqlite/go/query.sql.go b/internal/endtoend/testdata/join_left_same_table/sqlite/go/query.sql.go index d4c9ad53b4..82a6d25562 100644 --- a/internal/endtoend/testdata/join_left_same_table/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/join_left_same_table/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_left_same_table/sqlite/query.sql b/internal/endtoend/testdata/join_left_same_table/sqlite/query.sql index 56d3757635..11f6c6903b 100644 --- a/internal/endtoend/testdata/join_left_same_table/sqlite/query.sql +++ b/internal/endtoend/testdata/join_left_same_table/sqlite/query.sql @@ -1,9 +1,3 @@ -CREATE TABLE authors ( - id INT NOT NULL PRIMARY KEY, - name TEXT NOT NULL, - parent_id INT -); - -- name: AllAuthors :many SELECT a.id, a.name, diff --git a/internal/endtoend/testdata/join_left_same_table/sqlite/schema.sql b/internal/endtoend/testdata/join_left_same_table/sqlite/schema.sql new file mode 100644 index 0000000000..4958ea64b6 --- /dev/null +++ b/internal/endtoend/testdata/join_left_same_table/sqlite/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE authors ( + id INT NOT NULL PRIMARY KEY, + name TEXT NOT NULL, + parent_id INT +); + diff --git a/internal/endtoend/testdata/join_left_same_table/sqlite/sqlc.json b/internal/endtoend/testdata/join_left_same_table/sqlite/sqlc.json index fcb288cb35..d4963e751f 100644 --- a/internal/endtoend/testdata/join_left_same_table/sqlite/sqlc.json +++ b/internal/endtoend/testdata/join_left_same_table/sqlite/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "sqlite", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_left_table_alias/issue.md b/internal/endtoend/testdata/join_left_table_alias/issue.md new file mode 100644 index 0000000000..77e67d1243 --- /dev/null +++ b/internal/endtoend/testdata/join_left_table_alias/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1897 diff --git a/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/go/db.go b/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/go/models.go b/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..f2f59a2260 --- /dev/null +++ b/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Bar struct { + FooID int64 + Info string +} + +type Foo struct { + ID int64 +} diff --git a/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..2afea551ce --- /dev/null +++ b/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/go/query.sql.go @@ -0,0 +1,48 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const joinBar = `-- name: JoinBar :one +SELECT f.id, info +FROM foo f +LEFT JOIN bar b ON b.foo_id = f.id +` + +type JoinBarRow struct { + ID int64 + Info pgtype.Text +} + +func (q *Queries) JoinBar(ctx context.Context) (JoinBarRow, error) { + row := q.db.QueryRow(ctx, joinBar) + var i JoinBarRow + err := row.Scan(&i.ID, &i.Info) + return i, err +} + +const joinBarAlias = `-- name: JoinBarAlias :one +SELECT f.id, b.info +FROM foo f +LEFT JOIN bar b ON b.foo_id = f.id +` + +type JoinBarAliasRow struct { + ID int64 + Info pgtype.Text +} + +func (q *Queries) JoinBarAlias(ctx context.Context) (JoinBarAliasRow, error) { + row := q.db.QueryRow(ctx, joinBarAlias) + var i JoinBarAliasRow + err := row.Scan(&i.ID, &i.Info) + return i, err +} diff --git a/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/query.sql b/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/query.sql new file mode 100644 index 0000000000..ad61f17b7b --- /dev/null +++ b/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/query.sql @@ -0,0 +1,9 @@ +-- name: JoinBar :one +SELECT f.id, info +FROM foo f +LEFT JOIN bar b ON b.foo_id = f.id; + +-- name: JoinBarAlias :one +SELECT f.id, b.info +FROM foo f +LEFT JOIN bar b ON b.foo_id = f.id; diff --git a/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/schema.sql b/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..2961590998 --- /dev/null +++ b/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/schema.sql @@ -0,0 +1,9 @@ +CREATE TABLE foo ( + id BIGINT PRIMARY KEY +); + +CREATE TABLE bar +( + foo_id BIGINT NOT NULL, + info TEXT NOT NULL +); diff --git a/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/join_order_by/issue.md b/internal/endtoend/testdata/join_order_by/issue.md new file mode 100644 index 0000000000..1c3c36feb8 --- /dev/null +++ b/internal/endtoend/testdata/join_order_by/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/2538 diff --git a/internal/endtoend/testdata/join_order_by/postgresql/pgx/exec.json b/internal/endtoend/testdata/join_order_by/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/join_order_by/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/join_order_by/postgresql/pgx/go/db.go b/internal/endtoend/testdata/join_order_by/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/join_order_by/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/join_order_by/postgresql/pgx/go/models.go b/internal/endtoend/testdata/join_order_by/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..e4cf9d17ae --- /dev/null +++ b/internal/endtoend/testdata/join_order_by/postgresql/pgx/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Author struct { + ID int64 + Name string + Bio pgtype.Text +} diff --git a/internal/endtoend/testdata/join_order_by/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/join_order_by/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..c6a217b08d --- /dev/null +++ b/internal/endtoend/testdata/join_order_by/postgresql/pgx/go/query.sql.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAuthor = `-- name: GetAuthor :one +SELECT a.name +FROM authors a JOIN authors b ON a.id = b.id +ORDER BY name +` + +func (q *Queries) GetAuthor(ctx context.Context) (string, error) { + row := q.db.QueryRow(ctx, getAuthor) + var name string + err := row.Scan(&name) + return name, err +} diff --git a/internal/endtoend/testdata/join_order_by/postgresql/pgx/query.sql b/internal/endtoend/testdata/join_order_by/postgresql/pgx/query.sql new file mode 100644 index 0000000000..39cf01c58b --- /dev/null +++ b/internal/endtoend/testdata/join_order_by/postgresql/pgx/query.sql @@ -0,0 +1,4 @@ +-- name: GetAuthor :one +SELECT a.name +FROM authors a JOIN authors b ON a.id = b.id +ORDER BY name; diff --git a/internal/endtoend/testdata/join_order_by/postgresql/pgx/schema.sql b/internal/endtoend/testdata/join_order_by/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..69b607d902 --- /dev/null +++ b/internal/endtoend/testdata/join_order_by/postgresql/pgx/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/join_order_by/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/join_order_by/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/join_order_by/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/models.go index 7b21a566df..ae9173ef9e 100644 --- a/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Email string } diff --git a/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/query.sql.go index 3bad17de64..167045b212 100644 --- a/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/query.sql b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/query.sql index 9abf85e687..7a47032a4c 100644 --- a/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (email text not null); - -- name: ColumnAsOrderBy :many SELECT a.email AS id FROM foo a JOIN foo b ON a.email = b.email diff --git a/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..da8ec19c5d --- /dev/null +++ b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (email text not null); + diff --git a/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/sqlc.json index de427d069f..cd518671ac 100644 --- a/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "engine": "postgresql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_right/mysql/go/db.go b/internal/endtoend/testdata/join_right/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/join_right/mysql/go/db.go +++ b/internal/endtoend/testdata/join_right/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_right/mysql/go/models.go b/internal/endtoend/testdata/join_right/mysql/go/models.go index 341e4cf911..7453c9d172 100644 --- a/internal/endtoend/testdata/join_right/mysql/go/models.go +++ b/internal/endtoend/testdata/join_right/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest @@ -9,10 +9,10 @@ import ( ) type Bar struct { - ID uint64 + ID int32 } type Foo struct { - ID uint64 + ID int32 BarID sql.NullInt32 } diff --git a/internal/endtoend/testdata/join_right/mysql/go/query.sql.go b/internal/endtoend/testdata/join_right/mysql/go/query.sql.go index 721dc6238c..9996f8c927 100644 --- a/internal/endtoend/testdata/join_right/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/join_right/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -18,12 +18,12 @@ WHERE f.id = ? ` type RightJoinRow struct { - ID sql.NullInt64 + ID sql.NullInt32 BarID sql.NullInt32 - ID_2 uint64 + ID_2 int32 } -func (q *Queries) RightJoin(ctx context.Context, id uint64) ([]RightJoinRow, error) { +func (q *Queries) RightJoin(ctx context.Context, id int32) ([]RightJoinRow, error) { rows, err := q.db.QueryContext(ctx, rightJoin, id) if err != nil { return nil, err diff --git a/internal/endtoend/testdata/join_right/mysql/query.sql b/internal/endtoend/testdata/join_right/mysql/query.sql index 7512513dfe..cfdf82f973 100644 --- a/internal/endtoend/testdata/join_right/mysql/query.sql +++ b/internal/endtoend/testdata/join_right/mysql/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE foo (id serial not null, bar_id int references bar(id)); -CREATE TABLE bar (id serial not null); - -- name: RightJoin :many SELECT f.id, f.bar_id, b.id FROM foo f diff --git a/internal/endtoend/testdata/join_right/mysql/schema.sql b/internal/endtoend/testdata/join_right/mysql/schema.sql new file mode 100644 index 0000000000..f0f2cb1685 --- /dev/null +++ b/internal/endtoend/testdata/join_right/mysql/schema.sql @@ -0,0 +1,8 @@ +CREATE TABLE bar ( + id integer not null, + UNIQUE(id) +); + +CREATE TABLE foo (id integer not null, bar_id integer references bar(id)); + + diff --git a/internal/endtoend/testdata/join_right/mysql/sqlc.json b/internal/endtoend/testdata/join_right/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/join_right/mysql/sqlc.json +++ b/internal/endtoend/testdata/join_right/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_right/postgresql/go/db.go b/internal/endtoend/testdata/join_right/postgresql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/join_right/postgresql/go/db.go +++ b/internal/endtoend/testdata/join_right/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_right/postgresql/go/models.go b/internal/endtoend/testdata/join_right/postgresql/go/models.go index f09478c274..7453c9d172 100644 --- a/internal/endtoend/testdata/join_right/postgresql/go/models.go +++ b/internal/endtoend/testdata/join_right/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_right/postgresql/go/query.sql.go b/internal/endtoend/testdata/join_right/postgresql/go/query.sql.go index 6df6cdf634..df23abc123 100644 --- a/internal/endtoend/testdata/join_right/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/join_right/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_right/postgresql/query.sql b/internal/endtoend/testdata/join_right/postgresql/query.sql index 3ca68e7d9c..f7d9c48d2b 100644 --- a/internal/endtoend/testdata/join_right/postgresql/query.sql +++ b/internal/endtoend/testdata/join_right/postgresql/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE bar (id serial not null unique); -CREATE TABLE foo (id serial not null, bar_id int references bar(id)); - -- name: RightJoin :many SELECT f.id, f.bar_id, b.id FROM foo f diff --git a/internal/endtoend/testdata/join_right/postgresql/schema.sql b/internal/endtoend/testdata/join_right/postgresql/schema.sql new file mode 100644 index 0000000000..c7d2a76585 --- /dev/null +++ b/internal/endtoend/testdata/join_right/postgresql/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE bar (id serial not null unique); +CREATE TABLE foo (id serial not null, bar_id int references bar(id)); + diff --git a/internal/endtoend/testdata/join_right/postgresql/sqlc.json b/internal/endtoend/testdata/join_right/postgresql/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/join_right/postgresql/sqlc.json +++ b/internal/endtoend/testdata/join_right/postgresql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_table_name/mysql/go/db.go b/internal/endtoend/testdata/join_table_name/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/join_table_name/mysql/go/db.go +++ b/internal/endtoend/testdata/join_table_name/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_table_name/mysql/go/models.go b/internal/endtoend/testdata/join_table_name/mysql/go/models.go index ca422f8bb2..8594c6e575 100644 --- a/internal/endtoend/testdata/join_table_name/mysql/go/models.go +++ b/internal/endtoend/testdata/join_table_name/mysql/go/models.go @@ -1,16 +1,18 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () +import ( + "database/sql" +) type Bar struct { - ID uint64 + ID int32 } type Foo struct { - ID uint64 - Bar uint64 + ID int32 + Bar sql.NullInt32 } diff --git a/internal/endtoend/testdata/join_table_name/mysql/go/query.sql.go b/internal/endtoend/testdata/join_table_name/mysql/go/query.sql.go index 704f80d27f..df1c751314 100644 --- a/internal/endtoend/testdata/join_table_name/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/join_table_name/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -17,13 +17,13 @@ WHERE bar.id = ? AND foo.id = ? ` type TableNameParams struct { - ID uint64 - ID_2 uint64 + ID int32 + ID_2 int32 } -func (q *Queries) TableName(ctx context.Context, arg TableNameParams) (uint64, error) { +func (q *Queries) TableName(ctx context.Context, arg TableNameParams) (int32, error) { row := q.db.QueryRowContext(ctx, tableName, arg.ID, arg.ID_2) - var id uint64 + var id int32 err := row.Scan(&id) return id, err } diff --git a/internal/endtoend/testdata/join_table_name/mysql/query.sql b/internal/endtoend/testdata/join_table_name/mysql/query.sql index 2196ed2375..8af0c45994 100644 --- a/internal/endtoend/testdata/join_table_name/mysql/query.sql +++ b/internal/endtoend/testdata/join_table_name/mysql/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE bar (id serial not null); -CREATE TABLE foo (id serial not null, bar serial references bar(id)); - -- name: TableName :one SELECT foo.id FROM foo diff --git a/internal/endtoend/testdata/join_table_name/mysql/schema.sql b/internal/endtoend/testdata/join_table_name/mysql/schema.sql new file mode 100644 index 0000000000..f54c3b485d --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/mysql/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE bar ( + id integer not null, + UNIQUE (id) +); + +CREATE TABLE foo (id integer not null, bar integer references bar(id)); + diff --git a/internal/endtoend/testdata/join_table_name/mysql/sqlc.json b/internal/endtoend/testdata/join_table_name/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/join_table_name/mysql/sqlc.json +++ b/internal/endtoend/testdata/join_table_name/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/models.go index 97645ef1cc..8594c6e575 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/query.sql.go index b792063714..bf5d3b2013 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/query.sql index 6689de6d33..3d11146a24 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE bar (id serial not null); -CREATE TABLE foo (id serial not null, bar serial); - -- name: TableName :one SELECT foo.id FROM foo diff --git a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..44c9874793 --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE bar (id serial not null); +CREATE TABLE foo (id serial not null, bar serial); + diff --git a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/models.go index dd2bbebe37..c7e5e6a8d0 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/query.sql.go index b792063714..bf5d3b2013 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/query.sql index 6689de6d33..3d11146a24 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE bar (id serial not null); -CREATE TABLE foo (id serial not null, bar serial); - -- name: TableName :one SELECT foo.id FROM foo diff --git a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..44c9874793 --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE bar (id serial not null); +CREATE TABLE foo (id serial not null, bar serial); + diff --git a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/models.go index 97645ef1cc..8594c6e575 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/query.sql.go index 9d3b717ccc..2030d9898e 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_table_name/postgresql/stdlib/query.sql b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/query.sql index 6689de6d33..3d11146a24 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE bar (id serial not null); -CREATE TABLE foo (id serial not null, bar serial); - -- name: TableName :one SELECT foo.id FROM foo diff --git a/internal/endtoend/testdata/join_table_name/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..44c9874793 --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE bar (id serial not null); +CREATE TABLE foo (id serial not null, bar serial); + diff --git a/internal/endtoend/testdata/join_table_name/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_table_name/sqlite/go/db.go b/internal/endtoend/testdata/join_table_name/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/join_table_name/sqlite/go/db.go +++ b/internal/endtoend/testdata/join_table_name/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_table_name/sqlite/go/models.go b/internal/endtoend/testdata/join_table_name/sqlite/go/models.go index 0dfbc6a574..10a2b6f6f5 100644 --- a/internal/endtoend/testdata/join_table_name/sqlite/go/models.go +++ b/internal/endtoend/testdata/join_table_name/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_table_name/sqlite/go/query.sql.go b/internal/endtoend/testdata/join_table_name/sqlite/go/query.sql.go index 4ee2d257c8..23281c26f9 100644 --- a/internal/endtoend/testdata/join_table_name/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/join_table_name/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_table_name/sqlite/query.sql b/internal/endtoend/testdata/join_table_name/sqlite/query.sql index b3cb5f12a2..8af0c45994 100644 --- a/internal/endtoend/testdata/join_table_name/sqlite/query.sql +++ b/internal/endtoend/testdata/join_table_name/sqlite/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE bar (id integer not null); -CREATE TABLE foo (id integer not null, bar integer references bar(id)); - -- name: TableName :one SELECT foo.id FROM foo diff --git a/internal/endtoend/testdata/join_table_name/sqlite/schema.sql b/internal/endtoend/testdata/join_table_name/sqlite/schema.sql new file mode 100644 index 0000000000..fe600c9ec6 --- /dev/null +++ b/internal/endtoend/testdata/join_table_name/sqlite/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE bar (id integer not null); +CREATE TABLE foo (id integer not null, bar integer references bar(id)); + diff --git a/internal/endtoend/testdata/join_table_name/sqlite/sqlc.json b/internal/endtoend/testdata/join_table_name/sqlite/sqlc.json index fcb288cb35..d4963e751f 100644 --- a/internal/endtoend/testdata/join_table_name/sqlite/sqlc.json +++ b/internal/endtoend/testdata/join_table_name/sqlite/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "sqlite", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_two_tables/mysql/go/db.go b/internal/endtoend/testdata/join_two_tables/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/join_two_tables/mysql/go/db.go +++ b/internal/endtoend/testdata/join_two_tables/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_two_tables/mysql/go/models.go b/internal/endtoend/testdata/join_two_tables/mysql/go/models.go index a066284f06..fae11cfa19 100644 --- a/internal/endtoend/testdata/join_two_tables/mysql/go/models.go +++ b/internal/endtoend/testdata/join_two_tables/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID uint64 } @@ -16,5 +14,5 @@ type Baz struct { type Foo struct { BarID uint64 - BazID uint64 + BazID int32 } diff --git a/internal/endtoend/testdata/join_two_tables/mysql/go/query.sql.go b/internal/endtoend/testdata/join_two_tables/mysql/go/query.sql.go index 5927fcc016..f5b3386fc2 100644 --- a/internal/endtoend/testdata/join_two_tables/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/join_two_tables/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_two_tables/mysql/query.sql b/internal/endtoend/testdata/join_two_tables/mysql/query.sql index 8dcf3ae0d8..f38154c3d8 100644 --- a/internal/endtoend/testdata/join_two_tables/mysql/query.sql +++ b/internal/endtoend/testdata/join_two_tables/mysql/query.sql @@ -1,7 +1,3 @@ -CREATE TABLE foo (bar_id serial not null, baz_id serial not null); -CREATE TABLE bar (id serial not null); -CREATE TABLE baz (id serial not null); - -- name: TwoJoins :many SELECT foo.* FROM foo diff --git a/internal/endtoend/testdata/join_two_tables/mysql/schema.sql b/internal/endtoend/testdata/join_two_tables/mysql/schema.sql new file mode 100644 index 0000000000..d8b5e500cf --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/mysql/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE foo (bar_id serial not null, baz_id integer not null); +CREATE TABLE bar (id serial not null); +CREATE TABLE baz (id serial not null); + diff --git a/internal/endtoend/testdata/join_two_tables/mysql/sqlc.json b/internal/endtoend/testdata/join_two_tables/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/join_two_tables/mysql/sqlc.json +++ b/internal/endtoend/testdata/join_two_tables/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/models.go index 7961958e95..ad2b376d3a 100644 --- a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/query.sql.go index 61960d893d..b2d903d310 100644 --- a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/query.sql index 8dcf3ae0d8..f38154c3d8 100644 --- a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/query.sql @@ -1,7 +1,3 @@ -CREATE TABLE foo (bar_id serial not null, baz_id serial not null); -CREATE TABLE bar (id serial not null); -CREATE TABLE baz (id serial not null); - -- name: TwoJoins :many SELECT foo.* FROM foo diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..86eb87a1ff --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE foo (bar_id serial not null, baz_id serial not null); +CREATE TABLE bar (id serial not null); +CREATE TABLE baz (id serial not null); + diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/models.go index 7961958e95..ad2b376d3a 100644 --- a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/query.sql.go index 61960d893d..b2d903d310 100644 --- a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/query.sql index 8dcf3ae0d8..f38154c3d8 100644 --- a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/query.sql @@ -1,7 +1,3 @@ -CREATE TABLE foo (bar_id serial not null, baz_id serial not null); -CREATE TABLE bar (id serial not null); -CREATE TABLE baz (id serial not null); - -- name: TwoJoins :many SELECT foo.* FROM foo diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..86eb87a1ff --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE foo (bar_id serial not null, baz_id serial not null); +CREATE TABLE bar (id serial not null); +CREATE TABLE baz (id serial not null); + diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/models.go index 7961958e95..ad2b376d3a 100644 --- a/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/query.sql.go index 5927fcc016..f5b3386fc2 100644 --- a/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/query.sql b/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/query.sql index 8dcf3ae0d8..f38154c3d8 100644 --- a/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/query.sql @@ -1,7 +1,3 @@ -CREATE TABLE foo (bar_id serial not null, baz_id serial not null); -CREATE TABLE bar (id serial not null); -CREATE TABLE baz (id serial not null); - -- name: TwoJoins :many SELECT foo.* FROM foo diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..86eb87a1ff --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE foo (bar_id serial not null, baz_id serial not null); +CREATE TABLE bar (id serial not null); +CREATE TABLE baz (id serial not null); + diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_two_tables/sqlite/go/db.go b/internal/endtoend/testdata/join_two_tables/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/join_two_tables/sqlite/go/db.go +++ b/internal/endtoend/testdata/join_two_tables/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_two_tables/sqlite/go/models.go b/internal/endtoend/testdata/join_two_tables/sqlite/go/models.go index f35fe8a337..b723af0c72 100644 --- a/internal/endtoend/testdata/join_two_tables/sqlite/go/models.go +++ b/internal/endtoend/testdata/join_two_tables/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int64 } diff --git a/internal/endtoend/testdata/join_two_tables/sqlite/go/query.sql.go b/internal/endtoend/testdata/join_two_tables/sqlite/go/query.sql.go index 5927fcc016..f5b3386fc2 100644 --- a/internal/endtoend/testdata/join_two_tables/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/join_two_tables/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_two_tables/sqlite/query.sql b/internal/endtoend/testdata/join_two_tables/sqlite/query.sql index bd5fd19f50..f38154c3d8 100644 --- a/internal/endtoend/testdata/join_two_tables/sqlite/query.sql +++ b/internal/endtoend/testdata/join_two_tables/sqlite/query.sql @@ -1,7 +1,3 @@ -CREATE TABLE foo (bar_id integer not null, baz_id integer not null); -CREATE TABLE bar (id integer not null); -CREATE TABLE baz (id integer not null); - -- name: TwoJoins :many SELECT foo.* FROM foo diff --git a/internal/endtoend/testdata/join_two_tables/sqlite/schema.sql b/internal/endtoend/testdata/join_two_tables/sqlite/schema.sql new file mode 100644 index 0000000000..381a08421f --- /dev/null +++ b/internal/endtoend/testdata/join_two_tables/sqlite/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE foo (bar_id integer not null, baz_id integer not null); +CREATE TABLE bar (id integer not null); +CREATE TABLE baz (id integer not null); + diff --git a/internal/endtoend/testdata/join_two_tables/sqlite/sqlc.json b/internal/endtoend/testdata/join_two_tables/sqlite/sqlc.json index fcb288cb35..d4963e751f 100644 --- a/internal/endtoend/testdata/join_two_tables/sqlite/sqlc.json +++ b/internal/endtoend/testdata/join_two_tables/sqlite/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "sqlite", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_update/issue.md b/internal/endtoend/testdata/join_update/issue.md new file mode 100644 index 0000000000..2b957486bc --- /dev/null +++ b/internal/endtoend/testdata/join_update/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1100 diff --git a/internal/endtoend/testdata/join_update/postgresql/pgx/go/db.go b/internal/endtoend/testdata/join_update/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/join_update/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/join_update/postgresql/pgx/go/models.go b/internal/endtoend/testdata/join_update/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..f762916256 --- /dev/null +++ b/internal/endtoend/testdata/join_update/postgresql/pgx/go/models.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type GroupCalcTotal struct { + Npn pgtype.Text + GroupID pgtype.Text +} + +type NpnExternalMap struct { + ID pgtype.Text + Npn pgtype.Text +} + +type ProducerGroupAttribute struct { + NpnExternalMapID pgtype.Text + GroupID pgtype.Text +} diff --git a/internal/endtoend/testdata/join_update/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/join_update/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..29e6561e64 --- /dev/null +++ b/internal/endtoend/testdata/join_update/postgresql/pgx/go/query.sql.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const percentile = `-- name: Percentile :exec +UPDATE group_calc_totals gct +SET npn = nem.npn +FROM producer_group_attribute ga +JOIN npn_external_map nem ON ga.npn_external_map_id = nem.id +WHERE gct.group_id = ga.group_id +` + +func (q *Queries) Percentile(ctx context.Context) error { + _, err := q.db.Exec(ctx, percentile) + return err +} diff --git a/internal/endtoend/testdata/join_update/postgresql/pgx/query.sql b/internal/endtoend/testdata/join_update/postgresql/pgx/query.sql new file mode 100644 index 0000000000..776517029d --- /dev/null +++ b/internal/endtoend/testdata/join_update/postgresql/pgx/query.sql @@ -0,0 +1,6 @@ +-- name: Percentile :exec +UPDATE group_calc_totals gct +SET npn = nem.npn +FROM producer_group_attribute ga +JOIN npn_external_map nem ON ga.npn_external_map_id = nem.id +WHERE gct.group_id = ga.group_id; diff --git a/internal/endtoend/testdata/join_update/postgresql/pgx/schema.sql b/internal/endtoend/testdata/join_update/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..c91a086a71 --- /dev/null +++ b/internal/endtoend/testdata/join_update/postgresql/pgx/schema.sql @@ -0,0 +1,14 @@ +CREATE TABLE group_calc_totals ( + npn text, + group_id text +); + +CREATE TABLE producer_group_attribute ( + npn_external_map_id text, + group_id text +); + +CREATE TABLE npn_external_map ( + id text, + npn text +); diff --git a/internal/endtoend/testdata/join_update/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/join_update/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/join_update/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/join_using/issue.md b/internal/endtoend/testdata/join_using/issue.md new file mode 100644 index 0000000000..29861d9662 --- /dev/null +++ b/internal/endtoend/testdata/join_using/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1425 diff --git a/internal/endtoend/testdata/join_using/postgresql/pgx/exec.json b/internal/endtoend/testdata/join_using/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/join_using/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/join_using/postgresql/pgx/go/db.go b/internal/endtoend/testdata/join_using/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/join_using/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/join_using/postgresql/pgx/go/models.go b/internal/endtoend/testdata/join_using/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..f4eaade85e --- /dev/null +++ b/internal/endtoend/testdata/join_using/postgresql/pgx/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type T1 struct { + Fk int32 +} + +type T2 struct { + Fk int32 +} diff --git a/internal/endtoend/testdata/join_using/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/join_using/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..d3031ccddf --- /dev/null +++ b/internal/endtoend/testdata/join_using/postgresql/pgx/go/query.sql.go @@ -0,0 +1,41 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const selectJoinUsing = `-- name: SelectJoinUsing :many +select t1.fk, sum(t2.fk) from t1 join t2 using (fk) group by fk +` + +type SelectJoinUsingRow struct { + Fk int32 + Sum pgtype.Int8 +} + +func (q *Queries) SelectJoinUsing(ctx context.Context) ([]SelectJoinUsingRow, error) { + rows, err := q.db.Query(ctx, selectJoinUsing) + if err != nil { + return nil, err + } + defer rows.Close() + var items []SelectJoinUsingRow + for rows.Next() { + var i SelectJoinUsingRow + if err := rows.Scan(&i.Fk, &i.Sum); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/join_using/postgresql/pgx/query.sql b/internal/endtoend/testdata/join_using/postgresql/pgx/query.sql new file mode 100644 index 0000000000..67a732e02e --- /dev/null +++ b/internal/endtoend/testdata/join_using/postgresql/pgx/query.sql @@ -0,0 +1,2 @@ +-- name: SelectJoinUsing :many +select t1.fk, sum(t2.fk) from t1 join t2 using (fk) group by fk; diff --git a/internal/endtoend/testdata/join_using/postgresql/pgx/schema.sql b/internal/endtoend/testdata/join_using/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..1e7b5a851d --- /dev/null +++ b/internal/endtoend/testdata/join_using/postgresql/pgx/schema.sql @@ -0,0 +1,6 @@ +create table t1 ( + fk integer not null unique +); +create table t2 ( + fk integer not null references t1(fk) +); diff --git a/internal/endtoend/testdata/join_using/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/join_using/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/join_using/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/join_validate_columns/issue.md b/internal/endtoend/testdata/join_validate_columns/issue.md new file mode 100644 index 0000000000..0050218dca --- /dev/null +++ b/internal/endtoend/testdata/join_validate_columns/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1239 \ No newline at end of file diff --git a/internal/endtoend/testdata/join_validate_columns/postgresql/pgx/exec.json b/internal/endtoend/testdata/join_validate_columns/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/join_validate_columns/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/join_validate_columns/postgresql/pgx/query.sql b/internal/endtoend/testdata/join_validate_columns/postgresql/pgx/query.sql new file mode 100644 index 0000000000..8fe51af829 --- /dev/null +++ b/internal/endtoend/testdata/join_validate_columns/postgresql/pgx/query.sql @@ -0,0 +1,2 @@ +-- name: ListAuthors :many +SELECT * FROM authors JOIN books ON authors.id = book.author_id1; \ No newline at end of file diff --git a/internal/endtoend/testdata/join_validate_columns/postgresql/pgx/schema.sql b/internal/endtoend/testdata/join_validate_columns/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..d322893016 --- /dev/null +++ b/internal/endtoend/testdata/join_validate_columns/postgresql/pgx/schema.sql @@ -0,0 +1,10 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL +); + +CREATE TABLE books ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + author_id BIGSERIAL REFERENCES authors(id) +); \ No newline at end of file diff --git a/internal/endtoend/testdata/join_validate_columns/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/join_validate_columns/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/join_validate_columns/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/join_validate_columns/postgresql/pgx/stderr.txt b/internal/endtoend/testdata/join_validate_columns/postgresql/pgx/stderr.txt new file mode 100644 index 0000000000..0dfd315960 --- /dev/null +++ b/internal/endtoend/testdata/join_validate_columns/postgresql/pgx/stderr.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:2:65: missing FROM-clause entry for table "book" \ No newline at end of file diff --git a/internal/endtoend/testdata/join_where_clause/mysql/go/db.go b/internal/endtoend/testdata/join_where_clause/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/join_where_clause/mysql/go/db.go +++ b/internal/endtoend/testdata/join_where_clause/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_where_clause/mysql/go/models.go b/internal/endtoend/testdata/join_where_clause/mysql/go/models.go index 803077b57c..ae80c37712 100644 --- a/internal/endtoend/testdata/join_where_clause/mysql/go/models.go +++ b/internal/endtoend/testdata/join_where_clause/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID uint64 Owner string diff --git a/internal/endtoend/testdata/join_where_clause/mysql/go/query.sql.go b/internal/endtoend/testdata/join_where_clause/mysql/go/query.sql.go index 9111e2dd4a..cd4f274eb6 100644 --- a/internal/endtoend/testdata/join_where_clause/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/join_where_clause/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_where_clause/mysql/query.sql b/internal/endtoend/testdata/join_where_clause/mysql/query.sql index fc92c48a5a..bdff39a5ba 100644 --- a/internal/endtoend/testdata/join_where_clause/mysql/query.sql +++ b/internal/endtoend/testdata/join_where_clause/mysql/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE foo (barid serial not null); -CREATE TABLE bar (id serial not null, owner text not null); - -- name: JoinWhereClause :many SELECT foo.* FROM foo diff --git a/internal/endtoend/testdata/join_where_clause/mysql/schema.sql b/internal/endtoend/testdata/join_where_clause/mysql/schema.sql new file mode 100644 index 0000000000..10bbaec805 --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/mysql/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (barid serial not null); +CREATE TABLE bar (id serial not null, owner text not null); + diff --git a/internal/endtoend/testdata/join_where_clause/mysql/sqlc.json b/internal/endtoend/testdata/join_where_clause/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/join_where_clause/mysql/sqlc.json +++ b/internal/endtoend/testdata/join_where_clause/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/models.go index c85fd0e71b..b133b28e36 100644 --- a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 Owner string diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/query.sql.go index 0f103bd681..da6dc818c3 100644 --- a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/query.sql index 210cf5daac..776cd41ced 100644 --- a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE foo (barid serial not null); -CREATE TABLE bar (id serial not null, owner text not null); - -- name: JoinWhereClause :many SELECT foo.* FROM foo diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..10bbaec805 --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (barid serial not null); +CREATE TABLE bar (id serial not null, owner text not null); + diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/models.go index c85fd0e71b..b133b28e36 100644 --- a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 Owner string diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/query.sql.go index 0f103bd681..da6dc818c3 100644 --- a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/query.sql index 7fdfc321d3..776cd41ced 100644 --- a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE foo (barid serial not null); -CREATE TABLE bar (id serial not null, owner text not null); - -- name: JoinWhereClause :many SELECT foo.* FROM foo @@ -17,4 +14,4 @@ WHERE owner = $1; SELECT foo.* FROM foo CROSS JOIN bar -WHERE bar.id = $2 AND owner = $1; +WHERE bar.id = $2 AND owner = $1; \ No newline at end of file diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..10bbaec805 --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (barid serial not null); +CREATE TABLE bar (id serial not null, owner text not null); + diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/models.go index c85fd0e71b..b133b28e36 100644 --- a/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 Owner string diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/query.sql.go index 1cc8b130a5..a3035e456d 100644 --- a/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/query.sql b/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/query.sql index 210cf5daac..776cd41ced 100644 --- a/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE foo (barid serial not null); -CREATE TABLE bar (id serial not null, owner text not null); - -- name: JoinWhereClause :many SELECT foo.* FROM foo diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..10bbaec805 --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (barid serial not null); +CREATE TABLE bar (id serial not null, owner text not null); + diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/join_where_clause/sqlite/go/db.go b/internal/endtoend/testdata/join_where_clause/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/join_where_clause/sqlite/go/db.go +++ b/internal/endtoend/testdata/join_where_clause/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/join_where_clause/sqlite/go/models.go b/internal/endtoend/testdata/join_where_clause/sqlite/go/models.go index 029903e6e5..ec6bbfe120 100644 --- a/internal/endtoend/testdata/join_where_clause/sqlite/go/models.go +++ b/internal/endtoend/testdata/join_where_clause/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int64 Owner string diff --git a/internal/endtoend/testdata/join_where_clause/sqlite/go/query.sql.go b/internal/endtoend/testdata/join_where_clause/sqlite/go/query.sql.go index 2a9c98ce40..46b1bcbdfa 100644 --- a/internal/endtoend/testdata/join_where_clause/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/join_where_clause/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_where_clause/sqlite/query.sql b/internal/endtoend/testdata/join_where_clause/sqlite/query.sql index 59ce35f62c..2b5ae53b00 100644 --- a/internal/endtoend/testdata/join_where_clause/sqlite/query.sql +++ b/internal/endtoend/testdata/join_where_clause/sqlite/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE foo (barid integer not null); -CREATE TABLE bar (id integer not null, owner text not null); - -- name: JoinWhereClause :many SELECT foo.* FROM foo diff --git a/internal/endtoend/testdata/join_where_clause/sqlite/schema.sql b/internal/endtoend/testdata/join_where_clause/sqlite/schema.sql new file mode 100644 index 0000000000..e2e8f9da90 --- /dev/null +++ b/internal/endtoend/testdata/join_where_clause/sqlite/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (barid integer not null); +CREATE TABLE bar (id integer not null, owner text not null); + diff --git a/internal/endtoend/testdata/join_where_clause/sqlite/sqlc.json b/internal/endtoend/testdata/join_where_clause/sqlite/sqlc.json index fcb288cb35..d4963e751f 100644 --- a/internal/endtoend/testdata/join_where_clause/sqlite/sqlc.json +++ b/internal/endtoend/testdata/join_where_clause/sqlite/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "sqlite", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/json/mysql/go/copyfrom.go b/internal/endtoend/testdata/json/mysql/go/copyfrom.go new file mode 100644 index 0000000000..e27ad3e735 --- /dev/null +++ b/internal/endtoend/testdata/json/mysql/go/copyfrom.go @@ -0,0 +1,51 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: copyfrom.go + +package querytest + +import ( + "context" + "fmt" + "io" + "sync/atomic" + + "github.com/go-sql-driver/mysql" + "github.com/hexon/mysqltsv" +) + +var readerHandlerSequenceForBulkInsert uint32 = 1 + +func convertRowsForBulkInsert(w *io.PipeWriter, arg []BulkInsertParams) { + e := mysqltsv.NewEncoder(w, 2, nil) + for _, row := range arg { + e.AppendBytes(row.A) + e.AppendBytes(row.B) + } + w.CloseWithError(e.Close()) +} + +// BulkInsert uses MySQL's LOAD DATA LOCAL INFILE and is not atomic. +// +// Errors and duplicate keys are treated as warnings and insertion will +// continue, even without an error for some cases. Use this in a transaction +// and use SHOW WARNINGS to check for any problems and roll back if you want to. +// +// Check the documentation for more information: +// https://dev.mysql.com/doc/refman/8.0/en/load-data.html#load-data-error-handling +func (q *Queries) BulkInsert(ctx context.Context, arg []BulkInsertParams) (int64, error) { + pr, pw := io.Pipe() + defer pr.Close() + rh := fmt.Sprintf("BulkInsert_%d", atomic.AddUint32(&readerHandlerSequenceForBulkInsert, 1)) + mysql.RegisterReaderHandler(rh, func() io.Reader { return pr }) + defer mysql.DeregisterReaderHandler(rh) + go convertRowsForBulkInsert(pw, arg) + // The string interpolation is necessary because LOAD DATA INFILE requires + // the file name to be given as a literal string. + result, err := q.db.ExecContext(ctx, fmt.Sprintf("LOAD DATA LOCAL INFILE '%s' INTO TABLE `foo` %s (a, b)", "Reader::"+rh, mysqltsv.Escaping)) + if err != nil { + return 0, err + } + return result.RowsAffected() +} diff --git a/internal/endtoend/testdata/json/mysql/go/db.go b/internal/endtoend/testdata/json/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/json/mysql/go/db.go +++ b/internal/endtoend/testdata/json/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/json/mysql/go/models.go b/internal/endtoend/testdata/json/mysql/go/models.go index 724a1dc24c..ce2b99dec7 100644 --- a/internal/endtoend/testdata/json/mysql/go/models.go +++ b/internal/endtoend/testdata/json/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/json/mysql/go/query.sql.go b/internal/endtoend/testdata/json/mysql/go/query.sql.go index 7418d99ba7..4301cd3454 100644 --- a/internal/endtoend/testdata/json/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/json/mysql/go/query.sql.go @@ -1,14 +1,24 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest import ( "context" + "encoding/json" ) +const bulkInsert = `-- name: BulkInsert :copyfrom +INSERT INTO foo (a, b) VALUES (?, ?) +` + +type BulkInsertParams struct { + A json.RawMessage + B json.RawMessage +} + const selectFoo = `-- name: SelectFoo :exec SELECT a, b FROM foo ` diff --git a/internal/endtoend/testdata/json/mysql/query.sql b/internal/endtoend/testdata/json/mysql/query.sql index b0234e866a..927e597562 100644 --- a/internal/endtoend/testdata/json/mysql/query.sql +++ b/internal/endtoend/testdata/json/mysql/query.sql @@ -1,7 +1,5 @@ -CREATE TABLE foo ( - a json not null, - b json -); - -- name: SelectFoo :exec SELECT * FROM foo; + +-- name: BulkInsert :copyfrom +INSERT INTO foo (a, b) VALUES (?, ?); diff --git a/internal/endtoend/testdata/json/mysql/schema.sql b/internal/endtoend/testdata/json/mysql/schema.sql new file mode 100644 index 0000000000..8f3d639f50 --- /dev/null +++ b/internal/endtoend/testdata/json/mysql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE foo ( + a json not null, + b json +); + diff --git a/internal/endtoend/testdata/json/mysql/sqlc.json b/internal/endtoend/testdata/json/mysql/sqlc.json index 445bbd1589..b1127e200f 100644 --- a/internal/endtoend/testdata/json/mysql/sqlc.json +++ b/internal/endtoend/testdata/json/mysql/sqlc.json @@ -4,8 +4,9 @@ { "path": "go", "engine": "mysql", + "sql_driver": "github.com/go-sql-driver/mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/json/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/json/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/json/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/json/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/json/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/json/postgresql/pgx/v4/go/models.go index 2fb0a5d003..e2a09cd7aa 100644 --- a/internal/endtoend/testdata/json/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/json/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/json/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/json/postgresql/pgx/v4/go/query.sql.go index 2b4c0c5411..907ec22cd8 100644 --- a/internal/endtoend/testdata/json/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/json/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/json/postgresql/pgx/v4/query.sql index b3aa769979..a8629cc2ae 100644 --- a/internal/endtoend/testdata/json/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/json/postgresql/pgx/v4/query.sql @@ -1,9 +1,2 @@ -CREATE TABLE foo ( - a json not null, - b jsonb not null, - c json, - d jsonb -); - -- name: SelectFoo :exec SELECT * FROM foo; diff --git a/internal/endtoend/testdata/json/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/json/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..6b4a1bb0fd --- /dev/null +++ b/internal/endtoend/testdata/json/postgresql/pgx/v4/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE foo ( + a json not null, + b jsonb not null, + c json, + d jsonb +); + diff --git a/internal/endtoend/testdata/json/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/json/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/json/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/json/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/json/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/json/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/json/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/json/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/json/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/json/postgresql/pgx/v5/go/models.go index b514ee396c..5157c6524c 100644 --- a/internal/endtoend/testdata/json/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/json/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { A []byte B []byte diff --git a/internal/endtoend/testdata/json/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/json/postgresql/pgx/v5/go/query.sql.go index 2b4c0c5411..907ec22cd8 100644 --- a/internal/endtoend/testdata/json/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/json/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/json/postgresql/pgx/v5/query.sql index b3aa769979..a8629cc2ae 100644 --- a/internal/endtoend/testdata/json/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/json/postgresql/pgx/v5/query.sql @@ -1,9 +1,2 @@ -CREATE TABLE foo ( - a json not null, - b jsonb not null, - c json, - d jsonb -); - -- name: SelectFoo :exec SELECT * FROM foo; diff --git a/internal/endtoend/testdata/json/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/json/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..6b4a1bb0fd --- /dev/null +++ b/internal/endtoend/testdata/json/postgresql/pgx/v5/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE foo ( + a json not null, + b jsonb not null, + c json, + d jsonb +); + diff --git a/internal/endtoend/testdata/json/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/json/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/json/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/json/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/json/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/json/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/json/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/json/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/json/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/json/postgresql/stdlib/go/models.go index 2dd39817de..b8d447e7d8 100644 --- a/internal/endtoend/testdata/json/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/json/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/json/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json/postgresql/stdlib/go/query.sql.go index 1cb5500e08..7144c0f706 100644 --- a/internal/endtoend/testdata/json/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json/postgresql/stdlib/query.sql b/internal/endtoend/testdata/json/postgresql/stdlib/query.sql index b3aa769979..a8629cc2ae 100644 --- a/internal/endtoend/testdata/json/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/json/postgresql/stdlib/query.sql @@ -1,9 +1,2 @@ -CREATE TABLE foo ( - a json not null, - b jsonb not null, - c json, - d jsonb -); - -- name: SelectFoo :exec SELECT * FROM foo; diff --git a/internal/endtoend/testdata/json/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/json/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..6b4a1bb0fd --- /dev/null +++ b/internal/endtoend/testdata/json/postgresql/stdlib/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE foo ( + a json not null, + b jsonb not null, + c json, + d jsonb +); + diff --git a/internal/endtoend/testdata/json/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/json/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/json/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/json/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/json_array_elements/issue.md b/internal/endtoend/testdata/json_array_elements/issue.md new file mode 100644 index 0000000000..d33962b191 --- /dev/null +++ b/internal/endtoend/testdata/json_array_elements/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/2731 diff --git a/internal/endtoend/testdata/json_array_elements/postgresql/pgx/exec.json b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/json_array_elements/postgresql/pgx/go/db.go b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/json_array_elements/postgresql/pgx/go/models.go b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..d28bfc19ea --- /dev/null +++ b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type SysAction struct { + ID int64 + Code string + Menu string + Title string + Resources []byte +} diff --git a/internal/endtoend/testdata/json_array_elements/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..2c13c0ffa9 --- /dev/null +++ b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/go/query.sql.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const getActionCodeByResource = `-- name: GetActionCodeByResource :one +SELECT code, arr.item_object ->> 'code' as resource_code +FROM sys_actions, + jsonb_array_elements(resources) with ordinality arr(item_object, resource) + WHERE item_object->>'resource' = $1 + LIMIT 1 +` + +type GetActionCodeByResourceRow struct { + Code string + ResourceCode pgtype.Text +} + +func (q *Queries) GetActionCodeByResource(ctx context.Context, resource pgtype.Text) (GetActionCodeByResourceRow, error) { + row := q.db.QueryRow(ctx, getActionCodeByResource, resource) + var i GetActionCodeByResourceRow + err := row.Scan(&i.Code, &i.ResourceCode) + return i, err +} diff --git a/internal/endtoend/testdata/json_array_elements/postgresql/pgx/query.sql b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/query.sql new file mode 100644 index 0000000000..44fe758df0 --- /dev/null +++ b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/query.sql @@ -0,0 +1,6 @@ +-- name: GetActionCodeByResource :one +SELECT code, arr.item_object ->> 'code' as resource_code +FROM sys_actions, + jsonb_array_elements(resources) with ordinality arr(item_object, resource) + WHERE item_object->>'resource' = sqlc.arg('resource') + LIMIT 1; diff --git a/internal/endtoend/testdata/json_array_elements/postgresql/pgx/schema.sql b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..b10a6c1d10 --- /dev/null +++ b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/schema.sql @@ -0,0 +1,8 @@ +CREATE TABLE "sys_actions" ( + "id" int8 NOT NULL, + "code" varchar(20) NOT NULL, + "menu" varchar(255) NOT NULL, + "title" varchar(20) NOT NULL, + "resources" jsonb, + PRIMARY KEY ("id") +); diff --git a/internal/endtoend/testdata/json_array_elements/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/query.sql.go index a17fe9c2bb..d075c6b1b7 100644 --- a/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json_build/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/json_build/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/json_build/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/json_build/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/json_build/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/json_build/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/query.sql.go index 82cfaf9594..1d1a952ec1 100644 --- a/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json_build/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/json_build/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/json_build/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/json_build/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/json_build/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/json_build/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/json_build/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/json_build/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/json_build/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/json_build/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/json_build/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/json_build/postgresql/stdlib/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/json_build/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/json_build/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/json_build/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json_build/postgresql/stdlib/go/query.sql.go index 38c7255d0e..65c574c522 100644 --- a/internal/endtoend/testdata/json_build/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json_build/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json_build/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/json_build/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/json_build/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/json_build/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/json_build/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/json_build/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/json_param_type/issue.md b/internal/endtoend/testdata/json_param_type/issue.md new file mode 100644 index 0000000000..a04d7dab14 --- /dev/null +++ b/internal/endtoend/testdata/json_param_type/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/743 \ No newline at end of file diff --git a/internal/endtoend/testdata/json_param_type/postgresql/pgx/exec.json b/internal/endtoend/testdata/json_param_type/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/json_param_type/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/json_param_type/postgresql/pgx/go/db.go b/internal/endtoend/testdata/json_param_type/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/json_param_type/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/json_param_type/postgresql/pgx/go/models.go b/internal/endtoend/testdata/json_param_type/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..07bd3e462b --- /dev/null +++ b/internal/endtoend/testdata/json_param_type/postgresql/pgx/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type User struct { + ID int32 + Metadata []byte +} diff --git a/internal/endtoend/testdata/json_param_type/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/json_param_type/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..2d57f3dd61 --- /dev/null +++ b/internal/endtoend/testdata/json_param_type/postgresql/pgx/go/query.sql.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const findByAddress = `-- name: FindByAddress :one +SELECT id, metadata FROM "user" WHERE "metadata"->>'address1' = $1 LIMIT 1 +` + +func (q *Queries) FindByAddress(ctx context.Context, metadata pgtype.Text) (User, error) { + row := q.db.QueryRow(ctx, findByAddress, metadata) + var i User + err := row.Scan(&i.ID, &i.Metadata) + return i, err +} diff --git a/internal/endtoend/testdata/json_param_type/postgresql/pgx/query.sql b/internal/endtoend/testdata/json_param_type/postgresql/pgx/query.sql new file mode 100644 index 0000000000..61da05b8ec --- /dev/null +++ b/internal/endtoend/testdata/json_param_type/postgresql/pgx/query.sql @@ -0,0 +1,2 @@ +-- name: FindByAddress :one +SELECT * FROM "user" WHERE "metadata"->>'address1' = $1 LIMIT 1; diff --git a/internal/endtoend/testdata/json_param_type/postgresql/pgx/schema.sql b/internal/endtoend/testdata/json_param_type/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..9d2499cf7c --- /dev/null +++ b/internal/endtoend/testdata/json_param_type/postgresql/pgx/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE "user" ( + "id" INT PRIMARY KEY GENERATED ALWAYS AS IDENTITY, + "metadata" JSONB +); diff --git a/internal/endtoend/testdata/json_param_type/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/json_param_type/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..01489e0ffc --- /dev/null +++ b/internal/endtoend/testdata/json_param_type/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" \ No newline at end of file diff --git a/internal/endtoend/testdata/json_param_type/sqlite/go/db.go b/internal/endtoend/testdata/json_param_type/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/json_param_type/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/json_param_type/sqlite/go/models.go b/internal/endtoend/testdata/json_param_type/sqlite/go/models.go new file mode 100644 index 0000000000..91b6d74f4c --- /dev/null +++ b/internal/endtoend/testdata/json_param_type/sqlite/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type User struct { + ID sql.NullInt64 + Metadata sql.NullString +} diff --git a/internal/endtoend/testdata/json_param_type/sqlite/go/query.sql.go b/internal/endtoend/testdata/json_param_type/sqlite/go/query.sql.go new file mode 100644 index 0000000000..c73e37a1fa --- /dev/null +++ b/internal/endtoend/testdata/json_param_type/sqlite/go/query.sql.go @@ -0,0 +1,22 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const findByAddress = `-- name: FindByAddress :one +SELECT id, metadata FROM "user" WHERE "metadata"->>'address1' = ?1 LIMIT 1 +` + +func (q *Queries) FindByAddress(ctx context.Context, metadata sql.NullString) (User, error) { + row := q.db.QueryRowContext(ctx, findByAddress, metadata) + var i User + err := row.Scan(&i.ID, &i.Metadata) + return i, err +} diff --git a/internal/endtoend/testdata/json_param_type/sqlite/query.sql b/internal/endtoend/testdata/json_param_type/sqlite/query.sql new file mode 100644 index 0000000000..7060d6e58e --- /dev/null +++ b/internal/endtoend/testdata/json_param_type/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: FindByAddress :one +SELECT * FROM "user" WHERE "metadata"->>'address1' = ?1 LIMIT 1; \ No newline at end of file diff --git a/internal/endtoend/testdata/json_param_type/sqlite/schema.sql b/internal/endtoend/testdata/json_param_type/sqlite/schema.sql new file mode 100644 index 0000000000..26c82958a4 --- /dev/null +++ b/internal/endtoend/testdata/json_param_type/sqlite/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE "user" ( + "id" INT, + "metadata" TEXT +); diff --git a/internal/endtoend/testdata/json_param_type/sqlite/sqlc.yaml b/internal/endtoend/testdata/json_param_type/sqlite/sqlc.yaml new file mode 100644 index 0000000000..0608985da1 --- /dev/null +++ b/internal/endtoend/testdata/json_param_type/sqlite/sqlc.yaml @@ -0,0 +1,9 @@ +version: "2" +sql: + - engine: "sqlite" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" \ No newline at end of file diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/models.go index 0d3b33a77d..b19a4d2547 100644 --- a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/query.sql.go index 43a8611ae7..6cd8cea48d 100644 --- a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/query.sql index ab97e20a4b..237b20193b 100644 --- a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/query.sql @@ -1,8 +1,2 @@ -CREATE TABLE users ( - first_name varchar(255), - last_name varchar(255), - age smallint -); - -- name: GetAll :many SELECT * FROM users; diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..8ca8f26d32 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + first_name varchar(255), + last_name varchar(255), + age smallint +); + diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/sqlc.json index 7b8eb80331..45ed536eb2 100644 --- a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_json_tags": true, "json_tags_case_style": "camel" diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/models.go index 932ee36a10..39d7af1488 100644 --- a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/query.sql.go index 43a8611ae7..6cd8cea48d 100644 --- a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/query.sql index ab97e20a4b..237b20193b 100644 --- a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/query.sql @@ -1,8 +1,2 @@ -CREATE TABLE users ( - first_name varchar(255), - last_name varchar(255), - age smallint -); - -- name: GetAll :many SELECT * FROM users; diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..8ca8f26d32 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + first_name varchar(255), + last_name varchar(255), + age smallint +); + diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/sqlc.json index 45a6f8e3aa..9f8193e0ae 100644 --- a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_json_tags": true, "json_tags_case_style": "camel" diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/models.go index 0d3b33a77d..b19a4d2547 100644 --- a/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/query.sql.go index 039ea641c2..3d8e6df6d4 100644 --- a/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/query.sql b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/query.sql index ab97e20a4b..237b20193b 100644 --- a/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/query.sql @@ -1,8 +1,2 @@ -CREATE TABLE users ( - first_name varchar(255), - last_name varchar(255), - age smallint -); - -- name: GetAll :many SELECT * FROM users; diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..8ca8f26d32 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + first_name varchar(255), + last_name varchar(255), + age smallint +); + diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/sqlc.json index 048a1f76e1..c83c1ec113 100644 --- a/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_json_tags": true, "json_tags_case_style": "camel" diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/models.go index caa7df7c05..e233ecddc1 100644 --- a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/query.sql.go index 43a8611ae7..6cd8cea48d 100644 --- a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/query.sql index ab97e20a4b..237b20193b 100644 --- a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/query.sql @@ -1,8 +1,2 @@ -CREATE TABLE users ( - first_name varchar(255), - last_name varchar(255), - age smallint -); - -- name: GetAll :many SELECT * FROM users; diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..8ca8f26d32 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + first_name varchar(255), + last_name varchar(255), + age smallint +); + diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/sqlc.json index 182c4564ef..a0701ce8b4 100644 --- a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_json_tags": true, "json_tags_case_style": "pascal" diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/models.go index 0fbe47e0c4..796a5df392 100644 --- a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/query.sql.go index 43a8611ae7..6cd8cea48d 100644 --- a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/query.sql index ab97e20a4b..237b20193b 100644 --- a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/query.sql @@ -1,8 +1,2 @@ -CREATE TABLE users ( - first_name varchar(255), - last_name varchar(255), - age smallint -); - -- name: GetAll :many SELECT * FROM users; diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..8ca8f26d32 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + first_name varchar(255), + last_name varchar(255), + age smallint +); + diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/sqlc.json index 50a467dd4c..43a61e223e 100644 --- a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_json_tags": true, "json_tags_case_style": "pascal" diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/models.go index caa7df7c05..e233ecddc1 100644 --- a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/query.sql.go index 039ea641c2..3d8e6df6d4 100644 --- a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/query.sql b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/query.sql index ab97e20a4b..237b20193b 100644 --- a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/query.sql @@ -1,8 +1,2 @@ -CREATE TABLE users ( - first_name varchar(255), - last_name varchar(255), - age smallint -); - -- name: GetAll :many SELECT * FROM users; diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..8ca8f26d32 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + first_name varchar(255), + last_name varchar(255), + age smallint +); + diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/sqlc.json index 632a1e02a8..55f529acba 100644 --- a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_json_tags": true, "json_tags_case_style": "pascal" diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/models.go index 0335ae4cf3..4b2e4b0bda 100644 --- a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/query.sql.go index 43a8611ae7..6cd8cea48d 100644 --- a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/query.sql index ab97e20a4b..237b20193b 100644 --- a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/query.sql @@ -1,8 +1,2 @@ -CREATE TABLE users ( - first_name varchar(255), - last_name varchar(255), - age smallint -); - -- name: GetAll :many SELECT * FROM users; diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..8ca8f26d32 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + first_name varchar(255), + last_name varchar(255), + age smallint +); + diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/sqlc.json index a745a15fac..813fde0b3d 100644 --- a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_json_tags": true, "json_tags_case_style": "snake" diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/models.go index d52d8dd32a..e162102cc6 100644 --- a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/query.sql.go index 43a8611ae7..6cd8cea48d 100644 --- a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/query.sql index ab97e20a4b..237b20193b 100644 --- a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/query.sql @@ -1,8 +1,2 @@ -CREATE TABLE users ( - first_name varchar(255), - last_name varchar(255), - age smallint -); - -- name: GetAll :many SELECT * FROM users; diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..8ca8f26d32 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + first_name varchar(255), + last_name varchar(255), + age smallint +); + diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/sqlc.json index 2696e64bc8..d592761750 100644 --- a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_json_tags": true, "json_tags_case_style": "snake" diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/models.go index 0335ae4cf3..4b2e4b0bda 100644 --- a/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/query.sql.go index 039ea641c2..3d8e6df6d4 100644 --- a/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/query.sql b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/query.sql index ab97e20a4b..237b20193b 100644 --- a/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/query.sql @@ -1,8 +1,2 @@ -CREATE TABLE users ( - first_name varchar(255), - last_name varchar(255), - age smallint -); - -- name: GetAll :many SELECT * FROM users; diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..8ca8f26d32 --- /dev/null +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + first_name varchar(255), + last_name varchar(255), + age smallint +); + diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/sqlc.json index 674a0a2919..4b2a25b8ec 100644 --- a/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_json_tags": true, "json_tags_case_style": "snake" diff --git a/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/db.go index 3d2b5bf3a3..cd5bbb8e08 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/models.go index 7efb945fa7..f3dde5226d 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/query.sql.go index 1236fb79f0..56bf7b7aab 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package db diff --git a/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/query.sql b/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/query.sql index b6e9878359..592b1925a5 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/query.sql @@ -1,12 +1,3 @@ -CREATE TYPE job_post_location_type AS ENUM('remote', 'in_office', 'hybrid'); - -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - type job_post_location_type, - name text NOT NULL, - bio text -); - -- name: GetAuthor :one SELECT * FROM authors WHERE id = $1 LIMIT 1; \ No newline at end of file diff --git a/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..eedb39357c --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/schema.sql @@ -0,0 +1,9 @@ +CREATE TYPE job_post_location_type AS ENUM('remote', 'in_office', 'hybrid'); + +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + type job_post_location_type, + name text NOT NULL, + bio text +); + diff --git a/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/sqlc.json index 9172e686fc..b8f4852685 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "db", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_json_tags": true, "json_tags_case_style": "camel" diff --git a/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/db.go index 3d2b5bf3a3..cd5bbb8e08 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/models.go index 3b5a95c272..d0b81a55dc 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/query.sql.go index 1236fb79f0..56bf7b7aab 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package db diff --git a/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/query.sql b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/query.sql index b6e9878359..592b1925a5 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/query.sql @@ -1,12 +1,3 @@ -CREATE TYPE job_post_location_type AS ENUM('remote', 'in_office', 'hybrid'); - -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - type job_post_location_type, - name text NOT NULL, - bio text -); - -- name: GetAuthor :one SELECT * FROM authors WHERE id = $1 LIMIT 1; \ No newline at end of file diff --git a/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..eedb39357c --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/schema.sql @@ -0,0 +1,9 @@ +CREATE TYPE job_post_location_type AS ENUM('remote', 'in_office', 'hybrid'); + +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + type job_post_location_type, + name text NOT NULL, + bio text +); + diff --git a/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/sqlc.json index 5afd45bd23..0736391022 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "db", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_json_tags": true, "json_tags_case_style": "none" diff --git a/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/db.go index 3d2b5bf3a3..cd5bbb8e08 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/models.go index 3b0e386120..09ebb453dc 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/query.sql.go index 1236fb79f0..56bf7b7aab 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package db diff --git a/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/query.sql b/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/query.sql index b6e9878359..592b1925a5 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/query.sql @@ -1,12 +1,3 @@ -CREATE TYPE job_post_location_type AS ENUM('remote', 'in_office', 'hybrid'); - -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - type job_post_location_type, - name text NOT NULL, - bio text -); - -- name: GetAuthor :one SELECT * FROM authors WHERE id = $1 LIMIT 1; \ No newline at end of file diff --git a/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..eedb39357c --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/schema.sql @@ -0,0 +1,9 @@ +CREATE TYPE job_post_location_type AS ENUM('remote', 'in_office', 'hybrid'); + +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + type job_post_location_type, + name text NOT NULL, + bio text +); + diff --git a/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/sqlc.json index f5800af321..59e3fcda3e 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "db", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_json_tags": true, "json_tags_case_style": "pascal" diff --git a/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/db.go index 3d2b5bf3a3..cd5bbb8e08 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/models.go index 3b5a95c272..d0b81a55dc 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/query.sql.go index 1236fb79f0..56bf7b7aab 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package db diff --git a/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/query.sql b/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/query.sql index b6e9878359..592b1925a5 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/query.sql @@ -1,12 +1,3 @@ -CREATE TYPE job_post_location_type AS ENUM('remote', 'in_office', 'hybrid'); - -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - type job_post_location_type, - name text NOT NULL, - bio text -); - -- name: GetAuthor :one SELECT * FROM authors WHERE id = $1 LIMIT 1; \ No newline at end of file diff --git a/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..eedb39357c --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/schema.sql @@ -0,0 +1,9 @@ +CREATE TYPE job_post_location_type AS ENUM('remote', 'in_office', 'hybrid'); + +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + type job_post_location_type, + name text NOT NULL, + bio text +); + diff --git a/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/sqlc.json index b078eefffa..4d30bb4ddd 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "db", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_json_tags": true, "json_tags_case_style": "snake" diff --git a/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/db.go index 3d2b5bf3a3..cd5bbb8e08 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/models.go index 3b5a95c272..d0b81a55dc 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/query.sql.go index 1236fb79f0..56bf7b7aab 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package db diff --git a/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/query.sql b/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/query.sql index b6e9878359..592b1925a5 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/query.sql @@ -1,12 +1,3 @@ -CREATE TYPE job_post_location_type AS ENUM('remote', 'in_office', 'hybrid'); - -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - type job_post_location_type, - name text NOT NULL, - bio text -); - -- name: GetAuthor :one SELECT * FROM authors WHERE id = $1 LIMIT 1; \ No newline at end of file diff --git a/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..eedb39357c --- /dev/null +++ b/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/schema.sql @@ -0,0 +1,9 @@ +CREATE TYPE job_post_location_type AS ENUM('remote', 'in_office', 'hybrid'); + +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + type job_post_location_type, + name text NOT NULL, + bio text +); + diff --git a/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/sqlc.json index 07cb7b9f0c..e65ee32fa1 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/sqlc.json @@ -2,7 +2,7 @@ "version": "2", "sql": [ { - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "engine": "postgresql", "gen": { diff --git a/internal/endtoend/testdata/jsonb/pgx/go/db.go b/internal/endtoend/testdata/jsonb/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/jsonb/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/jsonb/pgx/go/models.go b/internal/endtoend/testdata/jsonb/pgx/go/models.go new file mode 100644 index 0000000000..5157c6524c --- /dev/null +++ b/internal/endtoend/testdata/jsonb/pgx/go/models.go @@ -0,0 +1,12 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Foo struct { + A []byte + B []byte + C []byte + D []byte +} diff --git a/internal/endtoend/testdata/jsonb/pgx/go/query.sql.go b/internal/endtoend/testdata/jsonb/pgx/go/query.sql.go new file mode 100644 index 0000000000..b26d65ae1c --- /dev/null +++ b/internal/endtoend/testdata/jsonb/pgx/go/query.sql.go @@ -0,0 +1,50 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const insertFoo = `-- name: InsertFoo :exec +INSERT INTO foo ( + a, + b, + c, + d +) VALUES ( + $1, + $2, + $3, + $4 +) RETURNING a, b, c, d +` + +type InsertFooParams struct { + A []byte + B []byte + C []byte + D []byte +} + +func (q *Queries) InsertFoo(ctx context.Context, arg InsertFooParams) error { + _, err := q.db.Exec(ctx, insertFoo, + arg.A, + arg.B, + arg.C, + arg.D, + ) + return err +} + +const selectFoo = `-- name: SelectFoo :exec +SELECT a, b, c, d FROM foo +` + +func (q *Queries) SelectFoo(ctx context.Context) error { + _, err := q.db.Exec(ctx, selectFoo) + return err +} diff --git a/internal/endtoend/testdata/jsonb/pgx/query.sql b/internal/endtoend/testdata/jsonb/pgx/query.sql new file mode 100644 index 0000000000..6959bd1a70 --- /dev/null +++ b/internal/endtoend/testdata/jsonb/pgx/query.sql @@ -0,0 +1,15 @@ +-- name: InsertFoo :exec +INSERT INTO foo ( + a, + b, + c, + d +) VALUES ( + @a, + @b, + @c, + @d +) RETURNING *; + +-- name: SelectFoo :exec +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/jsonb/pgx/schema.sql b/internal/endtoend/testdata/jsonb/pgx/schema.sql new file mode 100644 index 0000000000..6b4a1bb0fd --- /dev/null +++ b/internal/endtoend/testdata/jsonb/pgx/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE foo ( + a json not null, + b jsonb not null, + c json, + d jsonb +); + diff --git a/internal/endtoend/testdata/jsonb/pgx/sqlc.json b/internal/endtoend/testdata/jsonb/pgx/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/jsonb/pgx/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v5", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/jsonb/sqlite/go/db.go b/internal/endtoend/testdata/jsonb/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/jsonb/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/jsonb/sqlite/go/models.go b/internal/endtoend/testdata/jsonb/sqlite/go/models.go new file mode 100644 index 0000000000..3980b20cad --- /dev/null +++ b/internal/endtoend/testdata/jsonb/sqlite/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "encoding/json" +) + +type Foo struct { + A json.RawMessage + B json.RawMessage + C json.RawMessage + D json.RawMessage +} diff --git a/internal/endtoend/testdata/jsonb/sqlite/go/query.sql.go b/internal/endtoend/testdata/jsonb/sqlite/go/query.sql.go new file mode 100644 index 0000000000..448182e3dd --- /dev/null +++ b/internal/endtoend/testdata/jsonb/sqlite/go/query.sql.go @@ -0,0 +1,51 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "encoding/json" +) + +const insertFoo = `-- name: InsertFoo :exec +INSERT INTO foo ( + a, + b, + c, + d +) VALUES ( + ?1, + ?2, + ?3, + ?4 +) RETURNING a, json(b), c, json(d) +` + +type InsertFooParams struct { + A json.RawMessage + B json.RawMessage + C json.RawMessage + D json.RawMessage +} + +func (q *Queries) InsertFoo(ctx context.Context, arg InsertFooParams) error { + _, err := q.db.ExecContext(ctx, insertFoo, + arg.A, + arg.B, + arg.C, + arg.D, + ) + return err +} + +const selectFoo = `-- name: SelectFoo :exec +SELECT a, json(b), c, json(d) FROM foo +` + +func (q *Queries) SelectFoo(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, selectFoo) + return err +} diff --git a/internal/endtoend/testdata/jsonb/sqlite/query.sql b/internal/endtoend/testdata/jsonb/sqlite/query.sql new file mode 100644 index 0000000000..6959bd1a70 --- /dev/null +++ b/internal/endtoend/testdata/jsonb/sqlite/query.sql @@ -0,0 +1,15 @@ +-- name: InsertFoo :exec +INSERT INTO foo ( + a, + b, + c, + d +) VALUES ( + @a, + @b, + @c, + @d +) RETURNING *; + +-- name: SelectFoo :exec +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/jsonb/sqlite/schema.sql b/internal/endtoend/testdata/jsonb/sqlite/schema.sql new file mode 100644 index 0000000000..6b4a1bb0fd --- /dev/null +++ b/internal/endtoend/testdata/jsonb/sqlite/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE foo ( + a json not null, + b jsonb not null, + c json, + d jsonb +); + diff --git a/internal/endtoend/testdata/jsonb/sqlite/sqlc.json b/internal/endtoend/testdata/jsonb/sqlite/sqlc.json new file mode 100644 index 0000000000..cd66df063b --- /dev/null +++ b/internal/endtoend/testdata/jsonb/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/limit/mysql/go/db.go b/internal/endtoend/testdata/limit/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/limit/mysql/go/db.go +++ b/internal/endtoend/testdata/limit/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/limit/mysql/go/models.go b/internal/endtoend/testdata/limit/mysql/go/models.go index 7c0a88d72b..04bc70ad65 100644 --- a/internal/endtoend/testdata/limit/mysql/go/models.go +++ b/internal/endtoend/testdata/limit/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Bar bool } diff --git a/internal/endtoend/testdata/limit/mysql/go/query.sql.go b/internal/endtoend/testdata/limit/mysql/go/query.sql.go index de24bbd3b7..5af60506f4 100644 --- a/internal/endtoend/testdata/limit/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/limit/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/limit/mysql/query.sql b/internal/endtoend/testdata/limit/mysql/query.sql index 4723273c5c..44f8b7d2e7 100644 --- a/internal/endtoend/testdata/limit/mysql/query.sql +++ b/internal/endtoend/testdata/limit/mysql/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar bool not null); - -- name: LimitMe :exec UPDATE foo SET bar='baz' LIMIT ?; diff --git a/internal/endtoend/testdata/limit/mysql/schema.sql b/internal/endtoend/testdata/limit/mysql/schema.sql new file mode 100644 index 0000000000..1d3eb6dc17 --- /dev/null +++ b/internal/endtoend/testdata/limit/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar bool not null); + diff --git a/internal/endtoend/testdata/limit/mysql/sqlc.json b/internal/endtoend/testdata/limit/mysql/sqlc.json index 7676c3bc51..6c2a9842c8 100644 --- a/internal/endtoend/testdata/limit/mysql/sqlc.json +++ b/internal/endtoend/testdata/limit/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/limit/pgx/v4/exec.json b/internal/endtoend/testdata/limit/pgx/v4/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/limit/pgx/v4/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/limit/pgx/v4/go/db.go b/internal/endtoend/testdata/limit/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/limit/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/limit/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/limit/pgx/v4/go/models.go b/internal/endtoend/testdata/limit/pgx/v4/go/models.go index 7c0a88d72b..04bc70ad65 100644 --- a/internal/endtoend/testdata/limit/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/limit/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Bar bool } diff --git a/internal/endtoend/testdata/limit/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/limit/pgx/v4/go/query.sql.go index a00a47af0b..d40cf94a08 100644 --- a/internal/endtoend/testdata/limit/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/limit/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/limit/pgx/v4/query.sql b/internal/endtoend/testdata/limit/pgx/v4/query.sql index 73ab623ad4..a190c5bb10 100644 --- a/internal/endtoend/testdata/limit/pgx/v4/query.sql +++ b/internal/endtoend/testdata/limit/pgx/v4/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (bar bool not null); - -- name: LimitMe :many SELECT bar FROM foo LIMIT $1; diff --git a/internal/endtoend/testdata/limit/pgx/v4/schema.sql b/internal/endtoend/testdata/limit/pgx/v4/schema.sql new file mode 100644 index 0000000000..1d3eb6dc17 --- /dev/null +++ b/internal/endtoend/testdata/limit/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar bool not null); + diff --git a/internal/endtoend/testdata/limit/pgx/v4/sqlc.json b/internal/endtoend/testdata/limit/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/limit/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/limit/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/limit/pgx/v5/exec.json b/internal/endtoend/testdata/limit/pgx/v5/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/limit/pgx/v5/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/limit/pgx/v5/go/db.go b/internal/endtoend/testdata/limit/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/limit/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/limit/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/limit/pgx/v5/go/models.go b/internal/endtoend/testdata/limit/pgx/v5/go/models.go index 7c0a88d72b..04bc70ad65 100644 --- a/internal/endtoend/testdata/limit/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/limit/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Bar bool } diff --git a/internal/endtoend/testdata/limit/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/limit/pgx/v5/go/query.sql.go index a00a47af0b..d40cf94a08 100644 --- a/internal/endtoend/testdata/limit/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/limit/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/limit/pgx/v5/query.sql b/internal/endtoend/testdata/limit/pgx/v5/query.sql index 73ab623ad4..a190c5bb10 100644 --- a/internal/endtoend/testdata/limit/pgx/v5/query.sql +++ b/internal/endtoend/testdata/limit/pgx/v5/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (bar bool not null); - -- name: LimitMe :many SELECT bar FROM foo LIMIT $1; diff --git a/internal/endtoend/testdata/limit/pgx/v5/schema.sql b/internal/endtoend/testdata/limit/pgx/v5/schema.sql new file mode 100644 index 0000000000..1d3eb6dc17 --- /dev/null +++ b/internal/endtoend/testdata/limit/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar bool not null); + diff --git a/internal/endtoend/testdata/limit/pgx/v5/sqlc.json b/internal/endtoend/testdata/limit/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/limit/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/limit/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/limit/sqlite/go/db.go b/internal/endtoend/testdata/limit/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/limit/sqlite/go/db.go +++ b/internal/endtoend/testdata/limit/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/limit/sqlite/go/models.go b/internal/endtoend/testdata/limit/sqlite/go/models.go index 7c0a88d72b..04bc70ad65 100644 --- a/internal/endtoend/testdata/limit/sqlite/go/models.go +++ b/internal/endtoend/testdata/limit/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Bar bool } diff --git a/internal/endtoend/testdata/limit/sqlite/go/query.sql.go b/internal/endtoend/testdata/limit/sqlite/go/query.sql.go index 75af7e8f64..31a0ab2993 100644 --- a/internal/endtoend/testdata/limit/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/limit/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/limit/sqlite/query.sql b/internal/endtoend/testdata/limit/sqlite/query.sql index 99862ad760..025e2a812b 100644 --- a/internal/endtoend/testdata/limit/sqlite/query.sql +++ b/internal/endtoend/testdata/limit/sqlite/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar bool not null); - -- name: LimitMe :many SELECT bar FROM foo LIMIT ?; diff --git a/internal/endtoend/testdata/limit/sqlite/schema.sql b/internal/endtoend/testdata/limit/sqlite/schema.sql new file mode 100644 index 0000000000..1d3eb6dc17 --- /dev/null +++ b/internal/endtoend/testdata/limit/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar bool not null); + diff --git a/internal/endtoend/testdata/limit/sqlite/sqlc.json b/internal/endtoend/testdata/limit/sqlite/sqlc.json index fcb288cb35..d4963e751f 100644 --- a/internal/endtoend/testdata/limit/sqlite/sqlc.json +++ b/internal/endtoend/testdata/limit/sqlite/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "sqlite", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/limit/stdlib/exec.json b/internal/endtoend/testdata/limit/stdlib/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/limit/stdlib/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/limit/stdlib/go/db.go b/internal/endtoend/testdata/limit/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/limit/stdlib/go/db.go +++ b/internal/endtoend/testdata/limit/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/limit/stdlib/go/models.go b/internal/endtoend/testdata/limit/stdlib/go/models.go index 7c0a88d72b..04bc70ad65 100644 --- a/internal/endtoend/testdata/limit/stdlib/go/models.go +++ b/internal/endtoend/testdata/limit/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Bar bool } diff --git a/internal/endtoend/testdata/limit/stdlib/go/query.sql.go b/internal/endtoend/testdata/limit/stdlib/go/query.sql.go index 3eec04c629..ab53cad1b7 100644 --- a/internal/endtoend/testdata/limit/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/limit/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/limit/stdlib/query.sql b/internal/endtoend/testdata/limit/stdlib/query.sql index 73ab623ad4..a190c5bb10 100644 --- a/internal/endtoend/testdata/limit/stdlib/query.sql +++ b/internal/endtoend/testdata/limit/stdlib/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (bar bool not null); - -- name: LimitMe :many SELECT bar FROM foo LIMIT $1; diff --git a/internal/endtoend/testdata/limit/stdlib/schema.sql b/internal/endtoend/testdata/limit/stdlib/schema.sql new file mode 100644 index 0000000000..1d3eb6dc17 --- /dev/null +++ b/internal/endtoend/testdata/limit/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar bool not null); + diff --git a/internal/endtoend/testdata/limit/stdlib/sqlc.json b/internal/endtoend/testdata/limit/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/limit/stdlib/sqlc.json +++ b/internal/endtoend/testdata/limit/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/lower/pgx/v4/go/db.go b/internal/endtoend/testdata/lower/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/lower/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/lower/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/lower/pgx/v4/go/models.go b/internal/endtoend/testdata/lower/pgx/v4/go/models.go index d95ec0aec6..061b030b06 100644 --- a/internal/endtoend/testdata/lower/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/lower/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Bar string Bat string diff --git a/internal/endtoend/testdata/lower/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/lower/pgx/v4/go/query.sql.go index f38a3464e3..2159e93436 100644 --- a/internal/endtoend/testdata/lower/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/lower/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/lower/pgx/v4/query.sql b/internal/endtoend/testdata/lower/pgx/v4/query.sql index 4808f19817..5d7c35b728 100644 --- a/internal/endtoend/testdata/lower/pgx/v4/query.sql +++ b/internal/endtoend/testdata/lower/pgx/v4/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (bar text not null, bat text not null); - -- name: Lower :many SELECT bar FROM foo WHERE bar = $1 AND LOWER(bat) = $2; diff --git a/internal/endtoend/testdata/lower/pgx/v4/schema.sql b/internal/endtoend/testdata/lower/pgx/v4/schema.sql new file mode 100644 index 0000000000..f9f4adf04e --- /dev/null +++ b/internal/endtoend/testdata/lower/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text not null, bat text not null); + diff --git a/internal/endtoend/testdata/lower/pgx/v4/sqlc.json b/internal/endtoend/testdata/lower/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/lower/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/lower/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/lower/pgx/v5/go/db.go b/internal/endtoend/testdata/lower/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/lower/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/lower/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/lower/pgx/v5/go/models.go b/internal/endtoend/testdata/lower/pgx/v5/go/models.go index d95ec0aec6..061b030b06 100644 --- a/internal/endtoend/testdata/lower/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/lower/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Bar string Bat string diff --git a/internal/endtoend/testdata/lower/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/lower/pgx/v5/go/query.sql.go index f38a3464e3..2159e93436 100644 --- a/internal/endtoend/testdata/lower/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/lower/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/lower/pgx/v5/query.sql b/internal/endtoend/testdata/lower/pgx/v5/query.sql index 4808f19817..5d7c35b728 100644 --- a/internal/endtoend/testdata/lower/pgx/v5/query.sql +++ b/internal/endtoend/testdata/lower/pgx/v5/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (bar text not null, bat text not null); - -- name: Lower :many SELECT bar FROM foo WHERE bar = $1 AND LOWER(bat) = $2; diff --git a/internal/endtoend/testdata/lower/pgx/v5/schema.sql b/internal/endtoend/testdata/lower/pgx/v5/schema.sql new file mode 100644 index 0000000000..f9f4adf04e --- /dev/null +++ b/internal/endtoend/testdata/lower/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text not null, bat text not null); + diff --git a/internal/endtoend/testdata/lower/pgx/v5/sqlc.json b/internal/endtoend/testdata/lower/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/lower/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/lower/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/lower/stdlib/go/db.go b/internal/endtoend/testdata/lower/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/lower/stdlib/go/db.go +++ b/internal/endtoend/testdata/lower/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/lower/stdlib/go/models.go b/internal/endtoend/testdata/lower/stdlib/go/models.go index d95ec0aec6..061b030b06 100644 --- a/internal/endtoend/testdata/lower/stdlib/go/models.go +++ b/internal/endtoend/testdata/lower/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Bar string Bat string diff --git a/internal/endtoend/testdata/lower/stdlib/go/query.sql.go b/internal/endtoend/testdata/lower/stdlib/go/query.sql.go index b826e926bf..3bedc86ba3 100644 --- a/internal/endtoend/testdata/lower/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/lower/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/lower/stdlib/query.sql b/internal/endtoend/testdata/lower/stdlib/query.sql index 4808f19817..5d7c35b728 100644 --- a/internal/endtoend/testdata/lower/stdlib/query.sql +++ b/internal/endtoend/testdata/lower/stdlib/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (bar text not null, bat text not null); - -- name: Lower :many SELECT bar FROM foo WHERE bar = $1 AND LOWER(bat) = $2; diff --git a/internal/endtoend/testdata/lower/stdlib/schema.sql b/internal/endtoend/testdata/lower/stdlib/schema.sql new file mode 100644 index 0000000000..f9f4adf04e --- /dev/null +++ b/internal/endtoend/testdata/lower/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text not null, bat text not null); + diff --git a/internal/endtoend/testdata/lower/stdlib/sqlc.json b/internal/endtoend/testdata/lower/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/lower/stdlib/sqlc.json +++ b/internal/endtoend/testdata/lower/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/db.go b/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/models.go b/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/models.go index d95ec0aec6..061b030b06 100644 --- a/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Bar string Bat string diff --git a/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/query.sql.go index 10ea579538..bd5949f23b 100644 --- a/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/lower_switched_order/pgx/v4/query.sql b/internal/endtoend/testdata/lower_switched_order/pgx/v4/query.sql index 791ac10dc9..f4a9b8339a 100644 --- a/internal/endtoend/testdata/lower_switched_order/pgx/v4/query.sql +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v4/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (bar text not null, bat text not null); - -- name: LowerSwitchedOrder :many SELECT bar FROM foo WHERE bar = $1 AND bat = LOWER($2); diff --git a/internal/endtoend/testdata/lower_switched_order/pgx/v4/schema.sql b/internal/endtoend/testdata/lower_switched_order/pgx/v4/schema.sql new file mode 100644 index 0000000000..f9f4adf04e --- /dev/null +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text not null, bat text not null); + diff --git a/internal/endtoend/testdata/lower_switched_order/pgx/v4/sqlc.json b/internal/endtoend/testdata/lower_switched_order/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/lower_switched_order/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/db.go b/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/models.go b/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/models.go index d95ec0aec6..061b030b06 100644 --- a/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Bar string Bat string diff --git a/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/query.sql.go index 10ea579538..bd5949f23b 100644 --- a/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/lower_switched_order/pgx/v5/query.sql b/internal/endtoend/testdata/lower_switched_order/pgx/v5/query.sql index 791ac10dc9..f4a9b8339a 100644 --- a/internal/endtoend/testdata/lower_switched_order/pgx/v5/query.sql +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v5/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (bar text not null, bat text not null); - -- name: LowerSwitchedOrder :many SELECT bar FROM foo WHERE bar = $1 AND bat = LOWER($2); diff --git a/internal/endtoend/testdata/lower_switched_order/pgx/v5/schema.sql b/internal/endtoend/testdata/lower_switched_order/pgx/v5/schema.sql new file mode 100644 index 0000000000..f9f4adf04e --- /dev/null +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text not null, bat text not null); + diff --git a/internal/endtoend/testdata/lower_switched_order/pgx/v5/sqlc.json b/internal/endtoend/testdata/lower_switched_order/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/lower_switched_order/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/lower_switched_order/stdlib/go/db.go b/internal/endtoend/testdata/lower_switched_order/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/lower_switched_order/stdlib/go/db.go +++ b/internal/endtoend/testdata/lower_switched_order/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/lower_switched_order/stdlib/go/models.go b/internal/endtoend/testdata/lower_switched_order/stdlib/go/models.go index d95ec0aec6..061b030b06 100644 --- a/internal/endtoend/testdata/lower_switched_order/stdlib/go/models.go +++ b/internal/endtoend/testdata/lower_switched_order/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Bar string Bat string diff --git a/internal/endtoend/testdata/lower_switched_order/stdlib/go/query.sql.go b/internal/endtoend/testdata/lower_switched_order/stdlib/go/query.sql.go index 60e022498a..79959a216a 100644 --- a/internal/endtoend/testdata/lower_switched_order/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/lower_switched_order/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/lower_switched_order/stdlib/query.sql b/internal/endtoend/testdata/lower_switched_order/stdlib/query.sql index 791ac10dc9..f4a9b8339a 100644 --- a/internal/endtoend/testdata/lower_switched_order/stdlib/query.sql +++ b/internal/endtoend/testdata/lower_switched_order/stdlib/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (bar text not null, bat text not null); - -- name: LowerSwitchedOrder :many SELECT bar FROM foo WHERE bar = $1 AND bat = LOWER($2); diff --git a/internal/endtoend/testdata/lower_switched_order/stdlib/schema.sql b/internal/endtoend/testdata/lower_switched_order/stdlib/schema.sql new file mode 100644 index 0000000000..f9f4adf04e --- /dev/null +++ b/internal/endtoend/testdata/lower_switched_order/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text not null, bat text not null); + diff --git a/internal/endtoend/testdata/lower_switched_order/stdlib/sqlc.json b/internal/endtoend/testdata/lower_switched_order/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/lower_switched_order/stdlib/sqlc.json +++ b/internal/endtoend/testdata/lower_switched_order/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/models.go index a91aa246f1..6399c72cfb 100644 --- a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/query.sql.go new file mode 100644 index 0000000000..23244b5220 --- /dev/null +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,39 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name, bio, gender FROM authors +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { + rows, err := q.db.Query(ctx, listAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan( + &i.ID, + &i.Name, + &i.Bio, + &i.Gender, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/query.sql index f14191f894..86636e2655 100644 --- a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/query.sql @@ -1,11 +1,2 @@ -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - name TEXT NOT NULL, - bio TEXT -); - -ALTER TABLE authors ADD COLUMN gender INTEGER NULL; - -CREATE MATERIALIZED VIEW authors_names as SELECT name from authors; - +-- name: ListAuthors :many SELECT * FROM authors; diff --git a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..cc05340890 --- /dev/null +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/schema.sql @@ -0,0 +1,10 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name TEXT NOT NULL, + bio TEXT +); + +ALTER TABLE authors ADD COLUMN gender INTEGER NULL; + +CREATE MATERIALIZED VIEW authors_names as SELECT name from authors; + diff --git a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/models.go index f0e07f746d..c5fd0c2555 100644 --- a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/query.sql.go new file mode 100644 index 0000000000..23244b5220 --- /dev/null +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,39 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name, bio, gender FROM authors +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { + rows, err := q.db.Query(ctx, listAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan( + &i.ID, + &i.Name, + &i.Bio, + &i.Gender, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/query.sql index f14191f894..86636e2655 100644 --- a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/query.sql @@ -1,11 +1,2 @@ -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - name TEXT NOT NULL, - bio TEXT -); - -ALTER TABLE authors ADD COLUMN gender INTEGER NULL; - -CREATE MATERIALIZED VIEW authors_names as SELECT name from authors; - +-- name: ListAuthors :many SELECT * FROM authors; diff --git a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..cc05340890 --- /dev/null +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/schema.sql @@ -0,0 +1,10 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name TEXT NOT NULL, + bio TEXT +); + +ALTER TABLE authors ADD COLUMN gender INTEGER NULL; + +CREATE MATERIALIZED VIEW authors_names as SELECT name from authors; + diff --git a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/models.go index a91aa246f1..6399c72cfb 100644 --- a/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/query.sql.go new file mode 100644 index 0000000000..b177d0f16c --- /dev/null +++ b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name, bio, gender FROM authors +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan( + &i.ID, + &i.Name, + &i.Bio, + &i.Gender, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/materialized_views/postgresql/stdlib/query.sql b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/query.sql index f14191f894..86636e2655 100644 --- a/internal/endtoend/testdata/materialized_views/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/query.sql @@ -1,11 +1,2 @@ -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - name TEXT NOT NULL, - bio TEXT -); - -ALTER TABLE authors ADD COLUMN gender INTEGER NULL; - -CREATE MATERIALIZED VIEW authors_names as SELECT name from authors; - +-- name: ListAuthors :many SELECT * FROM authors; diff --git a/internal/endtoend/testdata/materialized_views/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..cc05340890 --- /dev/null +++ b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/schema.sql @@ -0,0 +1,10 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name TEXT NOT NULL, + bio TEXT +); + +ALTER TABLE authors ADD COLUMN gender INTEGER NULL; + +CREATE MATERIALIZED VIEW authors_names as SELECT name from authors; + diff --git a/internal/endtoend/testdata/materialized_views/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/materialized_views/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/db.go b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/models.go b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/models.go index 5f59febb3f..8a66a8cf24 100644 --- a/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Num int32 } diff --git a/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/query.sql.go index c2b7fdb255..c3215c16c3 100644 --- a/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/mathmatical_operator/pgx/v4/query.sql b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/query.sql index 2ec3121d2a..a3655a3db6 100644 --- a/internal/endtoend/testdata/mathmatical_operator/pgx/v4/query.sql +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (num integer not null); - -- name: Math :many SELECT *, num / 1024 as division FROM foo; diff --git a/internal/endtoend/testdata/mathmatical_operator/pgx/v4/schema.sql b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/schema.sql new file mode 100644 index 0000000000..cfb1814e4a --- /dev/null +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (num integer not null); + diff --git a/internal/endtoend/testdata/mathmatical_operator/pgx/v4/sqlc.json b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/mathmatical_operator/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/db.go b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/models.go b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/models.go index 5f59febb3f..8a66a8cf24 100644 --- a/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Num int32 } diff --git a/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/query.sql.go index c2b7fdb255..c3215c16c3 100644 --- a/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/mathmatical_operator/pgx/v5/query.sql b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/query.sql index 2ec3121d2a..a3655a3db6 100644 --- a/internal/endtoend/testdata/mathmatical_operator/pgx/v5/query.sql +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (num integer not null); - -- name: Math :many SELECT *, num / 1024 as division FROM foo; diff --git a/internal/endtoend/testdata/mathmatical_operator/pgx/v5/schema.sql b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/schema.sql new file mode 100644 index 0000000000..cfb1814e4a --- /dev/null +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (num integer not null); + diff --git a/internal/endtoend/testdata/mathmatical_operator/pgx/v5/sqlc.json b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/mathmatical_operator/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/mathmatical_operator/stdlib/go/db.go b/internal/endtoend/testdata/mathmatical_operator/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/mathmatical_operator/stdlib/go/db.go +++ b/internal/endtoend/testdata/mathmatical_operator/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/mathmatical_operator/stdlib/go/models.go b/internal/endtoend/testdata/mathmatical_operator/stdlib/go/models.go index 5f59febb3f..8a66a8cf24 100644 --- a/internal/endtoend/testdata/mathmatical_operator/stdlib/go/models.go +++ b/internal/endtoend/testdata/mathmatical_operator/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Num int32 } diff --git a/internal/endtoend/testdata/mathmatical_operator/stdlib/go/query.sql.go b/internal/endtoend/testdata/mathmatical_operator/stdlib/go/query.sql.go index 8881d216d6..22bc5eedce 100644 --- a/internal/endtoend/testdata/mathmatical_operator/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/mathmatical_operator/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/mathmatical_operator/stdlib/query.sql b/internal/endtoend/testdata/mathmatical_operator/stdlib/query.sql index 2ec3121d2a..a3655a3db6 100644 --- a/internal/endtoend/testdata/mathmatical_operator/stdlib/query.sql +++ b/internal/endtoend/testdata/mathmatical_operator/stdlib/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (num integer not null); - -- name: Math :many SELECT *, num / 1024 as division FROM foo; diff --git a/internal/endtoend/testdata/mathmatical_operator/stdlib/schema.sql b/internal/endtoend/testdata/mathmatical_operator/stdlib/schema.sql new file mode 100644 index 0000000000..cfb1814e4a --- /dev/null +++ b/internal/endtoend/testdata/mathmatical_operator/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (num integer not null); + diff --git a/internal/endtoend/testdata/mathmatical_operator/stdlib/sqlc.json b/internal/endtoend/testdata/mathmatical_operator/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/mathmatical_operator/stdlib/sqlc.json +++ b/internal/endtoend/testdata/mathmatical_operator/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/min_max_date/issue.md b/internal/endtoend/testdata/min_max_date/issue.md new file mode 100644 index 0000000000..73083e9651 --- /dev/null +++ b/internal/endtoend/testdata/min_max_date/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1574 diff --git a/internal/endtoend/testdata/min_max_date/postgresql/pgx/exec.json b/internal/endtoend/testdata/min_max_date/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/min_max_date/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/min_max_date/postgresql/pgx/go/db.go b/internal/endtoend/testdata/min_max_date/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/min_max_date/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/min_max_date/postgresql/pgx/go/models.go b/internal/endtoend/testdata/min_max_date/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..6e9823127b --- /dev/null +++ b/internal/endtoend/testdata/min_max_date/postgresql/pgx/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Activity struct { + AccountID int64 + EventTime pgtype.Timestamptz +} diff --git a/internal/endtoend/testdata/min_max_date/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/min_max_date/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..5366bac847 --- /dev/null +++ b/internal/endtoend/testdata/min_max_date/postgresql/pgx/go/query.sql.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const activityStats = `-- name: ActivityStats :one +SELECT COUNT(*) as NumOfActivities, + MIN(event_time) as MinDate, + MAX(event_time) as MaxDate +FROM activities +WHERE account_id = $1 +` + +type ActivityStatsRow struct { + Numofactivities int64 + Mindate pgtype.Timestamptz + Maxdate pgtype.Timestamptz +} + +func (q *Queries) ActivityStats(ctx context.Context, accountID int64) (ActivityStatsRow, error) { + row := q.db.QueryRow(ctx, activityStats, accountID) + var i ActivityStatsRow + err := row.Scan(&i.Numofactivities, &i.Mindate, &i.Maxdate) + return i, err +} diff --git a/internal/endtoend/testdata/min_max_date/postgresql/pgx/query.sql b/internal/endtoend/testdata/min_max_date/postgresql/pgx/query.sql new file mode 100644 index 0000000000..19909d0c88 --- /dev/null +++ b/internal/endtoend/testdata/min_max_date/postgresql/pgx/query.sql @@ -0,0 +1,6 @@ +-- name: ActivityStats :one +SELECT COUNT(*) as NumOfActivities, + MIN(event_time) as MinDate, + MAX(event_time) as MaxDate +FROM activities +WHERE account_id = $1; diff --git a/internal/endtoend/testdata/min_max_date/postgresql/pgx/schema.sql b/internal/endtoend/testdata/min_max_date/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..c75fe28fbd --- /dev/null +++ b/internal/endtoend/testdata/min_max_date/postgresql/pgx/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE activities ( + account_id BIGINT NOT NULL, + event_time TIMESTAMP WITH TIME ZONE NOT NULL +); diff --git a/internal/endtoend/testdata/min_max_date/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/min_max_date/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/min_max_date/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/missing_semicolon/mysql/go/db.go b/internal/endtoend/testdata/missing_semicolon/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/missing_semicolon/mysql/go/db.go +++ b/internal/endtoend/testdata/missing_semicolon/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/missing_semicolon/mysql/go/models.go b/internal/endtoend/testdata/missing_semicolon/mysql/go/models.go index f5cf23b517..ec1cb8d670 100644 --- a/internal/endtoend/testdata/missing_semicolon/mysql/go/models.go +++ b/internal/endtoend/testdata/missing_semicolon/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/missing_semicolon/mysql/go/query.sql.go b/internal/endtoend/testdata/missing_semicolon/mysql/go/query.sql.go index 18d087bac2..eec817e3eb 100644 --- a/internal/endtoend/testdata/missing_semicolon/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/missing_semicolon/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/missing_semicolon/mysql/query.sql b/internal/endtoend/testdata/missing_semicolon/mysql/query.sql index e04a8887c4..47500d575e 100644 --- a/internal/endtoend/testdata/missing_semicolon/mysql/query.sql +++ b/internal/endtoend/testdata/missing_semicolon/mysql/query.sql @@ -1,10 +1,3 @@ --- https://github.com/sqlc-dev/sqlc/issues/1198 -CREATE TABLE authors ( - id INT PRIMARY KEY, - name VARCHAR(255) NOT NULL, - bio text -); - -- name: SetAuthor :exec UPDATE authors SET name = ? diff --git a/internal/endtoend/testdata/missing_semicolon/mysql/schema.sql b/internal/endtoend/testdata/missing_semicolon/mysql/schema.sql new file mode 100644 index 0000000000..4c11a9c067 --- /dev/null +++ b/internal/endtoend/testdata/missing_semicolon/mysql/schema.sql @@ -0,0 +1,7 @@ +-- https://github.com/sqlc-dev/sqlc/issues/1198 +CREATE TABLE authors ( + id INT PRIMARY KEY, + name VARCHAR(255) NOT NULL, + bio text +); + diff --git a/internal/endtoend/testdata/missing_semicolon/mysql/sqlc.json b/internal/endtoend/testdata/missing_semicolon/mysql/sqlc.json index 534b7e24e9..0390f67889 100644 --- a/internal/endtoend/testdata/missing_semicolon/mysql/sqlc.json +++ b/internal/endtoend/testdata/missing_semicolon/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/missing_semicolon/pgx/v4/query.sql b/internal/endtoend/testdata/missing_semicolon/pgx/v4/query.sql index cdd62d5ad7..80c83545ce 100644 --- a/internal/endtoend/testdata/missing_semicolon/pgx/v4/query.sql +++ b/internal/endtoend/testdata/missing_semicolon/pgx/v4/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (email text not null); - -- name: FirstQuery :many SELECT * FROM foo; diff --git a/internal/endtoend/testdata/missing_semicolon/pgx/v4/schema.sql b/internal/endtoend/testdata/missing_semicolon/pgx/v4/schema.sql new file mode 100644 index 0000000000..e2b1d89074 --- /dev/null +++ b/internal/endtoend/testdata/missing_semicolon/pgx/v4/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (email text not null); diff --git a/internal/endtoend/testdata/missing_semicolon/pgx/v4/sqlc.json b/internal/endtoend/testdata/missing_semicolon/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/missing_semicolon/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/missing_semicolon/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/missing_semicolon/pgx/v4/stderr.txt b/internal/endtoend/testdata/missing_semicolon/pgx/v4/stderr.txt index 5cd2f160b8..7544904cf6 100644 --- a/internal/endtoend/testdata/missing_semicolon/pgx/v4/stderr.txt +++ b/internal/endtoend/testdata/missing_semicolon/pgx/v4/stderr.txt @@ -1,2 +1,2 @@ # package querytest -query.sql:7:1: missing semicolon at end of file +query.sql:5:1: missing semicolon at end of file diff --git a/internal/endtoend/testdata/missing_semicolon/pgx/v5/query.sql b/internal/endtoend/testdata/missing_semicolon/pgx/v5/query.sql index cdd62d5ad7..80c83545ce 100644 --- a/internal/endtoend/testdata/missing_semicolon/pgx/v5/query.sql +++ b/internal/endtoend/testdata/missing_semicolon/pgx/v5/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (email text not null); - -- name: FirstQuery :many SELECT * FROM foo; diff --git a/internal/endtoend/testdata/missing_semicolon/pgx/v5/schema.sql b/internal/endtoend/testdata/missing_semicolon/pgx/v5/schema.sql new file mode 100644 index 0000000000..28f5b2d13e --- /dev/null +++ b/internal/endtoend/testdata/missing_semicolon/pgx/v5/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (email text not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/missing_semicolon/pgx/v5/sqlc.json b/internal/endtoend/testdata/missing_semicolon/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/missing_semicolon/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/missing_semicolon/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/missing_semicolon/pgx/v5/stderr.txt b/internal/endtoend/testdata/missing_semicolon/pgx/v5/stderr.txt index 5cd2f160b8..7544904cf6 100644 --- a/internal/endtoend/testdata/missing_semicolon/pgx/v5/stderr.txt +++ b/internal/endtoend/testdata/missing_semicolon/pgx/v5/stderr.txt @@ -1,2 +1,2 @@ # package querytest -query.sql:7:1: missing semicolon at end of file +query.sql:5:1: missing semicolon at end of file diff --git a/internal/endtoend/testdata/missing_semicolon/stdlib/query.sql b/internal/endtoend/testdata/missing_semicolon/stdlib/query.sql index cdd62d5ad7..80c83545ce 100644 --- a/internal/endtoend/testdata/missing_semicolon/stdlib/query.sql +++ b/internal/endtoend/testdata/missing_semicolon/stdlib/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (email text not null); - -- name: FirstQuery :many SELECT * FROM foo; diff --git a/internal/endtoend/testdata/missing_semicolon/stdlib/schema.sql b/internal/endtoend/testdata/missing_semicolon/stdlib/schema.sql new file mode 100644 index 0000000000..28f5b2d13e --- /dev/null +++ b/internal/endtoend/testdata/missing_semicolon/stdlib/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (email text not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/missing_semicolon/stdlib/sqlc.json b/internal/endtoend/testdata/missing_semicolon/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/missing_semicolon/stdlib/sqlc.json +++ b/internal/endtoend/testdata/missing_semicolon/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/missing_semicolon/stdlib/stderr.txt b/internal/endtoend/testdata/missing_semicolon/stdlib/stderr.txt index 5cd2f160b8..7544904cf6 100644 --- a/internal/endtoend/testdata/missing_semicolon/stdlib/stderr.txt +++ b/internal/endtoend/testdata/missing_semicolon/stdlib/stderr.txt @@ -1,2 +1,2 @@ # package querytest -query.sql:7:1: missing semicolon at end of file +query.sql:5:1: missing semicolon at end of file diff --git a/internal/endtoend/testdata/mix_param_types/mysql/go/db.go b/internal/endtoend/testdata/mix_param_types/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/mix_param_types/mysql/go/db.go +++ b/internal/endtoend/testdata/mix_param_types/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/mix_param_types/mysql/go/models.go b/internal/endtoend/testdata/mix_param_types/mysql/go/models.go index 3d650b2fb8..ec9de5f49c 100644 --- a/internal/endtoend/testdata/mix_param_types/mysql/go/models.go +++ b/internal/endtoend/testdata/mix_param_types/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID uint64 Name string diff --git a/internal/endtoend/testdata/mix_param_types/mysql/go/test.sql.go b/internal/endtoend/testdata/mix_param_types/mysql/go/test.sql.go index 094cea055b..5b7a32b9bd 100644 --- a/internal/endtoend/testdata/mix_param_types/mysql/go/test.sql.go +++ b/internal/endtoend/testdata/mix_param_types/mysql/go/test.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: test.sql package querytest diff --git a/internal/endtoend/testdata/mix_param_types/mysql/schema.sql b/internal/endtoend/testdata/mix_param_types/mysql/schema.sql new file mode 100644 index 0000000000..b515bf8d04 --- /dev/null +++ b/internal/endtoend/testdata/mix_param_types/mysql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE bar ( + id serial not null, + name text not null, + phone text not null +); diff --git a/internal/endtoend/testdata/mix_param_types/mysql/sqlc.json b/internal/endtoend/testdata/mix_param_types/mysql/sqlc.json index 145f64ba3f..3e8d09d00d 100644 --- a/internal/endtoend/testdata/mix_param_types/mysql/sqlc.json +++ b/internal/endtoend/testdata/mix_param_types/mysql/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "test.sql", + "schema": "schema.sql", "queries": "test.sql", "engine": "mysql" } diff --git a/internal/endtoend/testdata/mix_param_types/mysql/test.sql b/internal/endtoend/testdata/mix_param_types/mysql/test.sql index b624d3e2ea..e23f1dcb70 100644 --- a/internal/endtoend/testdata/mix_param_types/mysql/test.sql +++ b/internal/endtoend/testdata/mix_param_types/mysql/test.sql @@ -1,9 +1,3 @@ -CREATE TABLE bar ( - id serial not null, - name text not null, - phone text not null -); - -- name: CountOne :one SELECT count(1) FROM bar WHERE id = sqlc.arg(id) AND name <> ?; diff --git a/internal/endtoend/testdata/mix_param_types/postgresql/exec.json b/internal/endtoend/testdata/mix_param_types/postgresql/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/mix_param_types/postgresql/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/mix_param_types/postgresql/go/db.go b/internal/endtoend/testdata/mix_param_types/postgresql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/mix_param_types/postgresql/go/db.go +++ b/internal/endtoend/testdata/mix_param_types/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/mix_param_types/postgresql/go/models.go b/internal/endtoend/testdata/mix_param_types/postgresql/go/models.go index d449828a99..2f0803b319 100644 --- a/internal/endtoend/testdata/mix_param_types/postgresql/go/models.go +++ b/internal/endtoend/testdata/mix_param_types/postgresql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 Name string diff --git a/internal/endtoend/testdata/mix_param_types/postgresql/go/test.sql.go b/internal/endtoend/testdata/mix_param_types/postgresql/go/test.sql.go index e26ff42c11..be9a12710b 100644 --- a/internal/endtoend/testdata/mix_param_types/postgresql/go/test.sql.go +++ b/internal/endtoend/testdata/mix_param_types/postgresql/go/test.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: test.sql package querytest diff --git a/internal/endtoend/testdata/mix_param_types/postgresql/schema.sql b/internal/endtoend/testdata/mix_param_types/postgresql/schema.sql new file mode 100644 index 0000000000..9e554c159e --- /dev/null +++ b/internal/endtoend/testdata/mix_param_types/postgresql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE bar ( + id serial not null, + name text not null, + phone text not null +); \ No newline at end of file diff --git a/internal/endtoend/testdata/mix_param_types/postgresql/sqlc.json b/internal/endtoend/testdata/mix_param_types/postgresql/sqlc.json index dfd2f59a26..2bb3f0dcff 100644 --- a/internal/endtoend/testdata/mix_param_types/postgresql/sqlc.json +++ b/internal/endtoend/testdata/mix_param_types/postgresql/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "test.sql", + "schema": "schema.sql", "queries": "test.sql", "engine": "postgresql" } diff --git a/internal/endtoend/testdata/mix_param_types/postgresql/test.sql b/internal/endtoend/testdata/mix_param_types/postgresql/test.sql index 411f99829f..6811d1f136 100644 --- a/internal/endtoend/testdata/mix_param_types/postgresql/test.sql +++ b/internal/endtoend/testdata/mix_param_types/postgresql/test.sql @@ -1,9 +1,3 @@ -CREATE TABLE bar ( - id serial not null, - name text not null, - phone text not null -); - -- name: CountOne :one SELECT count(1) FROM bar WHERE id = sqlc.arg(id) AND name <> $1 LIMIT sqlc.arg('limit'); diff --git a/internal/endtoend/testdata/multidimension_array/pgx/v4/go/db.go b/internal/endtoend/testdata/multidimension_array/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/multidimension_array/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/multidimension_array/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/multidimension_array/pgx/v4/go/models.go b/internal/endtoend/testdata/multidimension_array/pgx/v4/go/models.go index 215284a5d8..8c3cca3813 100644 --- a/internal/endtoend/testdata/multidimension_array/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/multidimension_array/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { Tags [][]string } diff --git a/internal/endtoend/testdata/multidimension_array/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/multidimension_array/pgx/v4/go/query.sql.go index 2c2e257146..62e96a3e2f 100644 --- a/internal/endtoend/testdata/multidimension_array/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/multidimension_array/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/multidimension_array/pgx/v4/query.sql b/internal/endtoend/testdata/multidimension_array/pgx/v4/query.sql index 29a4bdbc4a..4c6b35329a 100644 --- a/internal/endtoend/testdata/multidimension_array/pgx/v4/query.sql +++ b/internal/endtoend/testdata/multidimension_array/pgx/v4/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE bar (tags text[][] not null); - -- name: TextArray :many SELECT * FROM bar; diff --git a/internal/endtoend/testdata/multidimension_array/pgx/v4/schema.sql b/internal/endtoend/testdata/multidimension_array/pgx/v4/schema.sql new file mode 100644 index 0000000000..d11d4bdfb6 --- /dev/null +++ b/internal/endtoend/testdata/multidimension_array/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (tags text[][] not null); + diff --git a/internal/endtoend/testdata/multidimension_array/pgx/v4/sqlc.json b/internal/endtoend/testdata/multidimension_array/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/multidimension_array/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/multidimension_array/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/multidimension_array/pgx/v5/go/db.go b/internal/endtoend/testdata/multidimension_array/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/multidimension_array/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/multidimension_array/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/multidimension_array/pgx/v5/go/models.go b/internal/endtoend/testdata/multidimension_array/pgx/v5/go/models.go index 215284a5d8..8c3cca3813 100644 --- a/internal/endtoend/testdata/multidimension_array/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/multidimension_array/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { Tags [][]string } diff --git a/internal/endtoend/testdata/multidimension_array/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/multidimension_array/pgx/v5/go/query.sql.go index 2c2e257146..62e96a3e2f 100644 --- a/internal/endtoend/testdata/multidimension_array/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/multidimension_array/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/multidimension_array/pgx/v5/query.sql b/internal/endtoend/testdata/multidimension_array/pgx/v5/query.sql index 29a4bdbc4a..4c6b35329a 100644 --- a/internal/endtoend/testdata/multidimension_array/pgx/v5/query.sql +++ b/internal/endtoend/testdata/multidimension_array/pgx/v5/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE bar (tags text[][] not null); - -- name: TextArray :many SELECT * FROM bar; diff --git a/internal/endtoend/testdata/multidimension_array/pgx/v5/schema.sql b/internal/endtoend/testdata/multidimension_array/pgx/v5/schema.sql new file mode 100644 index 0000000000..d11d4bdfb6 --- /dev/null +++ b/internal/endtoend/testdata/multidimension_array/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (tags text[][] not null); + diff --git a/internal/endtoend/testdata/multidimension_array/pgx/v5/sqlc.json b/internal/endtoend/testdata/multidimension_array/pgx/v5/sqlc.json index 65ee88ef90..d5f0a3ddb1 100644 --- a/internal/endtoend/testdata/multidimension_array/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/multidimension_array/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/multidimension_array/stdlib/go/db.go b/internal/endtoend/testdata/multidimension_array/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/multidimension_array/stdlib/go/db.go +++ b/internal/endtoend/testdata/multidimension_array/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/multidimension_array/stdlib/go/models.go b/internal/endtoend/testdata/multidimension_array/stdlib/go/models.go index 215284a5d8..8c3cca3813 100644 --- a/internal/endtoend/testdata/multidimension_array/stdlib/go/models.go +++ b/internal/endtoend/testdata/multidimension_array/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { Tags [][]string } diff --git a/internal/endtoend/testdata/multidimension_array/stdlib/go/query.sql.go b/internal/endtoend/testdata/multidimension_array/stdlib/go/query.sql.go index cef04840c1..67d3ebc82e 100644 --- a/internal/endtoend/testdata/multidimension_array/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/multidimension_array/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/multidimension_array/stdlib/query.sql b/internal/endtoend/testdata/multidimension_array/stdlib/query.sql index 29a4bdbc4a..4c6b35329a 100644 --- a/internal/endtoend/testdata/multidimension_array/stdlib/query.sql +++ b/internal/endtoend/testdata/multidimension_array/stdlib/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE bar (tags text[][] not null); - -- name: TextArray :many SELECT * FROM bar; diff --git a/internal/endtoend/testdata/multidimension_array/stdlib/schema.sql b/internal/endtoend/testdata/multidimension_array/stdlib/schema.sql new file mode 100644 index 0000000000..d11d4bdfb6 --- /dev/null +++ b/internal/endtoend/testdata/multidimension_array/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (tags text[][] not null); + diff --git a/internal/endtoend/testdata/multidimension_array/stdlib/sqlc.json b/internal/endtoend/testdata/multidimension_array/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/multidimension_array/stdlib/sqlc.json +++ b/internal/endtoend/testdata/multidimension_array/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/multischema/pgx/v4/go/db.go b/internal/endtoend/testdata/multischema/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/multischema/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/multischema/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/multischema/pgx/v4/go/models.go b/internal/endtoend/testdata/multischema/pgx/v4/go/models.go index 97645ef1cc..8594c6e575 100644 --- a/internal/endtoend/testdata/multischema/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/multischema/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/multischema/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/multischema/pgx/v4/go/query.sql.go index bcdded6731..ed5475c882 100644 --- a/internal/endtoend/testdata/multischema/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/multischema/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/multischema/pgx/v5/go/db.go b/internal/endtoend/testdata/multischema/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/multischema/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/multischema/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/multischema/pgx/v5/go/models.go b/internal/endtoend/testdata/multischema/pgx/v5/go/models.go index dd2bbebe37..c7e5e6a8d0 100644 --- a/internal/endtoend/testdata/multischema/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/multischema/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/multischema/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/multischema/pgx/v5/go/query.sql.go index bcdded6731..ed5475c882 100644 --- a/internal/endtoend/testdata/multischema/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/multischema/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/multischema/stdlib/go/db.go b/internal/endtoend/testdata/multischema/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/multischema/stdlib/go/db.go +++ b/internal/endtoend/testdata/multischema/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/multischema/stdlib/go/models.go b/internal/endtoend/testdata/multischema/stdlib/go/models.go index 97645ef1cc..8594c6e575 100644 --- a/internal/endtoend/testdata/multischema/stdlib/go/models.go +++ b/internal/endtoend/testdata/multischema/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/multischema/stdlib/go/query.sql.go b/internal/endtoend/testdata/multischema/stdlib/go/query.sql.go index 3a26f2c45e..3d3efab77e 100644 --- a/internal/endtoend/testdata/multischema/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/multischema/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/mysql_default_value/mysql/go/db.go b/internal/endtoend/testdata/mysql_default_value/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/mysql_default_value/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/mysql_default_value/mysql/go/models.go b/internal/endtoend/testdata/mysql_default_value/mysql/go/models.go new file mode 100644 index 0000000000..2db334d743 --- /dev/null +++ b/internal/endtoend/testdata/mysql_default_value/mysql/go/models.go @@ -0,0 +1,12 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Author struct { + ID int32 + Name string + Bio string + Explanation string +} diff --git a/internal/endtoend/testdata/mysql_default_value/mysql/go/query.sql.go b/internal/endtoend/testdata/mysql_default_value/mysql/go/query.sql.go new file mode 100644 index 0000000000..2b59679ee3 --- /dev/null +++ b/internal/endtoend/testdata/mysql_default_value/mysql/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectAuthor = `-- name: SelectAuthor :many +SELECT id, name, bio, explanation FROM authors +` + +func (q *Queries) SelectAuthor(ctx context.Context) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, selectAuthor) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan( + &i.ID, + &i.Name, + &i.Bio, + &i.Explanation, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/mysql_default_value/mysql/query.sql b/internal/endtoend/testdata/mysql_default_value/mysql/query.sql new file mode 100644 index 0000000000..00b1f3c460 --- /dev/null +++ b/internal/endtoend/testdata/mysql_default_value/mysql/query.sql @@ -0,0 +1,2 @@ +-- name: SelectAuthor :many +SELECT * FROM authors; diff --git a/internal/endtoend/testdata/mysql_default_value/mysql/schema.sql b/internal/endtoend/testdata/mysql_default_value/mysql/schema.sql new file mode 100644 index 0000000000..be6634420d --- /dev/null +++ b/internal/endtoend/testdata/mysql_default_value/mysql/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE authors ( + id INT PRIMARY KEY, + name text NOT NULL, + bio text NOT NULL +); + +ALTER TABLE authors ADD COLUMN explanation text NOT NULL DEFAULT (''); diff --git a/internal/endtoend/testdata/mysql_default_value/mysql/sqlc.json b/internal/endtoend/testdata/mysql_default_value/mysql/sqlc.json new file mode 100644 index 0000000000..7dabfeef72 --- /dev/null +++ b/internal/endtoend/testdata/mysql_default_value/mysql/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "sql_package": "database/sql", + "sql_driver": "github.com/go-sql-driver/mysql", + "engine": "mysql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/db.go b/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/db.go index c115594430..ddfc73984f 100644 --- a/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/db.go +++ b/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package aggregate_functions diff --git a/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/group_concat.sql.go b/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/group_concat.sql.go index 3495f54675..9e1e338714 100644 --- a/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/group_concat.sql.go +++ b/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/group_concat.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: group_concat.sql package aggregate_functions diff --git a/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/models.go b/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/models.go index 56e88d9d8d..06e67d8176 100644 --- a/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/models.go +++ b/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package aggregate_functions @@ -10,5 +10,5 @@ import ( type Student struct { StudentName sql.NullString - Score sql.NullFloat64 + TestScore sql.NullFloat64 } diff --git a/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/group_concat.sql b/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/group_concat.sql index f1858e42fd..443253851d 100644 --- a/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/group_concat.sql +++ b/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/group_concat.sql @@ -1,8 +1,3 @@ -CREATE TABLE student ( - student_name VARCHAR(255), - score DOUBLE -); - -- name: GroupConcat :many SELECT student_name, GROUP_CONCAT(test_score) FROM student diff --git a/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/date_add.sql.go b/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/date_add.sql.go index 9596528638..9bc096b936 100644 --- a/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/date_add.sql.go +++ b/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/date_add.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: date_add.sql package date_and_time_functions diff --git a/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/date_sub.sql.go b/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/date_sub.sql.go index 154d157277..377778fa75 100644 --- a/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/date_sub.sql.go +++ b/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/date_sub.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: date_sub.sql package date_and_time_functions diff --git a/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/db.go b/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/db.go index 3e306e6605..9606d2d4af 100644 --- a/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/db.go +++ b/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package date_and_time_functions diff --git a/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/models.go b/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/models.go index 6ad4972129..9cda7d328c 100644 --- a/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/models.go +++ b/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/models.go @@ -1,7 +1,14 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package date_and_time_functions -import () +import ( + "database/sql" +) + +type Student struct { + StudentName sql.NullString + TestScore sql.NullFloat64 +} diff --git a/internal/endtoend/testdata/mysql_reference_manual/schema.sql b/internal/endtoend/testdata/mysql_reference_manual/schema.sql new file mode 100644 index 0000000000..5dcef48427 --- /dev/null +++ b/internal/endtoend/testdata/mysql_reference_manual/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE student ( + student_name VARCHAR(255), + test_score DOUBLE +); diff --git a/internal/endtoend/testdata/mysql_reference_manual/sqlc.json b/internal/endtoend/testdata/mysql_reference_manual/sqlc.json index 26e8643999..71c8ff5aa8 100644 --- a/internal/endtoend/testdata/mysql_reference_manual/sqlc.json +++ b/internal/endtoend/testdata/mysql_reference_manual/sqlc.json @@ -4,14 +4,14 @@ { "name": "date_and_time_functions", "path": "date_and_time_functions/go", - "schema": "date_and_time_functions", + "schema": "schema.sql", "queries": "date_and_time_functions", "engine": "mysql" }, { "name": "aggregate_functions", "path": "aggregate_functions/go", - "schema": "aggregate_functions", + "schema": "schema.sql", "queries": "aggregate_functions", "engine": "mysql" } diff --git a/internal/endtoend/testdata/mysql_vector/mysql/go/db.go b/internal/endtoend/testdata/mysql_vector/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/mysql_vector/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/mysql_vector/mysql/go/models.go b/internal/endtoend/testdata/mysql_vector/mysql/go/models.go new file mode 100644 index 0000000000..d0a2f2e91d --- /dev/null +++ b/internal/endtoend/testdata/mysql_vector/mysql/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Foo struct { + ID int32 + Embedding interface{} +} diff --git a/internal/endtoend/testdata/mysql_vector/mysql/go/query.sql.go b/internal/endtoend/testdata/mysql_vector/mysql/go/query.sql.go new file mode 100644 index 0000000000..8ac54a83c4 --- /dev/null +++ b/internal/endtoend/testdata/mysql_vector/mysql/go/query.sql.go @@ -0,0 +1,48 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const insertVector = `-- name: InsertVector :exec +INSERT INTO foo(embedding) VALUES (STRING_TO_VECTOR('[0.1, 0.2, 0.3, 0.4]')) +` + +func (q *Queries) InsertVector(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, insertVector) + return err +} + +const selectVector = `-- name: SelectVector :many +SELECT id FROM foo +ORDER BY DISTANCE(STRING_TO_VECTOR('[1.2, 3.4, 5.6]'), embedding, 'L2_squared') +LIMIT 10 +` + +func (q *Queries) SelectVector(ctx context.Context) ([]int32, error) { + rows, err := q.db.QueryContext(ctx, selectVector) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var id int32 + if err := rows.Scan(&id); err != nil { + return nil, err + } + items = append(items, id) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/mysql_vector/mysql/query.sql b/internal/endtoend/testdata/mysql_vector/mysql/query.sql new file mode 100644 index 0000000000..358d69129f --- /dev/null +++ b/internal/endtoend/testdata/mysql_vector/mysql/query.sql @@ -0,0 +1,7 @@ +-- name: InsertVector :exec +INSERT INTO foo(embedding) VALUES (STRING_TO_VECTOR('[0.1, 0.2, 0.3, 0.4]')); + +-- name: SelectVector :many +SELECT id FROM foo +ORDER BY DISTANCE(STRING_TO_VECTOR('[1.2, 3.4, 5.6]'), embedding, 'L2_squared') +LIMIT 10; diff --git a/internal/endtoend/testdata/mysql_vector/mysql/schema.sql b/internal/endtoend/testdata/mysql_vector/mysql/schema.sql new file mode 100644 index 0000000000..da61ac5682 --- /dev/null +++ b/internal/endtoend/testdata/mysql_vector/mysql/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE foo( + id INT PRIMARY KEY auto_increment, + embedding VECTOR(4) +); diff --git a/internal/endtoend/testdata/mysql_vector/mysql/sqlc.json b/internal/endtoend/testdata/mysql_vector/mysql/sqlc.json new file mode 100644 index 0000000000..7dabfeef72 --- /dev/null +++ b/internal/endtoend/testdata/mysql_vector/mysql/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "sql_package": "database/sql", + "sql_driver": "github.com/go-sql-driver/mysql", + "engine": "mysql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/named_param/pgx/v4/go/db.go b/internal/endtoend/testdata/named_param/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/named_param/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/named_param/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/named_param/pgx/v4/go/models.go b/internal/endtoend/testdata/named_param/pgx/v4/go/models.go index b6afd48cfd..7d01ec0654 100644 --- a/internal/endtoend/testdata/named_param/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/named_param/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Name string Bio string diff --git a/internal/endtoend/testdata/named_param/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/named_param/pgx/v4/go/query.sql.go index ca87cb1886..a6e9fe3018 100644 --- a/internal/endtoend/testdata/named_param/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/named_param/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/named_param/pgx/v4/query.sql b/internal/endtoend/testdata/named_param/pgx/v4/query.sql index ae58c40879..9a2c906b98 100644 --- a/internal/endtoend/testdata/named_param/pgx/v4/query.sql +++ b/internal/endtoend/testdata/named_param/pgx/v4/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (name text not null, bio text not null); - -- name: FuncParams :many SELECT name FROM foo WHERE name = sqlc.arg('slug') AND sqlc.arg(filter)::bool; diff --git a/internal/endtoend/testdata/named_param/pgx/v4/schema.sql b/internal/endtoend/testdata/named_param/pgx/v4/schema.sql new file mode 100644 index 0000000000..b4050d187b --- /dev/null +++ b/internal/endtoend/testdata/named_param/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null, bio text not null); + diff --git a/internal/endtoend/testdata/named_param/pgx/v4/sqlc.json b/internal/endtoend/testdata/named_param/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/named_param/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/named_param/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/named_param/pgx/v5/go/db.go b/internal/endtoend/testdata/named_param/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/named_param/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/named_param/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/named_param/pgx/v5/go/models.go b/internal/endtoend/testdata/named_param/pgx/v5/go/models.go index b6afd48cfd..7d01ec0654 100644 --- a/internal/endtoend/testdata/named_param/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/named_param/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Name string Bio string diff --git a/internal/endtoend/testdata/named_param/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/named_param/pgx/v5/go/query.sql.go index ca87cb1886..a6e9fe3018 100644 --- a/internal/endtoend/testdata/named_param/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/named_param/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/named_param/pgx/v5/query.sql b/internal/endtoend/testdata/named_param/pgx/v5/query.sql index ae58c40879..9a2c906b98 100644 --- a/internal/endtoend/testdata/named_param/pgx/v5/query.sql +++ b/internal/endtoend/testdata/named_param/pgx/v5/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (name text not null, bio text not null); - -- name: FuncParams :many SELECT name FROM foo WHERE name = sqlc.arg('slug') AND sqlc.arg(filter)::bool; diff --git a/internal/endtoend/testdata/named_param/pgx/v5/schema.sql b/internal/endtoend/testdata/named_param/pgx/v5/schema.sql new file mode 100644 index 0000000000..b4050d187b --- /dev/null +++ b/internal/endtoend/testdata/named_param/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null, bio text not null); + diff --git a/internal/endtoend/testdata/named_param/pgx/v5/sqlc.json b/internal/endtoend/testdata/named_param/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/named_param/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/named_param/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/named_param/sqlite/go/db.go b/internal/endtoend/testdata/named_param/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/named_param/sqlite/go/db.go +++ b/internal/endtoend/testdata/named_param/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/named_param/sqlite/go/models.go b/internal/endtoend/testdata/named_param/sqlite/go/models.go index b6afd48cfd..7d01ec0654 100644 --- a/internal/endtoend/testdata/named_param/sqlite/go/models.go +++ b/internal/endtoend/testdata/named_param/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Name string Bio string diff --git a/internal/endtoend/testdata/named_param/sqlite/go/query.sql.go b/internal/endtoend/testdata/named_param/sqlite/go/query.sql.go index 4201e60618..f08b57bc1d 100644 --- a/internal/endtoend/testdata/named_param/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/named_param/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/named_param/sqlite/query.sql b/internal/endtoend/testdata/named_param/sqlite/query.sql index ef9d179b88..7e19464c4f 100644 --- a/internal/endtoend/testdata/named_param/sqlite/query.sql +++ b/internal/endtoend/testdata/named_param/sqlite/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (name text not null, bio text not null); - -- name: FuncParams :many SELECT name FROM foo WHERE name = sqlc.arg('slug'); diff --git a/internal/endtoend/testdata/named_param/sqlite/schema.sql b/internal/endtoend/testdata/named_param/sqlite/schema.sql new file mode 100644 index 0000000000..b4050d187b --- /dev/null +++ b/internal/endtoend/testdata/named_param/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null, bio text not null); + diff --git a/internal/endtoend/testdata/named_param/sqlite/sqlc.json b/internal/endtoend/testdata/named_param/sqlite/sqlc.json index bcf1050428..cd66df063b 100644 --- a/internal/endtoend/testdata/named_param/sqlite/sqlc.json +++ b/internal/endtoend/testdata/named_param/sqlite/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "sqlite", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/named_param/stdlib/go/db.go b/internal/endtoend/testdata/named_param/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/named_param/stdlib/go/db.go +++ b/internal/endtoend/testdata/named_param/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/named_param/stdlib/go/models.go b/internal/endtoend/testdata/named_param/stdlib/go/models.go index b6afd48cfd..7d01ec0654 100644 --- a/internal/endtoend/testdata/named_param/stdlib/go/models.go +++ b/internal/endtoend/testdata/named_param/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Name string Bio string diff --git a/internal/endtoend/testdata/named_param/stdlib/go/query.sql.go b/internal/endtoend/testdata/named_param/stdlib/go/query.sql.go index 32b8b14611..0d66297a35 100644 --- a/internal/endtoend/testdata/named_param/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/named_param/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/named_param/stdlib/query.sql b/internal/endtoend/testdata/named_param/stdlib/query.sql index ae58c40879..9a2c906b98 100644 --- a/internal/endtoend/testdata/named_param/stdlib/query.sql +++ b/internal/endtoend/testdata/named_param/stdlib/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (name text not null, bio text not null); - -- name: FuncParams :many SELECT name FROM foo WHERE name = sqlc.arg('slug') AND sqlc.arg(filter)::bool; diff --git a/internal/endtoend/testdata/named_param/stdlib/schema.sql b/internal/endtoend/testdata/named_param/stdlib/schema.sql new file mode 100644 index 0000000000..b4050d187b --- /dev/null +++ b/internal/endtoend/testdata/named_param/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null, bio text not null); + diff --git a/internal/endtoend/testdata/named_param/stdlib/sqlc.json b/internal/endtoend/testdata/named_param/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/named_param/stdlib/sqlc.json +++ b/internal/endtoend/testdata/named_param/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/nested_select/issue.md b/internal/endtoend/testdata/nested_select/issue.md new file mode 100644 index 0000000000..2c10d6d8fe --- /dev/null +++ b/internal/endtoend/testdata/nested_select/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/708 diff --git a/internal/endtoend/testdata/nested_select/postgresql/pgx/exec.json b/internal/endtoend/testdata/nested_select/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/nested_select/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/nested_select/postgresql/pgx/go/db.go b/internal/endtoend/testdata/nested_select/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/nested_select/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/nested_select/postgresql/pgx/go/models.go b/internal/endtoend/testdata/nested_select/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..b3f22ae1ba --- /dev/null +++ b/internal/endtoend/testdata/nested_select/postgresql/pgx/go/models.go @@ -0,0 +1,11 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Test struct { + ID int64 + UpdateTime int64 + Count int64 +} diff --git a/internal/endtoend/testdata/nested_select/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/nested_select/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..06698dbad4 --- /dev/null +++ b/internal/endtoend/testdata/nested_select/postgresql/pgx/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const nestedSelect = `-- name: NestedSelect :one +SELECT latest.id, t.count +FROM ( + SELECT id, max(update_time) AS update_time + FROM test + WHERE id = ANY ($1::bigint[]) + -- ERROR HERE on update_time + AND update_time >= $2 + GROUP BY id +) latest +INNER JOIN test t USING (id, update_time) +` + +type NestedSelectParams struct { + IDs []int64 + StartTime pgtype.Int8 +} + +type NestedSelectRow struct { + ID int64 + Count int64 +} + +func (q *Queries) NestedSelect(ctx context.Context, arg NestedSelectParams) (NestedSelectRow, error) { + row := q.db.QueryRow(ctx, nestedSelect, arg.IDs, arg.StartTime) + var i NestedSelectRow + err := row.Scan(&i.ID, &i.Count) + return i, err +} diff --git a/internal/endtoend/testdata/nested_select/postgresql/pgx/query.sql b/internal/endtoend/testdata/nested_select/postgresql/pgx/query.sql new file mode 100644 index 0000000000..755521fa4a --- /dev/null +++ b/internal/endtoend/testdata/nested_select/postgresql/pgx/query.sql @@ -0,0 +1,11 @@ +-- name: NestedSelect :one +SELECT latest.id, t.count +FROM ( + SELECT id, max(update_time) AS update_time + FROM test + WHERE id = ANY (sqlc.arg('IDs')::bigint[]) + -- ERROR HERE on update_time + AND update_time >= sqlc.arg('StartTime') + GROUP BY id +) latest +INNER JOIN test t USING (id, update_time); diff --git a/internal/endtoend/testdata/nested_select/postgresql/pgx/schema.sql b/internal/endtoend/testdata/nested_select/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..02f5f8203c --- /dev/null +++ b/internal/endtoend/testdata/nested_select/postgresql/pgx/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE test ( + id bigint NOT NULL, + update_time bigint NOT NULL, + count bigint NOT NULL +); diff --git a/internal/endtoend/testdata/nested_select/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/nested_select/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..2f12715923 --- /dev/null +++ b/internal/endtoend/testdata/nested_select/postgresql/pgx/sqlc.yaml @@ -0,0 +1,14 @@ +version: "2" +cloud: + project: "01HAQMMECEYQYKFJN8MP16QC41" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" + database: + managed: true diff --git a/internal/endtoend/testdata/nextval/postgresql/go/db.go b/internal/endtoend/testdata/nextval/postgresql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/nextval/postgresql/go/db.go +++ b/internal/endtoend/testdata/nextval/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/nextval/postgresql/go/models.go b/internal/endtoend/testdata/nextval/postgresql/go/models.go index 7f98a929b3..c48d0a0de2 100644 --- a/internal/endtoend/testdata/nextval/postgresql/go/models.go +++ b/internal/endtoend/testdata/nextval/postgresql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Author struct { ID int64 } diff --git a/internal/endtoend/testdata/nextval/postgresql/go/query.sql.go b/internal/endtoend/testdata/nextval/postgresql/go/query.sql.go index d2e95f955a..6ea5eba838 100644 --- a/internal/endtoend/testdata/nextval/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/nextval/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/nextval/postgresql/query.sql b/internal/endtoend/testdata/nextval/postgresql/query.sql index 13f6c947ec..606ac1eb0a 100644 --- a/internal/endtoend/testdata/nextval/postgresql/query.sql +++ b/internal/endtoend/testdata/nextval/postgresql/query.sql @@ -1,8 +1,3 @@ --- Simple table -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY -); - -- name: GetNextID :one SELECT pk, pk FROM (SELECT nextval('authors_id_seq') as pk) AS alias; diff --git a/internal/endtoend/testdata/nextval/postgresql/schema.sql b/internal/endtoend/testdata/nextval/postgresql/schema.sql new file mode 100644 index 0000000000..2ab37c05c5 --- /dev/null +++ b/internal/endtoend/testdata/nextval/postgresql/schema.sql @@ -0,0 +1,5 @@ +-- Simple table +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY +); + diff --git a/internal/endtoend/testdata/nextval/postgresql/sqlc.json b/internal/endtoend/testdata/nextval/postgresql/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/nextval/postgresql/sqlc.json +++ b/internal/endtoend/testdata/nextval/postgresql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/query.sql.go index b813bcaec4..c2f9fa6a26 100644 --- a/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/null_if_type/issue.md b/internal/endtoend/testdata/null_if_type/issue.md new file mode 100644 index 0000000000..c83cc42660 --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/133 diff --git a/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/db/db.go b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/db/db.go new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/db/models.go b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/db/models.go new file mode 100644 index 0000000000..8074a524af --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/db/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +type Author struct { + ID int64 +} diff --git a/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/db/query.sql.go b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/db/query.sql.go new file mode 100644 index 0000000000..4256706b67 --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/db/query.sql.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" +) + +const getRestrictedId = `-- name: GetRestrictedId :one +SELECT + NULLIF(id, $1) restricted_id +FROM + author +` + +func (q *Queries) GetRestrictedId(ctx context.Context, id int64) (int64, error) { + row := q.db.QueryRowContext(ctx, getRestrictedId, id) + var restricted_id int64 + err := row.Scan(&restricted_id) + return restricted_id, err +} diff --git a/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/exec.json b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/query.sql b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/query.sql new file mode 100644 index 0000000000..fc800b4f6d --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/query.sql @@ -0,0 +1,5 @@ +-- name: GetRestrictedId :one +SELECT + NULLIF(id, $1) restricted_id +FROM + author; diff --git a/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/schema.sql b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/schema.sql new file mode 100644 index 0000000000..c1afecad09 --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE author ( + id bigserial NOT NULL +); diff --git a/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/sqlc.json b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/sqlc.json new file mode 100644 index 0000000000..a682c52d42 --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "db", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} + diff --git a/internal/endtoend/testdata/null_if_type/postgresql/stdlib/db/db.go b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/db/db.go new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/null_if_type/postgresql/stdlib/db/models.go b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/db/models.go new file mode 100644 index 0000000000..8074a524af --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/db/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +type Author struct { + ID int64 +} diff --git a/internal/endtoend/testdata/null_if_type/postgresql/stdlib/db/query.sql.go b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/db/query.sql.go new file mode 100644 index 0000000000..f22d8f38bf --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/db/query.sql.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" +) + +const getRestrictedId = `-- name: GetRestrictedId :one +SELECT + NULLIF(id, $1) restricted_id +FROM + author +` + +func (q *Queries) GetRestrictedId(ctx context.Context, id int64) (bool, error) { + row := q.db.QueryRowContext(ctx, getRestrictedId, id) + var restricted_id bool + err := row.Scan(&restricted_id) + return restricted_id, err +} diff --git a/internal/endtoend/testdata/null_if_type/postgresql/stdlib/exec.json b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/null_if_type/postgresql/stdlib/query.sql b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..fc800b4f6d --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/query.sql @@ -0,0 +1,5 @@ +-- name: GetRestrictedId :one +SELECT + NULLIF(id, $1) restricted_id +FROM + author; diff --git a/internal/endtoend/testdata/null_if_type/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..c1afecad09 --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE author ( + id bigserial NOT NULL +); diff --git a/internal/endtoend/testdata/null_if_type/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..a682c52d42 --- /dev/null +++ b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "db", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} + diff --git a/internal/endtoend/testdata/omit_sqlc_version/db/db.go b/internal/endtoend/testdata/omit_sqlc_version/db/db.go new file mode 100644 index 0000000000..c3c034ae37 --- /dev/null +++ b/internal/endtoend/testdata/omit_sqlc_version/db/db.go @@ -0,0 +1,29 @@ +// Code generated by sqlc. DO NOT EDIT. + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/omit_sqlc_version/db/models.go b/internal/endtoend/testdata/omit_sqlc_version/db/models.go new file mode 100644 index 0000000000..3bc48237ef --- /dev/null +++ b/internal/endtoend/testdata/omit_sqlc_version/db/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. + +package db + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/omit_sqlc_version/db/query.sql.go b/internal/endtoend/testdata/omit_sqlc_version/db/query.sql.go new file mode 100644 index 0000000000..147cb4b15c --- /dev/null +++ b/internal/endtoend/testdata/omit_sqlc_version/db/query.sql.go @@ -0,0 +1,80 @@ +// Code generated by sqlc. DO NOT EDIT. +// source: query.sql + +package db + +import ( + "context" + "database/sql" +) + +const createAuthor = `-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +RETURNING id, name, bio +` + +type CreateAuthorParams struct { + Name string + Bio sql.NullString +} + +func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { + row := q.db.QueryRowContext(ctx, createAuthor, arg.Name, arg.Bio) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} + +const deleteAuthor = `-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = $1 +` + +func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { + _, err := q.db.ExecContext(ctx, deleteAuthor, id) + return err +} + +const getAuthor = `-- name: GetAuthor :one +SELECT id, name, bio FROM authors +WHERE id = $1 LIMIT 1 +` + +func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { + row := q.db.QueryRowContext(ctx, getAuthor, id) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name, bio FROM authors +ORDER BY name +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan(&i.ID, &i.Name, &i.Bio); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/omit_sqlc_version/query.sql b/internal/endtoend/testdata/omit_sqlc_version/query.sql new file mode 100644 index 0000000000..971b8f902d --- /dev/null +++ b/internal/endtoend/testdata/omit_sqlc_version/query.sql @@ -0,0 +1,19 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = $1 LIMIT 1; + +-- name: ListAuthors :many +SELECT * FROM authors +ORDER BY name; + +-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +RETURNING *; + +-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = $1; diff --git a/internal/endtoend/testdata/omit_sqlc_version/schema.sql b/internal/endtoend/testdata/omit_sqlc_version/schema.sql new file mode 100644 index 0000000000..69b607d902 --- /dev/null +++ b/internal/endtoend/testdata/omit_sqlc_version/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/omit_sqlc_version/sqlc.json b/internal/endtoend/testdata/omit_sqlc_version/sqlc.json new file mode 100644 index 0000000000..f86d2b7b9d --- /dev/null +++ b/internal/endtoend/testdata/omit_sqlc_version/sqlc.json @@ -0,0 +1,15 @@ +{ + "version": "2", + "sql": [{ + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "gen": { + "go": { + "out": "db", + "omit_sqlc_version": true + } + } + }] +} + diff --git a/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/db.go index 3d2b5bf3a3..cd5bbb8e08 100644 --- a/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/models.go index b1624997b9..4f415e7078 100644 --- a/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db @@ -9,6 +9,48 @@ import ( "fmt" ) +type ArrayEnum string + +const ( + ArrayEnumO ArrayEnum = "o" + ArrayEnumP ArrayEnum = "p" +) + +func (e *ArrayEnum) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = ArrayEnum(s) + case string: + *e = ArrayEnum(s) + default: + return fmt.Errorf("unsupported scan type for ArrayEnum: %T", src) + } + return nil +} + +type NullArrayEnum struct { + ArrayEnum ArrayEnum + Valid bool // Valid is true if ArrayEnum is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullArrayEnum) Scan(value interface{}) error { + if value == nil { + ns.ArrayEnum, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.ArrayEnum.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullArrayEnum) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.ArrayEnum), nil +} + type QueryParamEnumTableEnum string const ( @@ -219,6 +261,53 @@ func (ns NullQueryReturnStructEnumTableEnum) Value() (driver.Value, error) { return string(ns.QueryReturnStructEnumTableEnum), nil } +type QuerySqlcEmbedEnum string + +const ( + QuerySqlcEmbedEnumM QuerySqlcEmbedEnum = "m" + QuerySqlcEmbedEnumN QuerySqlcEmbedEnum = "n" +) + +func (e *QuerySqlcEmbedEnum) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = QuerySqlcEmbedEnum(s) + case string: + *e = QuerySqlcEmbedEnum(s) + default: + return fmt.Errorf("unsupported scan type for QuerySqlcEmbedEnum: %T", src) + } + return nil +} + +type NullQuerySqlcEmbedEnum struct { + QuerySqlcEmbedEnum QuerySqlcEmbedEnum + Valid bool // Valid is true if QuerySqlcEmbedEnum is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullQuerySqlcEmbedEnum) Scan(value interface{}) error { + if value == nil { + ns.QuerySqlcEmbedEnum, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.QuerySqlcEmbedEnum.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullQuerySqlcEmbedEnum) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.QuerySqlcEmbedEnum), nil +} + +type ArrayEnumTable struct { + ID int32 + Value []ArrayEnum +} + type QueryParamEnumTable struct { ID int32 Other QueryParamEnumTableEnum @@ -229,3 +318,8 @@ type QueryReturnFullTable struct { ID int32 Value NullQueryReturnFullTableEnum } + +type QuerySqlcEmbedTable struct { + ID int32 + Value NullQuerySqlcEmbedEnum +} diff --git a/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/query.sql.go index f659102696..ac93669dd0 100644 --- a/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package db @@ -8,8 +8,37 @@ package db import ( "context" "database/sql" + + "github.com/lib/pq" ) +const query_enum_array_table = `-- name: query_enum_array_table :many +SELECT id, value FROM array_enum_table +` + +func (q *Queries) query_enum_array_table(ctx context.Context) ([]ArrayEnumTable, error) { + rows, err := q.db.QueryContext(ctx, query_enum_array_table) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ArrayEnumTable + for rows.Next() { + var i ArrayEnumTable + if err := rows.Scan(&i.ID, pq.Array(&i.Value)); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const query_param_enum_table = `-- name: query_param_enum_table :one SELECT id, other, value FROM query_param_enum_table WHERE value = $1 ` @@ -90,3 +119,18 @@ func (q *Queries) query_return_struct_enum_table(ctx context.Context, id int32) err := row.Scan(&i.Value, &i.Another) return i, err } + +const query_sqlc_embed_table = `-- name: query_sqlc_embed_table :one +SELECT query_sqlc_embed_table.id, query_sqlc_embed_table.value FROM query_sqlc_embed_table WHERE id = $1 +` + +type query_sqlc_embed_tableRow struct { + QuerySqlcEmbedTable QuerySqlcEmbedTable +} + +func (q *Queries) query_sqlc_embed_table(ctx context.Context, id int32) (query_sqlc_embed_tableRow, error) { + row := q.db.QueryRowContext(ctx, query_sqlc_embed_table, id) + var i query_sqlc_embed_tableRow + err := row.Scan(&i.QuerySqlcEmbedTable.ID, &i.QuerySqlcEmbedTable.Value) + return i, err +} diff --git a/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/query.sql b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/query.sql index 1420d869d3..60104c8e9d 100644 --- a/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/query.sql @@ -11,4 +11,10 @@ SELECT id FROM query_param_struct_enum_table WHERE id = $1 AND value = $2; SELECT value FROM query_return_enum_table WHERE id = $1; -- name: query_return_struct_enum_table :one -SELECT value, another FROM query_return_struct_enum_table WHERE id = $1; \ No newline at end of file +SELECT value, another FROM query_return_struct_enum_table WHERE id = $1; + +-- name: query_sqlc_embed_table :one +SELECT sqlc.embed(query_sqlc_embed_table) FROM query_sqlc_embed_table WHERE id = $1; + +-- name: query_enum_array_table :many +SELECT * FROM array_enum_table; diff --git a/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/schema.sql index cc2ae14b28..4ce59218b6 100644 --- a/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/schema.sql +++ b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/schema.sql @@ -50,4 +50,20 @@ CREATE TABLE query_return_struct_enum_table ( id INTEGER PRIMARY KEY, value query_return_struct_enum_table_enum, another INTEGER -); \ No newline at end of file +); + +CREATE TYPE query_sqlc_embed_enum AS ENUM ( + 'm', 'n' +); +CREATE TABLE query_sqlc_embed_table ( + id INTEGER PRIMARY KEY, + value query_sqlc_embed_enum +); + +CREATE TYPE array_enum AS ENUM ( + 'o', 'p' +); +CREATE TABLE array_enum_table ( + id INTEGER PRIMARY KEY, + value array_enum[] +); diff --git a/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/db.go b/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/db.go index 3d2b5bf3a3..cd5bbb8e08 100644 --- a/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/db.go +++ b/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/models.go b/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/models.go index f8bcd76317..5041799d54 100644 --- a/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/models.go +++ b/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/query.sql.go b/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/query.sql.go index 4400e71026..367c21685e 100644 --- a/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/query.sql.go +++ b/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package db diff --git a/internal/endtoend/testdata/on_duplicate_key_update/mysql/query.sql b/internal/endtoend/testdata/on_duplicate_key_update/mysql/query.sql index 07923d53fa..7c54c4377a 100644 --- a/internal/endtoend/testdata/on_duplicate_key_update/mysql/query.sql +++ b/internal/endtoend/testdata/on_duplicate_key_update/mysql/query.sql @@ -1,11 +1,3 @@ --- https://github.com/sqlc-dev/sqlc/issues/921 -CREATE TABLE authors ( - id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, - name text NOT NULL, - bio text, - UNIQUE(name) -); - -- name: UpsertAuthor :exec INSERT INTO authors (name, bio) VALUES (?, ?) diff --git a/internal/endtoend/testdata/on_duplicate_key_update/mysql/schema.sql b/internal/endtoend/testdata/on_duplicate_key_update/mysql/schema.sql new file mode 100644 index 0000000000..581ecfe16b --- /dev/null +++ b/internal/endtoend/testdata/on_duplicate_key_update/mysql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGINT PRIMARY KEY AUTO_INCREMENT, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/on_duplicate_key_update/mysql/sqlc.json b/internal/endtoend/testdata/on_duplicate_key_update/mysql/sqlc.json index 0895d9fa2e..df106217e2 100644 --- a/internal/endtoend/testdata/on_duplicate_key_update/mysql/sqlc.json +++ b/internal/endtoend/testdata/on_duplicate_key_update/mysql/sqlc.json @@ -4,7 +4,7 @@ { "path":"db", "engine":"mysql", - "schema":"query.sql", + "schema":"schema.sql", "queries":"query.sql" } ] diff --git a/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/db.go b/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/db.go index 3d2b5bf3a3..cd5bbb8e08 100644 --- a/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/db.go +++ b/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/models.go b/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/models.go index f8bcd76317..5041799d54 100644 --- a/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/models.go +++ b/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/query.sql.go b/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/query.sql.go index d0daee3d01..8fd1d5c050 100644 --- a/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/query.sql.go +++ b/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package db diff --git a/internal/endtoend/testdata/on_duplicate_key_update/postgresql/query.sql b/internal/endtoend/testdata/on_duplicate_key_update/postgresql/query.sql index 67826c7dfc..ad29e0e517 100644 --- a/internal/endtoend/testdata/on_duplicate_key_update/postgresql/query.sql +++ b/internal/endtoend/testdata/on_duplicate_key_update/postgresql/query.sql @@ -1,10 +1,3 @@ --- https://github.com/sqlc-dev/sqlc/issues/921 -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - name text NOT NULL UNIQUE, - bio text -); - -- name: UpsertAuthor :exec INSERT INTO authors (name, bio) VALUES ($1, $2) diff --git a/internal/endtoend/testdata/on_duplicate_key_update/postgresql/schema.sql b/internal/endtoend/testdata/on_duplicate_key_update/postgresql/schema.sql new file mode 100644 index 0000000000..b4fad78497 --- /dev/null +++ b/internal/endtoend/testdata/on_duplicate_key_update/postgresql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/on_duplicate_key_update/postgresql/sqlc.json b/internal/endtoend/testdata/on_duplicate_key_update/postgresql/sqlc.json index 00a8a0fcfd..58a7ee25ea 100644 --- a/internal/endtoend/testdata/on_duplicate_key_update/postgresql/sqlc.json +++ b/internal/endtoend/testdata/on_duplicate_key_update/postgresql/sqlc.json @@ -4,7 +4,7 @@ { "path":"db", "engine":"postgresql", - "schema":"query.sql", + "schema":"schema.sql", "queries":"query.sql" } ] diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/models.go index 20f64af83c..fe6b295344 100644 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Demo struct { Txt string } diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/query.sql.go index 6b8e361255..9888f6ea6e 100644 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/query.sql.go @@ -1,33 +1,20 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest import ( "context" - "database/sql" ) -const test = `-- name: Test :one -select txt from Demo -where txt ~~ '%' || $1 || '%' -` - -func (q *Queries) Test(ctx context.Context, val string) (string, error) { - row := q.db.QueryRow(ctx, test, val) - var txt string - err := row.Scan(&txt) - return txt, err -} - const test2 = `-- name: Test2 :one select txt from Demo -where txt like '%' || $1 || '%' +where txt like '%' || $1::text || '%' ` -func (q *Queries) Test2(ctx context.Context, val sql.NullString) (string, error) { +func (q *Queries) Test2(ctx context.Context, val string) (string, error) { row := q.db.QueryRow(ctx, test2, val) var txt string err := row.Scan(&txt) @@ -36,10 +23,10 @@ func (q *Queries) Test2(ctx context.Context, val sql.NullString) (string, error) const test3 = `-- name: Test3 :one select txt from Demo -where txt like concat('%', $1, '%') +where txt like concat('%', $1::text, '%') ` -func (q *Queries) Test3(ctx context.Context, val interface{}) (string, error) { +func (q *Queries) Test3(ctx context.Context, val string) (string, error) { row := q.db.QueryRow(ctx, test3, val) var txt string err := row.Scan(&txt) diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/query.sql index 5b794bdf7e..3133d4c299 100644 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/query.sql @@ -1,13 +1,7 @@ -CREATE TABLE demo (txt text not null); - --- name: Test :one -select * from Demo -where txt ~~ '%' || sqlc.arg('val') || '%'; - -- name: Test2 :one select * from Demo -where txt like '%' || sqlc.arg('val') || '%'; +where txt like '%' || sqlc.arg('val')::text || '%'; -- name: Test3 :one select * from Demo -where txt like concat('%', sqlc.arg('val'), '%'); +where txt like concat('%', sqlc.arg('val')::text, '%'); diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..8a50f1b249 --- /dev/null +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE demo (txt text not null); + diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/models.go index 20f64af83c..fe6b295344 100644 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Demo struct { Txt string } diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/query.sql.go index 33d2f3cefc..9888f6ea6e 100644 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/query.sql.go @@ -1,34 +1,20 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest import ( "context" - - "github.com/jackc/pgx/v5/pgtype" ) -const test = `-- name: Test :one -select txt from Demo -where txt ~~ '%' || $1 || '%' -` - -func (q *Queries) Test(ctx context.Context, val string) (string, error) { - row := q.db.QueryRow(ctx, test, val) - var txt string - err := row.Scan(&txt) - return txt, err -} - const test2 = `-- name: Test2 :one select txt from Demo -where txt like '%' || $1 || '%' +where txt like '%' || $1::text || '%' ` -func (q *Queries) Test2(ctx context.Context, val pgtype.Text) (string, error) { +func (q *Queries) Test2(ctx context.Context, val string) (string, error) { row := q.db.QueryRow(ctx, test2, val) var txt string err := row.Scan(&txt) @@ -37,10 +23,10 @@ func (q *Queries) Test2(ctx context.Context, val pgtype.Text) (string, error) { const test3 = `-- name: Test3 :one select txt from Demo -where txt like concat('%', $1, '%') +where txt like concat('%', $1::text, '%') ` -func (q *Queries) Test3(ctx context.Context, val interface{}) (string, error) { +func (q *Queries) Test3(ctx context.Context, val string) (string, error) { row := q.db.QueryRow(ctx, test3, val) var txt string err := row.Scan(&txt) diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/query.sql index 5b794bdf7e..3133d4c299 100644 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/query.sql @@ -1,13 +1,7 @@ -CREATE TABLE demo (txt text not null); - --- name: Test :one -select * from Demo -where txt ~~ '%' || sqlc.arg('val') || '%'; - -- name: Test2 :one select * from Demo -where txt like '%' || sqlc.arg('val') || '%'; +where txt like '%' || sqlc.arg('val')::text || '%'; -- name: Test3 :one select * from Demo -where txt like concat('%', sqlc.arg('val'), '%'); +where txt like concat('%', sqlc.arg('val')::text, '%'); diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..8a50f1b249 --- /dev/null +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE demo (txt text not null); + diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/models.go index 20f64af83c..fe6b295344 100644 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Demo struct { Txt string } diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/query.sql.go index de8b4f6f9c..666e58b093 100644 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/query.sql.go @@ -1,33 +1,20 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest import ( "context" - "database/sql" ) -const test = `-- name: Test :one -select txt from Demo -where txt ~~ '%' || $1 || '%' -` - -func (q *Queries) Test(ctx context.Context, val string) (string, error) { - row := q.db.QueryRowContext(ctx, test, val) - var txt string - err := row.Scan(&txt) - return txt, err -} - const test2 = `-- name: Test2 :one select txt from Demo -where txt like '%' || $1 || '%' +where txt like '%' || $1::text || '%' ` -func (q *Queries) Test2(ctx context.Context, val sql.NullString) (string, error) { +func (q *Queries) Test2(ctx context.Context, val string) (string, error) { row := q.db.QueryRowContext(ctx, test2, val) var txt string err := row.Scan(&txt) @@ -36,10 +23,10 @@ func (q *Queries) Test2(ctx context.Context, val sql.NullString) (string, error) const test3 = `-- name: Test3 :one select txt from Demo -where txt like concat('%', $1, '%') +where txt like concat('%', $1::text, '%') ` -func (q *Queries) Test3(ctx context.Context, val interface{}) (string, error) { +func (q *Queries) Test3(ctx context.Context, val string) (string, error) { row := q.db.QueryRowContext(ctx, test3, val) var txt string err := row.Scan(&txt) diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/query.sql b/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/query.sql index 5b794bdf7e..3133d4c299 100644 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/query.sql @@ -1,13 +1,7 @@ -CREATE TABLE demo (txt text not null); - --- name: Test :one -select * from Demo -where txt ~~ '%' || sqlc.arg('val') || '%'; - -- name: Test2 :one select * from Demo -where txt like '%' || sqlc.arg('val') || '%'; +where txt like '%' || sqlc.arg('val')::text || '%'; -- name: Test3 :one select * from Demo -where txt like concat('%', sqlc.arg('val'), '%'); +where txt like concat('%', sqlc.arg('val')::text, '%'); diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..8a50f1b249 --- /dev/null +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE demo (txt text not null); + diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/order_by_binds/mysql/go/db.go b/internal/endtoend/testdata/order_by_binds/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/order_by_binds/mysql/go/db.go +++ b/internal/endtoend/testdata/order_by_binds/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/order_by_binds/mysql/go/models.go b/internal/endtoend/testdata/order_by_binds/mysql/go/models.go index 2727f2e2de..eaf05e5c00 100644 --- a/internal/endtoend/testdata/order_by_binds/mysql/go/models.go +++ b/internal/endtoend/testdata/order_by_binds/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/order_by_binds/mysql/go/query.sql.go b/internal/endtoend/testdata/order_by_binds/mysql/go/query.sql.go index e1c28cfcc1..7163ee84fa 100644 --- a/internal/endtoend/testdata/order_by_binds/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/order_by_binds/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -43,6 +43,34 @@ func (q *Queries) ListAuthorsColumnSort(ctx context.Context, arg ListAuthorsColu return items, nil } +const listAuthorsColumnSortFnWtihArg = `-- name: ListAuthorsColumnSortFnWtihArg :many +SELECT id, name, bio FROM authors +ORDER BY MOD(id, ?) +` + +func (q *Queries) ListAuthorsColumnSortFnWtihArg(ctx context.Context, modArg int64) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthorsColumnSortFnWtihArg, modArg) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan(&i.ID, &i.Name, &i.Bio); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const listAuthorsNameSort = `-- name: ListAuthorsNameSort :many SELECT id, name, bio FROM authors WHERE id > ? diff --git a/internal/endtoend/testdata/order_by_binds/mysql/query.sql b/internal/endtoend/testdata/order_by_binds/mysql/query.sql index 6dd2664b3d..c43763c838 100644 --- a/internal/endtoend/testdata/order_by_binds/mysql/query.sql +++ b/internal/endtoend/testdata/order_by_binds/mysql/query.sql @@ -1,14 +1,12 @@ -CREATE TABLE authors ( - id BIGINT PRIMARY KEY, - name text NOT NULL, - bio text -); - -- name: ListAuthorsColumnSort :many SELECT * FROM authors WHERE id > sqlc.arg(min_id) ORDER BY CASE WHEN sqlc.arg(sort_column) = 'name' THEN name END; +-- name: ListAuthorsColumnSortFnWtihArg :many +SELECT * FROM authors +ORDER BY MOD(id, sqlc.arg(mod_arg)); + -- name: ListAuthorsNameSort :many SELECT * FROM authors WHERE id > sqlc.arg(min_id) diff --git a/internal/endtoend/testdata/order_by_binds/mysql/schema.sql b/internal/endtoend/testdata/order_by_binds/mysql/schema.sql new file mode 100644 index 0000000000..c3dfc1bf35 --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/mysql/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE authors ( + id BIGINT PRIMARY KEY, + name text NOT NULL, + bio text +); + diff --git a/internal/endtoend/testdata/order_by_binds/mysql/sqlc.json b/internal/endtoend/testdata/order_by_binds/mysql/sqlc.json index 534b7e24e9..0390f67889 100644 --- a/internal/endtoend/testdata/order_by_binds/mysql/sqlc.json +++ b/internal/endtoend/testdata/order_by_binds/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/order_by_binds/pganalyze/exec.json b/internal/endtoend/testdata/order_by_binds/pganalyze/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/pganalyze/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/order_by_binds/pganalyze/go/db.go b/internal/endtoend/testdata/order_by_binds/pganalyze/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/pganalyze/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/order_by_binds/pganalyze/go/models.go b/internal/endtoend/testdata/order_by_binds/pganalyze/go/models.go new file mode 100644 index 0000000000..eaf05e5c00 --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/pganalyze/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/order_by_binds/pganalyze/go/query.sql.go b/internal/endtoend/testdata/order_by_binds/pganalyze/go/query.sql.go new file mode 100644 index 0000000000..5c98fff301 --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/pganalyze/go/query.sql.go @@ -0,0 +1,74 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const listAuthorsColumnSort = `-- name: ListAuthorsColumnSort :many +SELECT id, name, bio FROM authors +WHERE id > $1 +ORDER BY CASE WHEN $2 = 'name' THEN name END +` + +type ListAuthorsColumnSortParams struct { + MinID int64 + SortColumn sql.NullString +} + +func (q *Queries) ListAuthorsColumnSort(ctx context.Context, arg ListAuthorsColumnSortParams) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthorsColumnSort, arg.MinID, arg.SortColumn) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan(&i.ID, &i.Name, &i.Bio); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listAuthorsNameSort = `-- name: ListAuthorsNameSort :many +SELECT id, name, bio FROM authors +WHERE id > $1 +ORDER BY name ASC +` + +func (q *Queries) ListAuthorsNameSort(ctx context.Context, minID int64) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthorsNameSort, minID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan(&i.ID, &i.Name, &i.Bio); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/order_by_binds/pganalyze/query.sql b/internal/endtoend/testdata/order_by_binds/pganalyze/query.sql new file mode 100644 index 0000000000..e662d8f06a --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/pganalyze/query.sql @@ -0,0 +1,9 @@ +-- name: ListAuthorsColumnSort :many +SELECT * FROM authors +WHERE id > sqlc.arg(min_id) +ORDER BY CASE WHEN sqlc.arg(sort_column) = 'name' THEN name END; + +-- name: ListAuthorsNameSort :many +SELECT * FROM authors +WHERE id > sqlc.arg(min_id) +ORDER BY name ASC; diff --git a/internal/endtoend/testdata/order_by_binds/pganalyze/schema.sql b/internal/endtoend/testdata/order_by_binds/pganalyze/schema.sql new file mode 100644 index 0000000000..f388f86c34 --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/pganalyze/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + diff --git a/internal/endtoend/testdata/order_by_binds/pganalyze/sqlc.json b/internal/endtoend/testdata/order_by_binds/pganalyze/sqlc.json new file mode 100644 index 0000000000..a590361309 --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/pganalyze/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/order_by_binds/postgresql/exec.json b/internal/endtoend/testdata/order_by_binds/postgresql/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/postgresql/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/order_by_binds/postgresql/go/db.go b/internal/endtoend/testdata/order_by_binds/postgresql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/order_by_binds/postgresql/go/db.go +++ b/internal/endtoend/testdata/order_by_binds/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/order_by_binds/postgresql/go/models.go b/internal/endtoend/testdata/order_by_binds/postgresql/go/models.go index 2727f2e2de..eaf05e5c00 100644 --- a/internal/endtoend/testdata/order_by_binds/postgresql/go/models.go +++ b/internal/endtoend/testdata/order_by_binds/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/order_by_binds/postgresql/go/query.sql.go b/internal/endtoend/testdata/order_by_binds/postgresql/go/query.sql.go index 1ada686e4b..fcf89ac330 100644 --- a/internal/endtoend/testdata/order_by_binds/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/order_by_binds/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -43,6 +43,34 @@ func (q *Queries) ListAuthorsColumnSort(ctx context.Context, arg ListAuthorsColu return items, nil } +const listAuthorsColumnSortFnWtihArg = `-- name: ListAuthorsColumnSortFnWtihArg :many +SELECT id, name, bio FROM authors +ORDER BY MOD(id, $1) +` + +func (q *Queries) ListAuthorsColumnSortFnWtihArg(ctx context.Context, mod int64) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthorsColumnSortFnWtihArg, mod) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan(&i.ID, &i.Name, &i.Bio); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const listAuthorsNameSort = `-- name: ListAuthorsNameSort :many SELECT id, name, bio FROM authors WHERE id > $1 diff --git a/internal/endtoend/testdata/order_by_binds/postgresql/query.sql b/internal/endtoend/testdata/order_by_binds/postgresql/query.sql index 82889828c2..961d3f4e71 100644 --- a/internal/endtoend/testdata/order_by_binds/postgresql/query.sql +++ b/internal/endtoend/testdata/order_by_binds/postgresql/query.sql @@ -1,14 +1,12 @@ -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - name text NOT NULL, - bio text -); - -- name: ListAuthorsColumnSort :many SELECT * FROM authors WHERE id > sqlc.arg(min_id) ORDER BY CASE WHEN sqlc.arg(sort_column) = 'name' THEN name END; +-- name: ListAuthorsColumnSortFnWtihArg :many +SELECT * FROM authors +ORDER BY MOD(id, $1); + -- name: ListAuthorsNameSort :many SELECT * FROM authors WHERE id > sqlc.arg(min_id) diff --git a/internal/endtoend/testdata/order_by_binds/postgresql/schema.sql b/internal/endtoend/testdata/order_by_binds/postgresql/schema.sql new file mode 100644 index 0000000000..f388f86c34 --- /dev/null +++ b/internal/endtoend/testdata/order_by_binds/postgresql/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + diff --git a/internal/endtoend/testdata/order_by_binds/postgresql/sqlc.json b/internal/endtoend/testdata/order_by_binds/postgresql/sqlc.json index af57681f66..a590361309 100644 --- a/internal/endtoend/testdata/order_by_binds/postgresql/sqlc.json +++ b/internal/endtoend/testdata/order_by_binds/postgresql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/order_by_non_existing_column/mysql/query.sql b/internal/endtoend/testdata/order_by_non_existing_column/mysql/query.sql deleted file mode 100644 index b1a4b4f638..0000000000 --- a/internal/endtoend/testdata/order_by_non_existing_column/mysql/query.sql +++ /dev/null @@ -1,8 +0,0 @@ --- Example queries for sqlc -CREATE TABLE authors ( - id INT -); - --- name: ListAuthors :many -SELECT id FROM authors -ORDER BY adfadsf; \ No newline at end of file diff --git a/internal/endtoend/testdata/order_by_non_existing_column/mysql/sqlc.yaml b/internal/endtoend/testdata/order_by_non_existing_column/mysql/sqlc.yaml deleted file mode 100644 index c4b3831631..0000000000 --- a/internal/endtoend/testdata/order_by_non_existing_column/mysql/sqlc.yaml +++ /dev/null @@ -1,7 +0,0 @@ -version: 1 -packages: - - path: "go" - name: "querytest" - engine: "postgresql" - schema: "query.sql" - queries: "query.sql" \ No newline at end of file diff --git a/internal/endtoend/testdata/order_by_non_existing_column/mysql/stderr.txt b/internal/endtoend/testdata/order_by_non_existing_column/mysql/stderr.txt deleted file mode 100644 index 166178156e..0000000000 --- a/internal/endtoend/testdata/order_by_non_existing_column/mysql/stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -# package querytest -query.sql:7:1: column reference "adfadsf" not found: if you want to skip this validation, set 'strict_order_by' to false diff --git a/internal/endtoend/testdata/order_by_non_existing_column/postgresql/query.sql b/internal/endtoend/testdata/order_by_non_existing_column/postgresql/query.sql index b1a4b4f638..ba81cfdbc5 100644 --- a/internal/endtoend/testdata/order_by_non_existing_column/postgresql/query.sql +++ b/internal/endtoend/testdata/order_by_non_existing_column/postgresql/query.sql @@ -1,8 +1,3 @@ --- Example queries for sqlc -CREATE TABLE authors ( - id INT -); - -- name: ListAuthors :many SELECT id FROM authors ORDER BY adfadsf; \ No newline at end of file diff --git a/internal/endtoend/testdata/order_by_non_existing_column/postgresql/schema.sql b/internal/endtoend/testdata/order_by_non_existing_column/postgresql/schema.sql new file mode 100644 index 0000000000..acba948a66 --- /dev/null +++ b/internal/endtoend/testdata/order_by_non_existing_column/postgresql/schema.sql @@ -0,0 +1,5 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id INT +); + diff --git a/internal/endtoend/testdata/order_by_non_existing_column/postgresql/sqlc.yaml b/internal/endtoend/testdata/order_by_non_existing_column/postgresql/sqlc.yaml index c4b3831631..9ae3fc0cae 100644 --- a/internal/endtoend/testdata/order_by_non_existing_column/postgresql/sqlc.yaml +++ b/internal/endtoend/testdata/order_by_non_existing_column/postgresql/sqlc.yaml @@ -3,5 +3,5 @@ packages: - path: "go" name: "querytest" engine: "postgresql" - schema: "query.sql" + schema: "schema.sql" queries: "query.sql" \ No newline at end of file diff --git a/internal/endtoend/testdata/order_by_non_existing_column/postgresql/stderr.txt b/internal/endtoend/testdata/order_by_non_existing_column/postgresql/stderr.txt deleted file mode 100644 index 166178156e..0000000000 --- a/internal/endtoend/testdata/order_by_non_existing_column/postgresql/stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -# package querytest -query.sql:7:1: column reference "adfadsf" not found: if you want to skip this validation, set 'strict_order_by' to false diff --git a/internal/endtoend/testdata/order_by_non_existing_column/postgresql/stderr/base.txt b/internal/endtoend/testdata/order_by_non_existing_column/postgresql/stderr/base.txt new file mode 100644 index 0000000000..5d9a674dc6 --- /dev/null +++ b/internal/endtoend/testdata/order_by_non_existing_column/postgresql/stderr/base.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:1:1: column reference "adfadsf" not found: if you want to skip this validation, set 'strict_order_by' to false diff --git a/internal/endtoend/testdata/order_by_non_existing_column/postgresql/stderr/managed-db.txt b/internal/endtoend/testdata/order_by_non_existing_column/postgresql/stderr/managed-db.txt new file mode 100644 index 0000000000..55cbb71463 --- /dev/null +++ b/internal/endtoend/testdata/order_by_non_existing_column/postgresql/stderr/managed-db.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:3:10: column "adfadsf" does not exist diff --git a/internal/endtoend/testdata/order_by_non_existing_column/sqlite/query.sql b/internal/endtoend/testdata/order_by_non_existing_column/sqlite/query.sql deleted file mode 100644 index b1a4b4f638..0000000000 --- a/internal/endtoend/testdata/order_by_non_existing_column/sqlite/query.sql +++ /dev/null @@ -1,8 +0,0 @@ --- Example queries for sqlc -CREATE TABLE authors ( - id INT -); - --- name: ListAuthors :many -SELECT id FROM authors -ORDER BY adfadsf; \ No newline at end of file diff --git a/internal/endtoend/testdata/order_by_non_existing_column/sqlite/sqlc.yaml b/internal/endtoend/testdata/order_by_non_existing_column/sqlite/sqlc.yaml deleted file mode 100644 index c4b3831631..0000000000 --- a/internal/endtoend/testdata/order_by_non_existing_column/sqlite/sqlc.yaml +++ /dev/null @@ -1,7 +0,0 @@ -version: 1 -packages: - - path: "go" - name: "querytest" - engine: "postgresql" - schema: "query.sql" - queries: "query.sql" \ No newline at end of file diff --git a/internal/endtoend/testdata/order_by_non_existing_column/sqlite/stderr.txt b/internal/endtoend/testdata/order_by_non_existing_column/sqlite/stderr.txt deleted file mode 100644 index 166178156e..0000000000 --- a/internal/endtoend/testdata/order_by_non_existing_column/sqlite/stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -# package querytest -query.sql:7:1: column reference "adfadsf" not found: if you want to skip this validation, set 'strict_order_by' to false diff --git a/internal/endtoend/testdata/order_by_union/mysql/go/db.go b/internal/endtoend/testdata/order_by_union/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/order_by_union/mysql/go/db.go +++ b/internal/endtoend/testdata/order_by_union/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/order_by_union/mysql/go/models.go b/internal/endtoend/testdata/order_by_union/mysql/go/models.go index 25aeaacd9f..d0c134974d 100644 --- a/internal/endtoend/testdata/order_by_union/mysql/go/models.go +++ b/internal/endtoend/testdata/order_by_union/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/order_by_union/mysql/go/query.sql.go b/internal/endtoend/testdata/order_by_union/mysql/go/query.sql.go index 9d8991e2a2..dc796d7d62 100644 --- a/internal/endtoend/testdata/order_by_union/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/order_by_union/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/order_by_union/mysql/query.sql b/internal/endtoend/testdata/order_by_union/mysql/query.sql index e779d457fa..bd034ef5d5 100644 --- a/internal/endtoend/testdata/order_by_union/mysql/query.sql +++ b/internal/endtoend/testdata/order_by_union/mysql/query.sql @@ -1,12 +1,3 @@ -CREATE TABLE authors ( - name text NOT NULL, - bio text -); - -CREATE TABLE people ( - first_name text NOT NULL -); - -- name: ListAuthorsUnion :many SELECT name as foo FROM authors UNION diff --git a/internal/endtoend/testdata/order_by_union/mysql/schema.sql b/internal/endtoend/testdata/order_by_union/mysql/schema.sql new file mode 100644 index 0000000000..3cdb3a9eb3 --- /dev/null +++ b/internal/endtoend/testdata/order_by_union/mysql/schema.sql @@ -0,0 +1,9 @@ +CREATE TABLE authors ( + name text NOT NULL, + bio text +); + +CREATE TABLE people ( + first_name text NOT NULL +); + diff --git a/internal/endtoend/testdata/order_by_union/mysql/sqlc.json b/internal/endtoend/testdata/order_by_union/mysql/sqlc.json index 534b7e24e9..0390f67889 100644 --- a/internal/endtoend/testdata/order_by_union/mysql/sqlc.json +++ b/internal/endtoend/testdata/order_by_union/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/order_by_union/postgresql/go/db.go b/internal/endtoend/testdata/order_by_union/postgresql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/order_by_union/postgresql/go/db.go +++ b/internal/endtoend/testdata/order_by_union/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/order_by_union/postgresql/go/models.go b/internal/endtoend/testdata/order_by_union/postgresql/go/models.go index 04a70b0742..18e0bf75dc 100644 --- a/internal/endtoend/testdata/order_by_union/postgresql/go/models.go +++ b/internal/endtoend/testdata/order_by_union/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/order_by_union/postgresql/go/query.sql.go b/internal/endtoend/testdata/order_by_union/postgresql/go/query.sql.go index 9d8991e2a2..dc796d7d62 100644 --- a/internal/endtoend/testdata/order_by_union/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/order_by_union/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/order_by_union/postgresql/query.sql b/internal/endtoend/testdata/order_by_union/postgresql/query.sql index f723929976..bd034ef5d5 100644 --- a/internal/endtoend/testdata/order_by_union/postgresql/query.sql +++ b/internal/endtoend/testdata/order_by_union/postgresql/query.sql @@ -1,13 +1,3 @@ -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - name text NOT NULL, - bio text -); - -CREATE TABLE people ( - first_name text NOT NULL -); - -- name: ListAuthorsUnion :many SELECT name as foo FROM authors UNION diff --git a/internal/endtoend/testdata/order_by_union/postgresql/schema.sql b/internal/endtoend/testdata/order_by_union/postgresql/schema.sql new file mode 100644 index 0000000000..2d646fd23e --- /dev/null +++ b/internal/endtoend/testdata/order_by_union/postgresql/schema.sql @@ -0,0 +1,10 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + +CREATE TABLE people ( + first_name text NOT NULL +); + diff --git a/internal/endtoend/testdata/order_by_union/postgresql/sqlc.json b/internal/endtoend/testdata/order_by_union/postgresql/sqlc.json index af57681f66..a590361309 100644 --- a/internal/endtoend/testdata/order_by_union/postgresql/sqlc.json +++ b/internal/endtoend/testdata/order_by_union/postgresql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/output_file_names/pgx/v4/go/batch_gen.go b/internal/endtoend/testdata/output_file_names/pgx/v4/go/batch_gen.go index 16dd2320b6..a3d8e17818 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v4/go/batch_gen.go +++ b/internal/endtoend/testdata/output_file_names/pgx/v4/go/batch_gen.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: batch_gen.go package querytest diff --git a/internal/endtoend/testdata/output_file_names/pgx/v4/go/copyfrom_gen.go b/internal/endtoend/testdata/output_file_names/pgx/v4/go/copyfrom_gen.go index 642676f121..9481f2fc5e 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v4/go/copyfrom_gen.go +++ b/internal/endtoend/testdata/output_file_names/pgx/v4/go/copyfrom_gen.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: copyfrom_gen.go package querytest diff --git a/internal/endtoend/testdata/output_file_names/pgx/v4/go/db_gen.go b/internal/endtoend/testdata/output_file_names/pgx/v4/go/db_gen.go index fad32942f0..8149ab98c1 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v4/go/db_gen.go +++ b/internal/endtoend/testdata/output_file_names/pgx/v4/go/db_gen.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/output_file_names/pgx/v4/go/models_gen.go b/internal/endtoend/testdata/output_file_names/pgx/v4/go/models_gen.go index 2f3b066799..7a00bcb08b 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v4/go/models_gen.go +++ b/internal/endtoend/testdata/output_file_names/pgx/v4/go/models_gen.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type User struct { ID int64 } diff --git a/internal/endtoend/testdata/output_file_names/pgx/v4/go/querier_gen.go b/internal/endtoend/testdata/output_file_names/pgx/v4/go/querier_gen.go index f79dba674d..0fba399be7 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v4/go/querier_gen.go +++ b/internal/endtoend/testdata/output_file_names/pgx/v4/go/querier_gen.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/output_file_names/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/output_file_names/pgx/v4/go/query.sql.go index 62426551e5..4debf38e23 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/output_file_names/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/output_file_names/pgx/v4/query.sql b/internal/endtoend/testdata/output_file_names/pgx/v4/query.sql index e98750dee1..0b14d20ac6 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v4/query.sql +++ b/internal/endtoend/testdata/output_file_names/pgx/v4/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE "user" (id bigserial not null); - -- name: User :many SELECT "user".* FROM "user"; diff --git a/internal/endtoend/testdata/output_file_names/pgx/v4/schema.sql b/internal/endtoend/testdata/output_file_names/pgx/v4/schema.sql new file mode 100644 index 0000000000..7fd1e597cf --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE "user" (id bigserial not null); + diff --git a/internal/endtoend/testdata/output_file_names/pgx/v4/sqlc.json b/internal/endtoend/testdata/output_file_names/pgx/v4/sqlc.json index d3cf73d952..b92274a549 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/output_file_names/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_interface": true, "output_batch_file_name": "batch_gen.go", diff --git a/internal/endtoend/testdata/output_file_names/pgx/v5/go/batch_gen.go b/internal/endtoend/testdata/output_file_names/pgx/v5/go/batch_gen.go index 564d39b7eb..a59e22a66c 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v5/go/batch_gen.go +++ b/internal/endtoend/testdata/output_file_names/pgx/v5/go/batch_gen.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: batch_gen.go package querytest diff --git a/internal/endtoend/testdata/output_file_names/pgx/v5/go/copyfrom_gen.go b/internal/endtoend/testdata/output_file_names/pgx/v5/go/copyfrom_gen.go index 642676f121..9481f2fc5e 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v5/go/copyfrom_gen.go +++ b/internal/endtoend/testdata/output_file_names/pgx/v5/go/copyfrom_gen.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: copyfrom_gen.go package querytest diff --git a/internal/endtoend/testdata/output_file_names/pgx/v5/go/db_gen.go b/internal/endtoend/testdata/output_file_names/pgx/v5/go/db_gen.go index 253ff84386..32b197ce0c 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v5/go/db_gen.go +++ b/internal/endtoend/testdata/output_file_names/pgx/v5/go/db_gen.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/output_file_names/pgx/v5/go/models_gen.go b/internal/endtoend/testdata/output_file_names/pgx/v5/go/models_gen.go index 2f3b066799..7a00bcb08b 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v5/go/models_gen.go +++ b/internal/endtoend/testdata/output_file_names/pgx/v5/go/models_gen.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type User struct { ID int64 } diff --git a/internal/endtoend/testdata/output_file_names/pgx/v5/go/querier_gen.go b/internal/endtoend/testdata/output_file_names/pgx/v5/go/querier_gen.go index f79dba674d..0fba399be7 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v5/go/querier_gen.go +++ b/internal/endtoend/testdata/output_file_names/pgx/v5/go/querier_gen.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/output_file_names/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/output_file_names/pgx/v5/go/query.sql.go index 62426551e5..4debf38e23 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/output_file_names/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/output_file_names/pgx/v5/query.sql b/internal/endtoend/testdata/output_file_names/pgx/v5/query.sql index a59806c8c6..7d59a79cb6 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v5/query.sql +++ b/internal/endtoend/testdata/output_file_names/pgx/v5/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE "user" (id bigserial not null); - -- name: User :many SELECT "user".* FROM "user"; diff --git a/internal/endtoend/testdata/output_file_names/pgx/v5/schema.sql b/internal/endtoend/testdata/output_file_names/pgx/v5/schema.sql new file mode 100644 index 0000000000..7fd1e597cf --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE "user" (id bigserial not null); + diff --git a/internal/endtoend/testdata/output_file_names/pgx/v5/sqlc.json b/internal/endtoend/testdata/output_file_names/pgx/v5/sqlc.json index d948821538..958c87429c 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/output_file_names/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_interface": true, "output_batch_file_name": "batch_gen.go", diff --git a/internal/endtoend/testdata/output_file_names/stdlib/go/db_gen.go b/internal/endtoend/testdata/output_file_names/stdlib/go/db_gen.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/output_file_names/stdlib/go/db_gen.go +++ b/internal/endtoend/testdata/output_file_names/stdlib/go/db_gen.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/output_file_names/stdlib/go/models_gen.go b/internal/endtoend/testdata/output_file_names/stdlib/go/models_gen.go index 2f3b066799..7a00bcb08b 100644 --- a/internal/endtoend/testdata/output_file_names/stdlib/go/models_gen.go +++ b/internal/endtoend/testdata/output_file_names/stdlib/go/models_gen.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type User struct { ID int64 } diff --git a/internal/endtoend/testdata/output_file_names/stdlib/go/querier_gen.go b/internal/endtoend/testdata/output_file_names/stdlib/go/querier_gen.go index ce593aa9d2..8008c65e53 100644 --- a/internal/endtoend/testdata/output_file_names/stdlib/go/querier_gen.go +++ b/internal/endtoend/testdata/output_file_names/stdlib/go/querier_gen.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/output_file_names/stdlib/go/query.sql.go b/internal/endtoend/testdata/output_file_names/stdlib/go/query.sql.go index 2f0d4de7a8..fc2d9b248e 100644 --- a/internal/endtoend/testdata/output_file_names/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/output_file_names/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/output_file_names/stdlib/query.sql b/internal/endtoend/testdata/output_file_names/stdlib/query.sql index 3191419956..64493569d3 100644 --- a/internal/endtoend/testdata/output_file_names/stdlib/query.sql +++ b/internal/endtoend/testdata/output_file_names/stdlib/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE "user" (id bigserial not null); - -- name: User :many SELECT "user".* FROM "user"; diff --git a/internal/endtoend/testdata/output_file_names/stdlib/schema.sql b/internal/endtoend/testdata/output_file_names/stdlib/schema.sql new file mode 100644 index 0000000000..7fd1e597cf --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE "user" (id bigserial not null); + diff --git a/internal/endtoend/testdata/output_file_names/stdlib/sqlc.json b/internal/endtoend/testdata/output_file_names/stdlib/sqlc.json index f492379b03..677f10a908 100644 --- a/internal/endtoend/testdata/output_file_names/stdlib/sqlc.json +++ b/internal/endtoend/testdata/output_file_names/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_interface": true, "output_db_file_name": "db_gen.go", diff --git a/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/db.go b/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/models.go b/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/models.go index 2f3b066799..7a00bcb08b 100644 --- a/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type User struct { ID int64 } diff --git a/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/query.sql_gen.go b/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/query.sql_gen.go index 62426551e5..4debf38e23 100644 --- a/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/query.sql_gen.go +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/query.sql_gen.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/output_files_suffix/pgx/v4/query.sql b/internal/endtoend/testdata/output_files_suffix/pgx/v4/query.sql index 3191419956..64493569d3 100644 --- a/internal/endtoend/testdata/output_files_suffix/pgx/v4/query.sql +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v4/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE "user" (id bigserial not null); - -- name: User :many SELECT "user".* FROM "user"; diff --git a/internal/endtoend/testdata/output_files_suffix/pgx/v4/schema.sql b/internal/endtoend/testdata/output_files_suffix/pgx/v4/schema.sql new file mode 100644 index 0000000000..7fd1e597cf --- /dev/null +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE "user" (id bigserial not null); + diff --git a/internal/endtoend/testdata/output_files_suffix/pgx/v4/sqlc.json b/internal/endtoend/testdata/output_files_suffix/pgx/v4/sqlc.json index a9f4fc2c64..966fad6dc6 100644 --- a/internal/endtoend/testdata/output_files_suffix/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "output_files_suffix": "_gen.go" } diff --git a/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/db.go b/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/models.go b/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/models.go index 2f3b066799..7a00bcb08b 100644 --- a/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type User struct { ID int64 } diff --git a/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/query.sql_gen.go b/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/query.sql_gen.go index 62426551e5..4debf38e23 100644 --- a/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/query.sql_gen.go +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/query.sql_gen.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/output_files_suffix/pgx/v5/query.sql b/internal/endtoend/testdata/output_files_suffix/pgx/v5/query.sql index 3191419956..64493569d3 100644 --- a/internal/endtoend/testdata/output_files_suffix/pgx/v5/query.sql +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v5/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE "user" (id bigserial not null); - -- name: User :many SELECT "user".* FROM "user"; diff --git a/internal/endtoend/testdata/output_files_suffix/pgx/v5/schema.sql b/internal/endtoend/testdata/output_files_suffix/pgx/v5/schema.sql new file mode 100644 index 0000000000..7fd1e597cf --- /dev/null +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE "user" (id bigserial not null); + diff --git a/internal/endtoend/testdata/output_files_suffix/pgx/v5/sqlc.json b/internal/endtoend/testdata/output_files_suffix/pgx/v5/sqlc.json index 4c76fdb404..9d64831b62 100644 --- a/internal/endtoend/testdata/output_files_suffix/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "output_files_suffix": "_gen.go" } diff --git a/internal/endtoend/testdata/output_files_suffix/stdlib/go/db.go b/internal/endtoend/testdata/output_files_suffix/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/output_files_suffix/stdlib/go/db.go +++ b/internal/endtoend/testdata/output_files_suffix/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/output_files_suffix/stdlib/go/models.go b/internal/endtoend/testdata/output_files_suffix/stdlib/go/models.go index 2f3b066799..7a00bcb08b 100644 --- a/internal/endtoend/testdata/output_files_suffix/stdlib/go/models.go +++ b/internal/endtoend/testdata/output_files_suffix/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type User struct { ID int64 } diff --git a/internal/endtoend/testdata/output_files_suffix/stdlib/go/query.sql_gen.go b/internal/endtoend/testdata/output_files_suffix/stdlib/go/query.sql_gen.go index 2f0d4de7a8..fc2d9b248e 100644 --- a/internal/endtoend/testdata/output_files_suffix/stdlib/go/query.sql_gen.go +++ b/internal/endtoend/testdata/output_files_suffix/stdlib/go/query.sql_gen.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/output_files_suffix/stdlib/query.sql b/internal/endtoend/testdata/output_files_suffix/stdlib/query.sql index 3191419956..64493569d3 100644 --- a/internal/endtoend/testdata/output_files_suffix/stdlib/query.sql +++ b/internal/endtoend/testdata/output_files_suffix/stdlib/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE "user" (id bigserial not null); - -- name: User :many SELECT "user".* FROM "user"; diff --git a/internal/endtoend/testdata/output_files_suffix/stdlib/schema.sql b/internal/endtoend/testdata/output_files_suffix/stdlib/schema.sql new file mode 100644 index 0000000000..7fd1e597cf --- /dev/null +++ b/internal/endtoend/testdata/output_files_suffix/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE "user" (id bigserial not null); + diff --git a/internal/endtoend/testdata/output_files_suffix/stdlib/sqlc.json b/internal/endtoend/testdata/output_files_suffix/stdlib/sqlc.json index 7708c21017..73ff897576 100644 --- a/internal/endtoend/testdata/output_files_suffix/stdlib/sqlc.json +++ b/internal/endtoend/testdata/output_files_suffix/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "output_files_suffix": "_gen.go" } diff --git a/internal/endtoend/testdata/overrides/mysql/go/db.go b/internal/endtoend/testdata/overrides/mysql/go/db.go index d0eacb407b..9c19dd4a09 100644 --- a/internal/endtoend/testdata/overrides/mysql/go/db.go +++ b/internal/endtoend/testdata/overrides/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides/mysql/go/models.go b/internal/endtoend/testdata/overrides/mysql/go/models.go index 21a1a3308e..e6ba74a5a0 100644 --- a/internal/endtoend/testdata/overrides/mysql/go/models.go +++ b/internal/endtoend/testdata/overrides/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides/mysql/go/query.sql.go b/internal/endtoend/testdata/overrides/mysql/go/query.sql.go new file mode 100644 index 0000000000..0faba2cde4 --- /dev/null +++ b/internal/endtoend/testdata/overrides/mysql/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package override + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/overrides/mysql/query.sql b/internal/endtoend/testdata/overrides/mysql/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/overrides/mysql/query.sql +++ b/internal/endtoend/testdata/overrides/mysql/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/db.go index c6dbb043e5..d27a158d73 100644 --- a/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/models.go index fa5a1ad177..051e7672e0 100644 --- a/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/query.sql.go new file mode 100644 index 0000000000..6d31e7480e --- /dev/null +++ b/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package override + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRow(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/overrides/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/overrides/postgresql/pgx/v4/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/overrides/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/overrides/postgresql/pgx/v4/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/db.go index 289d779ef2..a6e06f5d0e 100644 --- a/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/models.go index fa5a1ad177..051e7672e0 100644 --- a/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/query.sql.go new file mode 100644 index 0000000000..6d31e7480e --- /dev/null +++ b/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package override + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRow(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/overrides/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/overrides/postgresql/pgx/v5/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/overrides/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/overrides/postgresql/pgx/v5/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/overrides/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/overrides/postgresql/stdlib/go/db.go index d0eacb407b..9c19dd4a09 100644 --- a/internal/endtoend/testdata/overrides/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/overrides/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/overrides/postgresql/stdlib/go/models.go index fa5a1ad177..051e7672e0 100644 --- a/internal/endtoend/testdata/overrides/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/overrides/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/overrides/postgresql/stdlib/go/query.sql.go new file mode 100644 index 0000000000..0faba2cde4 --- /dev/null +++ b/internal/endtoend/testdata/overrides/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package override + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/overrides/postgresql/stdlib/query.sql b/internal/endtoend/testdata/overrides/postgresql/stdlib/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/overrides/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/overrides/postgresql/stdlib/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/overrides/sqlite/go/db.go b/internal/endtoend/testdata/overrides/sqlite/go/db.go index d0eacb407b..9c19dd4a09 100644 --- a/internal/endtoend/testdata/overrides/sqlite/go/db.go +++ b/internal/endtoend/testdata/overrides/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides/sqlite/go/models.go b/internal/endtoend/testdata/overrides/sqlite/go/models.go index 21a1a3308e..e6ba74a5a0 100644 --- a/internal/endtoend/testdata/overrides/sqlite/go/models.go +++ b/internal/endtoend/testdata/overrides/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides/sqlite/go/query.sql.go b/internal/endtoend/testdata/overrides/sqlite/go/query.sql.go new file mode 100644 index 0000000000..e528f151d9 --- /dev/null +++ b/internal/endtoend/testdata/overrides/sqlite/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package override + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int64 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/overrides/sqlite/query.sql b/internal/endtoend/testdata/overrides/sqlite/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/overrides/sqlite/query.sql +++ b/internal/endtoend/testdata/overrides/sqlite/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query.sql index 089de5d055..6c0b1c86b9 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query.sql @@ -1,11 +1,3 @@ --- Example queries for sqlc -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - name text NOT NULL, - bio text, - tags text[] -); - -- name: GetAuthor :one SELECT * FROM authors WHERE id = $1 LIMIT 1; diff --git a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/db.go b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/db.go index 6b3149f60d..00b551ba76 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/db.go +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package query diff --git a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/models.go b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/models.go index d2207cc18b..c97fe5b642 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/models.go +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package query diff --git a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/query.sql.go b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/query.sql.go index 8b6a127076..0fdeaad6e5 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/query.sql.go +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package query diff --git a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..f0ca77b240 --- /dev/null +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/schema.sql @@ -0,0 +1,8 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text, + tags text[] +); + diff --git a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/sqlc.json index ca45f06cab..3aaed50644 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/sqlc.json @@ -1,7 +1,7 @@ { "version": "2", "sql": [{ - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "engine": "postgresql", "gen": { diff --git a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query.sql index 089de5d055..6c0b1c86b9 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query.sql @@ -1,11 +1,3 @@ --- Example queries for sqlc -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - name text NOT NULL, - bio text, - tags text[] -); - -- name: GetAuthor :one SELECT * FROM authors WHERE id = $1 LIMIT 1; diff --git a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/db.go b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/db.go index f5f6c7e86c..fed4c7f269 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/db.go +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package query diff --git a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/models.go b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/models.go index e686b704d2..876b5683f2 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/models.go +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package query diff --git a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/query.sql.go b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/query.sql.go index 8b6a127076..0fdeaad6e5 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/query.sql.go +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package query diff --git a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..f0ca77b240 --- /dev/null +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/schema.sql @@ -0,0 +1,8 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text, + tags text[] +); + diff --git a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/sqlc.json index f43f1b43ec..f75e700228 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/sqlc.json @@ -1,7 +1,7 @@ { "version": "2", "sql": [{ - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "engine": "postgresql", "gen": { diff --git a/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query.sql b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query.sql index 089de5d055..6c0b1c86b9 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query.sql @@ -1,11 +1,3 @@ --- Example queries for sqlc -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - name text NOT NULL, - bio text, - tags text[] -); - -- name: GetAuthor :one SELECT * FROM authors WHERE id = $1 LIMIT 1; diff --git a/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/db.go b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/db.go index a89f3caa23..eaae6e5461 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/db.go +++ b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package query diff --git a/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/models.go b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/models.go index d2207cc18b..c97fe5b642 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/models.go +++ b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package query diff --git a/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/query.sql.go b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/query.sql.go index 1df07bcdcf..f6f04988a4 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/query.sql.go +++ b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package query diff --git a/internal/endtoend/testdata/overrides_array/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..f0ca77b240 --- /dev/null +++ b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/schema.sql @@ -0,0 +1,8 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text, + tags text[] +); + diff --git a/internal/endtoend/testdata/overrides_array/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/sqlc.json index d1f756add5..8b02b46700 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/sqlc.json @@ -1,7 +1,7 @@ { "version": "2", "sql": [{ - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "engine": "postgresql", "gen": { diff --git a/internal/endtoend/testdata/overrides_config/query.sql b/internal/endtoend/testdata/overrides_config/query.sql new file mode 100644 index 0000000000..9da604b57e --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/query.sql @@ -0,0 +1,2 @@ +-- name: Test :one +SELECT 1; diff --git a/internal/endtoend/testdata/overrides_config/schema.sql b/internal/endtoend/testdata/overrides_config/schema.sql new file mode 100644 index 0000000000..03d90e1cec --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE overrides ( + one text NOT NULL, + two bigint NOT NULL, + three text[] NOT NULL, + four bytea NOT NULL, + five text[] +); diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/global/db/db.go b/internal/endtoend/testdata/overrides_config/v2/yaml/global/db/db.go new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/global/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/global/db/models.go b/internal/endtoend/testdata/overrides_config/v2/yaml/global/db/models.go new file mode 100644 index 0000000000..48fa1bcf32 --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/global/db/models.go @@ -0,0 +1,17 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "github.com/sqlc-dev/sqlc-testdata/pkg" +) + +type Override struct { + ONE pkg.CustomType + Two int64 + Three pkg.CustomType + Four []byte + Five []pkg.CustomType +} diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/global/db/query.sql.go b/internal/endtoend/testdata/overrides_config/v2/yaml/global/db/query.sql.go new file mode 100644 index 0000000000..915a614950 --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/global/db/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/global/sqlc.yaml b/internal/endtoend/testdata/overrides_config/v2/yaml/global/sqlc.yaml new file mode 100644 index 0000000000..335759cfd2 --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/global/sqlc.yaml @@ -0,0 +1,19 @@ +version: "2" +overrides: + go: + rename: + one: "ONE" + overrides: + - db_type: "text" + go_type: "github.com/sqlc-dev/sqlc-testdata/pkg.CustomType" + - column: "overrides.three" + go_type: + import: "github.com/sqlc-dev/sqlc-testdata/pkg" + type: "CustomType" +sql: +- schema: "../../../schema.sql" + queries: "../../../query.sql" + engine: "postgresql" + gen: + go: + out: "db" diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/db/db.go b/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/db/db.go new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/db/models.go b/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/db/models.go new file mode 100644 index 0000000000..48fa1bcf32 --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/db/models.go @@ -0,0 +1,17 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "github.com/sqlc-dev/sqlc-testdata/pkg" +) + +type Override struct { + ONE pkg.CustomType + Two int64 + Three pkg.CustomType + Four []byte + Five []pkg.CustomType +} diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/db/query.sql.go b/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/db/query.sql.go new file mode 100644 index 0000000000..915a614950 --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/db/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/sqlc.yaml b/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/sqlc.yaml new file mode 100644 index 0000000000..62ef7e7772 --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/sqlc.yaml @@ -0,0 +1,26 @@ +version: "2" +overrides: + go: + rename: + one: "ONE" + overrides: + - db_type: "text" + go_type: "github.com/sqlc-dev/sqlc-testdata/pkg.CustomType" + - column: "overrides.three" + go_type: + import: "github.com/sqlc-dev/sqlc-testdata/pkg" + type: "CustomType" +sql: +- schema: "../../../schema.sql" + queries: "../../../query.sql" + engine: "postgresql" + gen: + go: + out: "db" + rename: + one: "ONE" + overrides: + - column: "overrides.three" + go_type: + import: "invalid/import" + type: "ShouldNotSeeThis" diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/db/db.go b/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/db/db.go new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/db/models.go b/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/db/models.go new file mode 100644 index 0000000000..48fa1bcf32 --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/db/models.go @@ -0,0 +1,17 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "github.com/sqlc-dev/sqlc-testdata/pkg" +) + +type Override struct { + ONE pkg.CustomType + Two int64 + Three pkg.CustomType + Four []byte + Five []pkg.CustomType +} diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/db/query.sql.go b/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/db/query.sql.go new file mode 100644 index 0000000000..915a614950 --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/db/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/sqlc.yaml b/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/sqlc.yaml new file mode 100644 index 0000000000..7847f6d08d --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/sqlc.yaml @@ -0,0 +1,17 @@ +version: "2" +sql: +- schema: "../../../schema.sql" + queries: "../../../query.sql" + engine: "postgresql" + gen: + go: + out: "db" + rename: + one: "ONE" + overrides: + - db_type: "text" + go_type: "github.com/sqlc-dev/sqlc-testdata/pkg.CustomType" + - column: "overrides.three" + go_type: + import: "github.com/sqlc-dev/sqlc-testdata/pkg" + type: "CustomType" diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/invalid_tags/query.sql b/internal/endtoend/testdata/overrides_go_struct_tags/invalid_tags/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/invalid_tags/query.sql +++ b/internal/endtoend/testdata/overrides_go_struct_tags/invalid_tags/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/invalid_tags/stderr.txt b/internal/endtoend/testdata/overrides_go_struct_tags/invalid_tags/stderr.txt index cb6fb84aec..c6891c182b 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/invalid_tags/stderr.txt +++ b/internal/endtoend/testdata/overrides_go_struct_tags/invalid_tags/stderr.txt @@ -1 +1,2 @@ -error parsing sqlc.json: bad syntax for struct tag pair +# package override +error generating code: bad syntax for struct tag pair diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/mysql/go/db.go b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/go/db.go index d0eacb407b..9c19dd4a09 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/mysql/go/db.go +++ b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/mysql/go/models.go b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/go/models.go index a75be5c96a..b7b7849db3 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/mysql/go/models.go +++ b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/go/models.go @@ -1,22 +1,21 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override -import () - type Bar struct { - Other string - AlsoTagged string `also:"tagged"` + Other string `utype:"notnull_text"` + AlsoTagged string `also:"tagged" utype:"notnull_text"` } type Baz struct { - Other string - AlsoTagged string `also:"tagged"` + Other string `utype:"notnull_text"` + AlsoTagged string `also:"tagged" utype:"notnull_text"` } type Foo struct { - Other string - Tagged string `a:"b" x:"y,z"` + Other string `utype:"notnull_text"` + Tagged string `a:"b" utype:"notnull_text" x:"y,z"` + Nulltext string `utype:"nullable_text"` } diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/mysql/go/query.sql.go b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/go/query.sql.go new file mode 100644 index 0000000000..0faba2cde4 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package override + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/mysql/query.sql b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/mysql/query.sql +++ b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/mysql/schema.sql b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/schema.sql index 4d5233cc37..5c9ce85545 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/mysql/schema.sql +++ b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/schema.sql @@ -1,6 +1,7 @@ CREATE TABLE foo ( other text NOT NULL, - tagged text NOT NULL + tagged text NOT NULL, + nulltext text ); CREATE TABLE bar ( diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/mysql/sqlc.json b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/sqlc.json index 7d92e65e69..697fe054ea 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/mysql/sqlc.json +++ b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/sqlc.json @@ -15,6 +15,16 @@ { "go_struct_tag": "also:\"tagged\"", "column": "*.also_tagged" + }, + { + "db_type": "text", + "go_struct_tag": "utype:\"notnull_text\"" + }, + { + "db_type": "text", + "go_type": "string", + "nullable": true, + "go_struct_tag": "utype:\"nullable_text\"" } ] } diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/db.go index c6dbb043e5..d27a158d73 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/models.go index 8de4edf9f6..1a9a939e64 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/models.go @@ -1,23 +1,20 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override -import ( - "database/sql" -) - type Bar struct { - ID sql.NullString `type:"id"` - OtherID sql.NullString `type:"other_id"` - About sql.NullString - Other sql.NullString `type:"other"` + ID string `type:"id" utype:"nullable_text"` + OtherID string `type:"other_id" utype:"nullable_text"` + About string `utype:"nullable_text"` + Other string `type:"other" utype:"nullable_text"` } type Foo struct { - ID sql.NullString `source:"foo" type:"id"` - OtherID sql.NullString `type:"other_id"` - About sql.NullString `type:"about"` - Other sql.NullString `type:"this"` + ID string `source:"foo" type:"id" utype:"nullable_text"` + OtherID string `type:"other_id" utype:"nullable_text"` + About string `type:"about" utype:"nullable_text"` + Other string `type:"this" utype:"nullable_text"` + Notnulltext string `utype:"notnull_text"` } diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/query.sql.go new file mode 100644 index 0000000000..6d31e7480e --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package override + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRow(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/schema.sql index 53739ddbb1..30b718298d 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/schema.sql +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/schema.sql @@ -2,7 +2,8 @@ CREATE TABLE foo ( id text, other_id text, about text, - other text + other text, + notnulltext text not null ); CREATE TABLE bar ( diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/sqlc.json index a01427c202..bc583cdad4 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/sqlc.json @@ -32,6 +32,16 @@ { "column": "foo.other", "go_struct_tag": "type:\"this\"" + }, + { + "db_type": "text", + "go_struct_tag": "utype:\"notnull_text\"" + }, + { + "db_type": "text", + "go_type": "string", + "nullable": true, + "go_struct_tag": "utype:\"nullable_text\"" } ] } diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/db.go index 289d779ef2..a6e06f5d0e 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/models.go index 5f0c2ccea8..1a9a939e64 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/models.go @@ -1,23 +1,20 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override -import ( - "github.com/jackc/pgx/v5/pgtype" -) - type Bar struct { - ID pgtype.Text `type:"id"` - OtherID pgtype.Text `type:"other_id"` - About pgtype.Text - Other pgtype.Text `type:"other"` + ID string `type:"id" utype:"nullable_text"` + OtherID string `type:"other_id" utype:"nullable_text"` + About string `utype:"nullable_text"` + Other string `type:"other" utype:"nullable_text"` } type Foo struct { - ID pgtype.Text `source:"foo" type:"id"` - OtherID pgtype.Text `type:"other_id"` - About pgtype.Text `type:"about"` - Other pgtype.Text `type:"this"` + ID string `source:"foo" type:"id" utype:"nullable_text"` + OtherID string `type:"other_id" utype:"nullable_text"` + About string `type:"about" utype:"nullable_text"` + Other string `type:"this" utype:"nullable_text"` + Notnulltext string `utype:"notnull_text"` } diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/query.sql.go new file mode 100644 index 0000000000..6d31e7480e --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package override + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRow(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/schema.sql index 53739ddbb1..30b718298d 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/schema.sql +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/schema.sql @@ -2,7 +2,8 @@ CREATE TABLE foo ( id text, other_id text, about text, - other text + other text, + notnulltext text not null ); CREATE TABLE bar ( diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/sqlc.json index da86badcc7..df8c9de3b0 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/sqlc.json @@ -32,6 +32,16 @@ { "column": "foo.other", "go_struct_tag": "type:\"this\"" + }, + { + "db_type": "text", + "go_struct_tag": "utype:\"notnull_text\"" + }, + { + "db_type": "text", + "go_type": "string", + "nullable": true, + "go_struct_tag": "utype:\"nullable_text\"" } ] } diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/db.go index d0eacb407b..9c19dd4a09 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/models.go index f7d6221389..e47d67ca03 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/models.go @@ -1,14 +1,11 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override -import ( - "database/sql" -) - type Foo struct { - ID sql.NullString `x:"y"` - OtherID sql.NullString + ID string `utype:"nullable_text" x:"y"` + OtherID string `utype:"nullable_text"` + Notnulltext string `utype:"notnull_text"` } diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/query.sql.go new file mode 100644 index 0000000000..0faba2cde4 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package override + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/query.sql b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/schema.sql index f860a58030..82698ec836 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/schema.sql +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/schema.sql @@ -1,4 +1,5 @@ CREATE TABLE foo ( id text, - other_id text + other_id text, + notnulltext text not null ); diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/sqlc.json index 2c6f9e8c7c..f1171fcc11 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/sqlc.json @@ -11,6 +11,16 @@ { "column": "foo.id", "go_struct_tag": "x:\"y\"" + }, + { + "db_type": "text", + "go_struct_tag": "utype:\"notnull_text\"" + }, + { + "db_type": "text", + "go_type": "string", + "nullable": true, + "go_struct_tag": "utype:\"nullable_text\"" } ] } diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/db.go b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/db.go index d0eacb407b..9c19dd4a09 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/db.go +++ b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/models.go b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/models.go index 12db3b6b34..72940ae47d 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/models.go +++ b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/models.go @@ -1,25 +1,24 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override -import () - type Bar struct { - Other string - AlsoTagged string `also:"tagged"` - Tag3 string `tag_with_space:" it's legal!"` + Other string `utype:"notnull_text"` + AlsoTagged string `also:"tagged" utype:"notnull_text"` + Tag3 string `tag_with_space:" it's legal!" utype:"notnull_text"` } type Baz struct { - Other string - AlsoTagged string `also:"tagged"` - Tag3 string `tag_with_space:" it's legal!"` + Other string `utype:"notnull_text"` + AlsoTagged string `also:"tagged" utype:"notnull_text"` + Tag3 string `tag_with_space:" it's legal!" utype:"notnull_text"` } type Foo struct { - Other string - Tagged string `a:"b" x:"y,z"` - Tag3 string `tag_with_space:" it's legal!"` + Other string `utype:"notnull_text"` + Tagged string `a:"b" utype:"notnull_text" x:"y,z"` + Tag3 string `tag_with_space:" it's legal!" utype:"notnull_text"` + Nulltext string `utype:"nullable_text"` } diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/query.sql.go b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/query.sql.go new file mode 100644 index 0000000000..e528f151d9 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package override + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int64 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/query.sql b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/query.sql +++ b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/schema.sql b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/schema.sql index f908060db1..e9aa9bd37a 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/schema.sql +++ b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/schema.sql @@ -1,7 +1,8 @@ CREATE TABLE foo ( other text NOT NULL, tagged text NOT NULL, - tag3 text NOT NULL + tag3 text NOT NULL, + nulltext text ); CREATE TABLE bar ( diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/sqlc.json b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/sqlc.json index a4d54cc3df..a4ca853b6a 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/sqlc.json +++ b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/sqlc.json @@ -19,6 +19,16 @@ { "go_struct_tag": "tag_with_space:\" it's legal!\"", "column": "*.tag3" + }, + { + "db_type": "text", + "go_struct_tag": "utype:\"notnull_text\"" + }, + { + "db_type": "text", + "go_type": "string", + "nullable": true, + "go_struct_tag": "utype:\"nullable_text\"" } ] } diff --git a/internal/endtoend/testdata/overrides_go_types/mysql/go/db.go b/internal/endtoend/testdata/overrides_go_types/mysql/go/db.go index d0eacb407b..9c19dd4a09 100644 --- a/internal/endtoend/testdata/overrides_go_types/mysql/go/db.go +++ b/internal/endtoend/testdata/overrides_go_types/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides_go_types/mysql/go/models.go b/internal/endtoend/testdata/overrides_go_types/mysql/go/models.go index 14ab966f1d..ba5ce329c7 100644 --- a/internal/endtoend/testdata/overrides_go_types/mysql/go/models.go +++ b/internal/endtoend/testdata/overrides_go_types/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides_go_types/mysql/go/query.sql.go b/internal/endtoend/testdata/overrides_go_types/mysql/go/query.sql.go index 574384bb3b..b34ccf09bd 100644 --- a/internal/endtoend/testdata/overrides_go_types/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_go_types/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package override diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/db.go index c6dbb043e5..d27a158d73 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/models.go index dd9674eb35..2a8281a55b 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/query.sql.go index 2ec4568f89..3f162a8688 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package override diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/db.go index 289d779ef2..a6e06f5d0e 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/models.go index ed643a8a5d..5e19a83381 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/query.sql.go index 0e7e2340fa..69124af2d6 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package override diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/db.go index d0eacb407b..9c19dd4a09 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/models.go index a0666902a4..e86b5539c9 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/query.sql.go index b4ef599ed1..d73caecead 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package override diff --git a/internal/endtoend/testdata/overrides_go_types/sqlite/go/db.go b/internal/endtoend/testdata/overrides_go_types/sqlite/go/db.go index d0eacb407b..9c19dd4a09 100644 --- a/internal/endtoend/testdata/overrides_go_types/sqlite/go/db.go +++ b/internal/endtoend/testdata/overrides_go_types/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides_go_types/sqlite/go/models.go b/internal/endtoend/testdata/overrides_go_types/sqlite/go/models.go index 14ab966f1d..ba5ce329c7 100644 --- a/internal/endtoend/testdata/overrides_go_types/sqlite/go/models.go +++ b/internal/endtoend/testdata/overrides_go_types/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides_go_types/sqlite/go/query.sql.go b/internal/endtoend/testdata/overrides_go_types/sqlite/go/query.sql.go new file mode 100644 index 0000000000..e528f151d9 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_types/sqlite/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package override + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int64 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/overrides_go_types/sqlite/query.sql b/internal/endtoend/testdata/overrides_go_types/sqlite/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/overrides_go_types/sqlite/query.sql +++ b/internal/endtoend/testdata/overrides_go_types/sqlite/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/models.go index 5371832477..78aae40b04 100644 --- a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/query.sql.go index 011f716f27..1a12b9c4e4 100644 --- a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/query.sql index 51bdce2a8b..b475d29f5e 100644 --- a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/query.sql @@ -1,8 +1,2 @@ -CREATE TABLE foo ( - bar text, - bam name, - baz name not null -); - -- name: ListFoo :many SELECT * FROM foo; diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..b9579b3dff --- /dev/null +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE foo ( + bar text, + bam name, + baz name not null +); + diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/sqlc.json index 3a74971011..c3f4e1772d 100644 --- a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ], diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/models.go index f0c451a822..af9c0bfefe 100644 --- a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/query.sql.go index 011f716f27..1a12b9c4e4 100644 --- a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/query.sql index d16fdbe9f4..b475d29f5e 100644 --- a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/query.sql @@ -1,8 +1,2 @@ -CREATE TABLE foo ( - bar text, - bam jsonb, - baz jsonb not null -); - -- name: ListFoo :many SELECT * FROM foo; diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..a59f6310a0 --- /dev/null +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE foo ( + bar text, + bam jsonb, + baz jsonb not null +); + diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/sqlc.json index e7eb67f7e4..04508b41ef 100644 --- a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ], diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/models.go index 5371832477..78aae40b04 100644 --- a/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/query.sql.go index e202cc36c5..96d6e40680 100644 --- a/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/query.sql b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/query.sql index 51bdce2a8b..b475d29f5e 100644 --- a/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/query.sql @@ -1,8 +1,2 @@ -CREATE TABLE foo ( - bar text, - bam name, - baz name not null -); - -- name: ListFoo :many SELECT * FROM foo; diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..b9579b3dff --- /dev/null +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE foo ( + bar text, + bam name, + baz name not null +); + diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/sqlc.json index f09332fda5..d59d867c3c 100644 --- a/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ], diff --git a/internal/endtoend/testdata/overrides_pointers/mysql/go/db.go b/internal/endtoend/testdata/overrides_pointers/mysql/go/db.go index d0eacb407b..9c19dd4a09 100644 --- a/internal/endtoend/testdata/overrides_pointers/mysql/go/db.go +++ b/internal/endtoend/testdata/overrides_pointers/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides_pointers/mysql/go/models.go b/internal/endtoend/testdata/overrides_pointers/mysql/go/models.go index e1e63a7e29..0e8f9db623 100644 --- a/internal/endtoend/testdata/overrides_pointers/mysql/go/models.go +++ b/internal/endtoend/testdata/overrides_pointers/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides_pointers/mysql/go/query.sql.go b/internal/endtoend/testdata/overrides_pointers/mysql/go/query.sql.go index 1c96c3161d..0d0b9f293c 100644 --- a/internal/endtoend/testdata/overrides_pointers/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_pointers/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package override diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/db.go index c6dbb043e5..d27a158d73 100644 --- a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/models.go index cc102c042d..f6aa6a379a 100644 --- a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/query.sql.go index 81f25585fd..7b8cadff56 100644 --- a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package override diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/db.go index 289d779ef2..a6e06f5d0e 100644 --- a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/models.go index cc102c042d..f6aa6a379a 100644 --- a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/query.sql.go index 81f25585fd..7b8cadff56 100644 --- a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package override diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/db.go index d0eacb407b..9c19dd4a09 100644 --- a/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/models.go index cc102c042d..f6aa6a379a 100644 --- a/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/query.sql.go index 2c229aa7b2..dfc39890c9 100644 --- a/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package override diff --git a/internal/endtoend/testdata/overrides_result_tag/stdlib/go/db.go b/internal/endtoend/testdata/overrides_result_tag/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/overrides_result_tag/stdlib/go/db.go +++ b/internal/endtoend/testdata/overrides_result_tag/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/overrides_result_tag/stdlib/go/models.go b/internal/endtoend/testdata/overrides_result_tag/stdlib/go/models.go index d66d804407..f82d23a941 100644 --- a/internal/endtoend/testdata/overrides_result_tag/stdlib/go/models.go +++ b/internal/endtoend/testdata/overrides_result_tag/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/overrides_result_tag/stdlib/go/query.sql.go b/internal/endtoend/testdata/overrides_result_tag/stdlib/go/query.sql.go index 42f812400d..deaf22a459 100644 --- a/internal/endtoend/testdata/overrides_result_tag/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_result_tag/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/overrides_result_tag/stdlib/query.sql b/internal/endtoend/testdata/overrides_result_tag/stdlib/query.sql index 5e767e562a..4ca1dd8605 100644 --- a/internal/endtoend/testdata/overrides_result_tag/stdlib/query.sql +++ b/internal/endtoend/testdata/overrides_result_tag/stdlib/query.sql @@ -1,15 +1,3 @@ -CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; - -CREATE TABLE public.accounts ( - id uuid DEFAULT public.uuid_generate_v4() NOT NULL, - state character varying -); - -CREATE TABLE public.users_accounts ( - ID2 uuid DEFAULT public.uuid_generate_v4() NOT NULL, - name character varying -); - -- name: FindAccount :one SELECT a.*, diff --git a/internal/endtoend/testdata/overrides_result_tag/stdlib/schema.sql b/internal/endtoend/testdata/overrides_result_tag/stdlib/schema.sql new file mode 100644 index 0000000000..ebd8d00538 --- /dev/null +++ b/internal/endtoend/testdata/overrides_result_tag/stdlib/schema.sql @@ -0,0 +1,12 @@ +CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; + +CREATE TABLE public.accounts ( + id uuid DEFAULT public.uuid_generate_v4() NOT NULL, + state character varying +); + +CREATE TABLE public.users_accounts ( + ID2 uuid DEFAULT public.uuid_generate_v4() NOT NULL, + name character varying +); + diff --git a/internal/endtoend/testdata/overrides_result_tag/stdlib/sqlc.yaml b/internal/endtoend/testdata/overrides_result_tag/stdlib/sqlc.yaml index 032c4f7fc0..bbfc3b1d95 100644 --- a/internal/endtoend/testdata/overrides_result_tag/stdlib/sqlc.yaml +++ b/internal/endtoend/testdata/overrides_result_tag/stdlib/sqlc.yaml @@ -1,6 +1,6 @@ version: "2" sql: - - schema: "query.sql" + - schema: "schema.sql" queries: "query.sql" engine: "postgresql" gen: diff --git a/internal/endtoend/testdata/overrides_unsigned/mysql/go/db.go b/internal/endtoend/testdata/overrides_unsigned/mysql/go/db.go index 3d2b5bf3a3..cd5bbb8e08 100644 --- a/internal/endtoend/testdata/overrides_unsigned/mysql/go/db.go +++ b/internal/endtoend/testdata/overrides_unsigned/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/overrides_unsigned/mysql/go/models.go b/internal/endtoend/testdata/overrides_unsigned/mysql/go/models.go index 8810c6ed7e..ae8927d7c8 100644 --- a/internal/endtoend/testdata/overrides_unsigned/mysql/go/models.go +++ b/internal/endtoend/testdata/overrides_unsigned/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/overrides_unsigned/mysql/go/query.sql.go b/internal/endtoend/testdata/overrides_unsigned/mysql/go/query.sql.go index 9317dbb40d..9ad07fc0be 100644 --- a/internal/endtoend/testdata/overrides_unsigned/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_unsigned/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package db diff --git a/internal/endtoend/testdata/overrides_unsigned/mysql/query.sql b/internal/endtoend/testdata/overrides_unsigned/mysql/query.sql index 2d1788fe83..348b2c6fda 100644 --- a/internal/endtoend/testdata/overrides_unsigned/mysql/query.sql +++ b/internal/endtoend/testdata/overrides_unsigned/mysql/query.sql @@ -1,11 +1,3 @@ -CREATE TABLE authors ( - id SERIAL, - name text NOT NULL, - rating bigint NOT NULL, - score int UNSIGNED NOT NULL, - bio text -); - -- name: ListAuthors :many SELECT * FROM authors ORDER BY name; diff --git a/internal/endtoend/testdata/overrides_unsigned/mysql/schema.sql b/internal/endtoend/testdata/overrides_unsigned/mysql/schema.sql new file mode 100644 index 0000000000..70567eab0b --- /dev/null +++ b/internal/endtoend/testdata/overrides_unsigned/mysql/schema.sql @@ -0,0 +1,8 @@ +CREATE TABLE authors ( + id SERIAL, + name text NOT NULL, + rating bigint NOT NULL, + score int UNSIGNED NOT NULL, + bio text +); + diff --git a/internal/endtoend/testdata/overrides_unsigned/mysql/sqlc.json b/internal/endtoend/testdata/overrides_unsigned/mysql/sqlc.json index 4c303a41d4..400518f6f4 100644 --- a/internal/endtoend/testdata/overrides_unsigned/mysql/sqlc.json +++ b/internal/endtoend/testdata/overrides_unsigned/mysql/sqlc.json @@ -2,7 +2,7 @@ "version": "2", "sql": [ { - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "engine": "mysql", "gen": { diff --git a/internal/endtoend/testdata/params_duplicate/mysql/go/db.go b/internal/endtoend/testdata/params_duplicate/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/params_duplicate/mysql/go/db.go +++ b/internal/endtoend/testdata/params_duplicate/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/params_duplicate/mysql/go/models.go b/internal/endtoend/testdata/params_duplicate/mysql/go/models.go index 5c2e13edf0..cab9171aaf 100644 --- a/internal/endtoend/testdata/params_duplicate/mysql/go/models.go +++ b/internal/endtoend/testdata/params_duplicate/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/params_duplicate/mysql/go/query.sql.go b/internal/endtoend/testdata/params_duplicate/mysql/go/query.sql.go index f3530cc833..332cb9b26e 100644 --- a/internal/endtoend/testdata/params_duplicate/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/params_duplicate/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/params_duplicate/postgresql/go/db.go b/internal/endtoend/testdata/params_duplicate/postgresql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/params_duplicate/postgresql/go/db.go +++ b/internal/endtoend/testdata/params_duplicate/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/params_duplicate/postgresql/go/models.go b/internal/endtoend/testdata/params_duplicate/postgresql/go/models.go index 5c2e13edf0..cab9171aaf 100644 --- a/internal/endtoend/testdata/params_duplicate/postgresql/go/models.go +++ b/internal/endtoend/testdata/params_duplicate/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/params_duplicate/postgresql/go/query.sql.go b/internal/endtoend/testdata/params_duplicate/postgresql/go/query.sql.go index 5351a09c3e..c93d3d9981 100644 --- a/internal/endtoend/testdata/params_duplicate/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/params_duplicate/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/params_duplicate/postgresql/query.sql b/internal/endtoend/testdata/params_duplicate/postgresql/query.sql index eb5f43c7f9..8a75624011 100644 --- a/internal/endtoend/testdata/params_duplicate/postgresql/query.sql +++ b/internal/endtoend/testdata/params_duplicate/postgresql/query.sql @@ -1,9 +1,3 @@ -CREATE TABLE users ( - id INT PRIMARY KEY, - first_name varchar(255), - last_name varchar(255) -); - /* name: SelectUserByID :many */ SELECT first_name from users where (sqlc.arg(id) = id OR sqlc.arg(id) = 0); diff --git a/internal/endtoend/testdata/params_duplicate/postgresql/schema.sql b/internal/endtoend/testdata/params_duplicate/postgresql/schema.sql new file mode 100644 index 0000000000..554581b60f --- /dev/null +++ b/internal/endtoend/testdata/params_duplicate/postgresql/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + id INT PRIMARY KEY, + first_name varchar(255), + last_name varchar(255) +); + diff --git a/internal/endtoend/testdata/params_duplicate/postgresql/sqlc.json b/internal/endtoend/testdata/params_duplicate/postgresql/sqlc.json index 541dd43a06..2fc79a9f0e 100644 --- a/internal/endtoend/testdata/params_duplicate/postgresql/sqlc.json +++ b/internal/endtoend/testdata/params_duplicate/postgresql/sqlc.json @@ -4,7 +4,7 @@ { "name": "querytest", "path": "go", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "engine": "postgresql" } diff --git a/internal/endtoend/testdata/params_go_keywords/issue.md b/internal/endtoend/testdata/params_go_keywords/issue.md new file mode 100644 index 0000000000..f87f5c14cb --- /dev/null +++ b/internal/endtoend/testdata/params_go_keywords/issue.md @@ -0,0 +1 @@ +# TODO \ No newline at end of file diff --git a/internal/endtoend/testdata/params_go_keywords/postgresql/go/db.go b/internal/endtoend/testdata/params_go_keywords/postgresql/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/params_go_keywords/postgresql/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/params_go_keywords/postgresql/go/models.go b/internal/endtoend/testdata/params_go_keywords/postgresql/go/models.go new file mode 100644 index 0000000000..15d9d8ec70 --- /dev/null +++ b/internal/endtoend/testdata/params_go_keywords/postgresql/go/models.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type GoKeyword struct { + Break pgtype.Text + Default pgtype.Text + Func pgtype.Text + Interface pgtype.Text + Select pgtype.Text + Case pgtype.Text + Defer pgtype.Text + Go pgtype.Text + Map pgtype.Text + Struct pgtype.Text + Chan pgtype.Text + Else pgtype.Text + Goto pgtype.Text + Package pgtype.Text + Switch pgtype.Text + Const pgtype.Text + Fallthrough pgtype.Text + If pgtype.Text + Range pgtype.Text + Type pgtype.Text + Continue pgtype.Text + For pgtype.Text + Import pgtype.Text + Return pgtype.Text + Var pgtype.Text + Q pgtype.Text +} diff --git a/internal/endtoend/testdata/params_go_keywords/postgresql/go/query.sql.go b/internal/endtoend/testdata/params_go_keywords/postgresql/go/query.sql.go new file mode 100644 index 0000000000..5c4c6f5945 --- /dev/null +++ b/internal/endtoend/testdata/params_go_keywords/postgresql/go/query.sql.go @@ -0,0 +1,532 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const keywordBreak = `-- name: KeywordBreak :exec +SELECT $1::text +` + +func (q *Queries) KeywordBreak(ctx context.Context, break_ string) error { + _, err := q.db.Exec(ctx, keywordBreak, break_) + return err +} + +const keywordCase = `-- name: KeywordCase :exec +SELECT $1::text +` + +func (q *Queries) KeywordCase(ctx context.Context, case_ string) error { + _, err := q.db.Exec(ctx, keywordCase, case_) + return err +} + +const keywordChan = `-- name: KeywordChan :exec +SELECT $1::text +` + +func (q *Queries) KeywordChan(ctx context.Context, chan_ string) error { + _, err := q.db.Exec(ctx, keywordChan, chan_) + return err +} + +const keywordConst = `-- name: KeywordConst :exec +SELECT $1::text +` + +func (q *Queries) KeywordConst(ctx context.Context, const_ string) error { + _, err := q.db.Exec(ctx, keywordConst, const_) + return err +} + +const keywordContinue = `-- name: KeywordContinue :exec +SELECT $1::text +` + +func (q *Queries) KeywordContinue(ctx context.Context, continue_ string) error { + _, err := q.db.Exec(ctx, keywordContinue, continue_) + return err +} + +const keywordDefault = `-- name: KeywordDefault :exec +SELECT $1::text +` + +func (q *Queries) KeywordDefault(ctx context.Context, default_ string) error { + _, err := q.db.Exec(ctx, keywordDefault, default_) + return err +} + +const keywordDefer = `-- name: KeywordDefer :exec +SELECT $1::text +` + +func (q *Queries) KeywordDefer(ctx context.Context, defer_ string) error { + _, err := q.db.Exec(ctx, keywordDefer, defer_) + return err +} + +const keywordElse = `-- name: KeywordElse :exec +SELECT $1::text +` + +func (q *Queries) KeywordElse(ctx context.Context, else_ string) error { + _, err := q.db.Exec(ctx, keywordElse, else_) + return err +} + +const keywordFallthrough = `-- name: KeywordFallthrough :exec +SELECT $1::text +` + +func (q *Queries) KeywordFallthrough(ctx context.Context, fallthrough_ string) error { + _, err := q.db.Exec(ctx, keywordFallthrough, fallthrough_) + return err +} + +const keywordFor = `-- name: KeywordFor :exec +SELECT $1::text +` + +func (q *Queries) KeywordFor(ctx context.Context, for_ string) error { + _, err := q.db.Exec(ctx, keywordFor, for_) + return err +} + +const keywordFunc = `-- name: KeywordFunc :exec +SELECT $1::text +` + +func (q *Queries) KeywordFunc(ctx context.Context, func_ string) error { + _, err := q.db.Exec(ctx, keywordFunc, func_) + return err +} + +const keywordGo = `-- name: KeywordGo :exec +SELECT $1::text +` + +func (q *Queries) KeywordGo(ctx context.Context, go_ string) error { + _, err := q.db.Exec(ctx, keywordGo, go_) + return err +} + +const keywordGoto = `-- name: KeywordGoto :exec +SELECT $1::text +` + +func (q *Queries) KeywordGoto(ctx context.Context, goto_ string) error { + _, err := q.db.Exec(ctx, keywordGoto, goto_) + return err +} + +const keywordIf = `-- name: KeywordIf :exec +SELECT $1::text +` + +func (q *Queries) KeywordIf(ctx context.Context, if_ string) error { + _, err := q.db.Exec(ctx, keywordIf, if_) + return err +} + +const keywordImport = `-- name: KeywordImport :exec +SELECT $1::text +` + +func (q *Queries) KeywordImport(ctx context.Context, import_ string) error { + _, err := q.db.Exec(ctx, keywordImport, import_) + return err +} + +const keywordInterface = `-- name: KeywordInterface :exec +SELECT $1::text +` + +func (q *Queries) KeywordInterface(ctx context.Context, interface_ string) error { + _, err := q.db.Exec(ctx, keywordInterface, interface_) + return err +} + +const keywordMap = `-- name: KeywordMap :exec +SELECT $1::text +` + +func (q *Queries) KeywordMap(ctx context.Context, map_ string) error { + _, err := q.db.Exec(ctx, keywordMap, map_) + return err +} + +const keywordPackage = `-- name: KeywordPackage :exec +SELECT $1::text +` + +func (q *Queries) KeywordPackage(ctx context.Context, package_ string) error { + _, err := q.db.Exec(ctx, keywordPackage, package_) + return err +} + +const keywordQ = `-- name: KeywordQ :exec +SELECT $1::text +` + +func (q *Queries) KeywordQ(ctx context.Context, q_ string) error { + _, err := q.db.Exec(ctx, keywordQ, q_) + return err +} + +const keywordRange = `-- name: KeywordRange :exec +SELECT $1::text +` + +func (q *Queries) KeywordRange(ctx context.Context, range_ string) error { + _, err := q.db.Exec(ctx, keywordRange, range_) + return err +} + +const keywordReturn = `-- name: KeywordReturn :exec +SELECT $1::text +` + +func (q *Queries) KeywordReturn(ctx context.Context, return_ string) error { + _, err := q.db.Exec(ctx, keywordReturn, return_) + return err +} + +const keywordSelect = `-- name: KeywordSelect :exec +SELECT $1::text +` + +func (q *Queries) KeywordSelect(ctx context.Context, select_ string) error { + _, err := q.db.Exec(ctx, keywordSelect, select_) + return err +} + +const keywordStruct = `-- name: KeywordStruct :exec +SELECT $1::text +` + +func (q *Queries) KeywordStruct(ctx context.Context, struct_ string) error { + _, err := q.db.Exec(ctx, keywordStruct, struct_) + return err +} + +const keywordSwitch = `-- name: KeywordSwitch :exec +SELECT $1::text +` + +func (q *Queries) KeywordSwitch(ctx context.Context, switch_ string) error { + _, err := q.db.Exec(ctx, keywordSwitch, switch_) + return err +} + +const keywordType = `-- name: KeywordType :exec +SELECT $1::text +` + +func (q *Queries) KeywordType(ctx context.Context, type_ string) error { + _, err := q.db.Exec(ctx, keywordType, type_) + return err +} + +const keywordVar = `-- name: KeywordVar :exec +SELECT $1::text +` + +func (q *Queries) KeywordVar(ctx context.Context, var_ string) error { + _, err := q.db.Exec(ctx, keywordVar, var_) + return err +} + +const selectBreak = `-- name: SelectBreak :one +SELECT "break" FROM go_keywords +` + +func (q *Queries) SelectBreak(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectBreak) + var break_ pgtype.Text + err := row.Scan(&break_) + return break_, err +} + +const selectCase = `-- name: SelectCase :one +SELECT "case" FROM go_keywords +` + +func (q *Queries) SelectCase(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectCase) + var case_ pgtype.Text + err := row.Scan(&case_) + return case_, err +} + +const selectChan = `-- name: SelectChan :one +SELECT "chan" FROM go_keywords +` + +func (q *Queries) SelectChan(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectChan) + var chan_ pgtype.Text + err := row.Scan(&chan_) + return chan_, err +} + +const selectConst = `-- name: SelectConst :one +SELECT "const" FROM go_keywords +` + +func (q *Queries) SelectConst(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectConst) + var const_ pgtype.Text + err := row.Scan(&const_) + return const_, err +} + +const selectContinue = `-- name: SelectContinue :one +SELECT "continue" FROM go_keywords +` + +func (q *Queries) SelectContinue(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectContinue) + var continue_ pgtype.Text + err := row.Scan(&continue_) + return continue_, err +} + +const selectDefault = `-- name: SelectDefault :one +SELECT "default" FROM go_keywords +` + +func (q *Queries) SelectDefault(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectDefault) + var default_ pgtype.Text + err := row.Scan(&default_) + return default_, err +} + +const selectDefer = `-- name: SelectDefer :one +SELECT "defer" FROM go_keywords +` + +func (q *Queries) SelectDefer(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectDefer) + var defer_ pgtype.Text + err := row.Scan(&defer_) + return defer_, err +} + +const selectElse = `-- name: SelectElse :one +SELECT "else" FROM go_keywords +` + +func (q *Queries) SelectElse(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectElse) + var else_ pgtype.Text + err := row.Scan(&else_) + return else_, err +} + +const selectFallthrough = `-- name: SelectFallthrough :one +SELECT "fallthrough" FROM go_keywords +` + +func (q *Queries) SelectFallthrough(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectFallthrough) + var fallthrough_ pgtype.Text + err := row.Scan(&fallthrough_) + return fallthrough_, err +} + +const selectFor = `-- name: SelectFor :one +SELECT "for" FROM go_keywords +` + +func (q *Queries) SelectFor(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectFor) + var for_ pgtype.Text + err := row.Scan(&for_) + return for_, err +} + +const selectFunc = `-- name: SelectFunc :one +SELECT "func" FROM go_keywords +` + +func (q *Queries) SelectFunc(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectFunc) + var func_ pgtype.Text + err := row.Scan(&func_) + return func_, err +} + +const selectGo = `-- name: SelectGo :one +SELECT "go" FROM go_keywords +` + +func (q *Queries) SelectGo(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectGo) + var go_ pgtype.Text + err := row.Scan(&go_) + return go_, err +} + +const selectGoto = `-- name: SelectGoto :one +SELECT "goto" FROM go_keywords +` + +func (q *Queries) SelectGoto(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectGoto) + var goto_ pgtype.Text + err := row.Scan(&goto_) + return goto_, err +} + +const selectIf = `-- name: SelectIf :one +SELECT "if" FROM go_keywords +` + +func (q *Queries) SelectIf(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectIf) + var if_ pgtype.Text + err := row.Scan(&if_) + return if_, err +} + +const selectImport = `-- name: SelectImport :one +SELECT "import" FROM go_keywords +` + +func (q *Queries) SelectImport(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectImport) + var import_ pgtype.Text + err := row.Scan(&import_) + return import_, err +} + +const selectInterface = `-- name: SelectInterface :one +SELECT "interface" FROM go_keywords +` + +func (q *Queries) SelectInterface(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectInterface) + var interface_ pgtype.Text + err := row.Scan(&interface_) + return interface_, err +} + +const selectMap = `-- name: SelectMap :one +SELECT "map" FROM go_keywords +` + +func (q *Queries) SelectMap(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectMap) + var map_ pgtype.Text + err := row.Scan(&map_) + return map_, err +} + +const selectPackage = `-- name: SelectPackage :one +SELECT "package" FROM go_keywords +` + +func (q *Queries) SelectPackage(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectPackage) + var package_ pgtype.Text + err := row.Scan(&package_) + return package_, err +} + +const selectQ = `-- name: SelectQ :one +SELECT "q" FROM go_keywords +` + +func (q *Queries) SelectQ(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectQ) + var q_ pgtype.Text + err := row.Scan(&q_) + return q_, err +} + +const selectRange = `-- name: SelectRange :one +SELECT "range" FROM go_keywords +` + +func (q *Queries) SelectRange(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectRange) + var range_ pgtype.Text + err := row.Scan(&range_) + return range_, err +} + +const selectReturn = `-- name: SelectReturn :one +SELECT "return" FROM go_keywords +` + +func (q *Queries) SelectReturn(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectReturn) + var return_ pgtype.Text + err := row.Scan(&return_) + return return_, err +} + +const selectSelect = `-- name: SelectSelect :one +SELECT "select" FROM go_keywords +` + +func (q *Queries) SelectSelect(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectSelect) + var select_ pgtype.Text + err := row.Scan(&select_) + return select_, err +} + +const selectStruct = `-- name: SelectStruct :one +SELECT "struct" FROM go_keywords +` + +func (q *Queries) SelectStruct(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectStruct) + var struct_ pgtype.Text + err := row.Scan(&struct_) + return struct_, err +} + +const selectSwitch = `-- name: SelectSwitch :one +SELECT "switch" FROM go_keywords +` + +func (q *Queries) SelectSwitch(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectSwitch) + var switch_ pgtype.Text + err := row.Scan(&switch_) + return switch_, err +} + +const selectType = `-- name: SelectType :one +SELECT "type" FROM go_keywords +` + +func (q *Queries) SelectType(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectType) + var type_ pgtype.Text + err := row.Scan(&type_) + return type_, err +} + +const selectVar = `-- name: SelectVar :one +SELECT "var" FROM go_keywords +` + +func (q *Queries) SelectVar(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectVar) + var var_ pgtype.Text + err := row.Scan(&var_) + return var_, err +} diff --git a/internal/endtoend/testdata/params_go_keywords/postgresql/query.sql b/internal/endtoend/testdata/params_go_keywords/postgresql/query.sql new file mode 100644 index 0000000000..bc45b1166f --- /dev/null +++ b/internal/endtoend/testdata/params_go_keywords/postgresql/query.sql @@ -0,0 +1,155 @@ +-- name: KeywordBreak :exec +SELECT sqlc.arg('break')::text; + +-- name: KeywordDefault :exec +SELECT sqlc.arg('default')::text; + +-- name: KeywordFunc :exec +SELECT sqlc.arg('func')::text; + +-- name: KeywordInterface :exec +SELECT sqlc.arg('interface')::text; + +-- name: KeywordSelect :exec +SELECT sqlc.arg('select')::text; + +-- name: KeywordCase :exec +SELECT sqlc.arg('case')::text; + +-- name: KeywordDefer :exec +SELECT sqlc.arg('defer')::text; + +-- name: KeywordGo :exec +SELECT sqlc.arg('go')::text; + +-- name: KeywordMap :exec +SELECT sqlc.arg('map')::text; + +-- name: KeywordStruct :exec +SELECT sqlc.arg('struct')::text; + +-- name: KeywordChan :exec +SELECT sqlc.arg('chan')::text; + +-- name: KeywordElse :exec +SELECT sqlc.arg('else')::text; + +-- name: KeywordGoto :exec +SELECT sqlc.arg('goto')::text; + +-- name: KeywordPackage :exec +SELECT sqlc.arg('package')::text; + +-- name: KeywordSwitch :exec +SELECT sqlc.arg('switch')::text; + +-- name: KeywordConst :exec +SELECT sqlc.arg('const')::text; + +-- name: KeywordFallthrough :exec +SELECT sqlc.arg('fallthrough')::text; + +-- name: KeywordIf :exec +SELECT sqlc.arg('if')::text; + +-- name: KeywordRange :exec +SELECT sqlc.arg('range')::text; + +-- name: KeywordType :exec +SELECT sqlc.arg('type')::text; + +-- name: KeywordContinue :exec +SELECT sqlc.arg('continue')::text; + +-- name: KeywordFor :exec +SELECT sqlc.arg('for')::text; + +-- name: KeywordImport :exec +SELECT sqlc.arg('import')::text; + +-- name: KeywordReturn :exec +SELECT sqlc.arg('return')::text; + +-- name: KeywordVar :exec +SELECT sqlc.arg('var')::text; + +-- name: KeywordQ :exec +SELECT sqlc.arg('q')::text; + +-- name: SelectBreak :one +SELECT "break" FROM go_keywords; + +-- name: SelectDefault :one +SELECT "default" FROM go_keywords; + +-- name: SelectFunc :one +SELECT "func" FROM go_keywords; + +-- name: SelectInterface :one +SELECT "interface" FROM go_keywords; + +-- name: SelectSelect :one +SELECT "select" FROM go_keywords; + +-- name: SelectCase :one +SELECT "case" FROM go_keywords; + +-- name: SelectDefer :one +SELECT "defer" FROM go_keywords; + +-- name: SelectGo :one +SELECT "go" FROM go_keywords; + +-- name: SelectMap :one +SELECT "map" FROM go_keywords; + +-- name: SelectStruct :one +SELECT "struct" FROM go_keywords; + +-- name: SelectChan :one +SELECT "chan" FROM go_keywords; + +-- name: SelectElse :one +SELECT "else" FROM go_keywords; + +-- name: SelectGoto :one +SELECT "goto" FROM go_keywords; + +-- name: SelectPackage :one +SELECT "package" FROM go_keywords; + +-- name: SelectSwitch :one +SELECT "switch" FROM go_keywords; + +-- name: SelectConst :one +SELECT "const" FROM go_keywords; + +-- name: SelectFallthrough :one +SELECT "fallthrough" FROM go_keywords; + +-- name: SelectIf :one +SELECT "if" FROM go_keywords; + +-- name: SelectRange :one +SELECT "range" FROM go_keywords; + +-- name: SelectType :one +SELECT "type" FROM go_keywords; + +-- name: SelectContinue :one +SELECT "continue" FROM go_keywords; + +-- name: SelectFor :one +SELECT "for" FROM go_keywords; + +-- name: SelectImport :one +SELECT "import" FROM go_keywords; + +-- name: SelectReturn :one +SELECT "return" FROM go_keywords; + +-- name: SelectVar :one +SELECT "var" FROM go_keywords; + +-- name: SelectQ :one +SELECT "q" FROM go_keywords; diff --git a/internal/endtoend/testdata/params_go_keywords/postgresql/schema.sql b/internal/endtoend/testdata/params_go_keywords/postgresql/schema.sql new file mode 100644 index 0000000000..100be50211 --- /dev/null +++ b/internal/endtoend/testdata/params_go_keywords/postgresql/schema.sql @@ -0,0 +1,28 @@ +CREATE TABLE go_keywords ( + "break" TEXT, + "default" TEXT, + "func" TEXT, + "interface" TEXT, + "select" TEXT, + "case" TEXT, + "defer" TEXT, + "go" TEXT, + "map" TEXT, + "struct" TEXT, + "chan" TEXT, + "else" TEXT, + "goto" TEXT, + "package" TEXT, + "switch" TEXT, + "const" TEXT, + "fallthrough" TEXT, + "if" TEXT, + "range" TEXT, + "type" TEXT, + "continue" TEXT, + "for" TEXT, + "import" TEXT, + "return" TEXT, + "var" TEXT, + "q" TEXT +); diff --git a/internal/endtoend/testdata/params_go_keywords/postgresql/sqlc.yaml b/internal/endtoend/testdata/params_go_keywords/postgresql/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/params_go_keywords/postgresql/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/params_in_nested_func/mysql/db/db.go b/internal/endtoend/testdata/params_in_nested_func/mysql/db/db.go new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/params_in_nested_func/mysql/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/params_in_nested_func/mysql/db/models.go b/internal/endtoend/testdata/params_in_nested_func/mysql/db/models.go new file mode 100644 index 0000000000..1e7f7960a4 --- /dev/null +++ b/internal/endtoend/testdata/params_in_nested_func/mysql/db/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "database/sql" +) + +type Routergroup struct { + Groupid uint32 + Groupname string + Defaultconfigid sql.NullInt32 + Defaultfirmwareversion sql.NullString + Parentgroupid sql.NullInt32 + Firmwarepolicy sql.NullString + Styles sql.NullString +} diff --git a/internal/endtoend/testdata/params_in_nested_func/mysql/db/query.sql.go b/internal/endtoend/testdata/params_in_nested_func/mysql/db/query.sql.go new file mode 100644 index 0000000000..70e532ae4e --- /dev/null +++ b/internal/endtoend/testdata/params_in_nested_func/mysql/db/query.sql.go @@ -0,0 +1,55 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" + "database/sql" +) + +const getGroups = `-- name: GetGroups :many +SELECT + rg.groupId, + rg.groupName +FROM + RouterGroup rg +WHERE + rg.groupName LIKE CONCAT('%', COALESCE(?, rg.groupName), '%') AND + rg.groupId = COALESCE(?, rg.groupId) +` + +type GetGroupsParams struct { + GroupName interface{} + GroupId sql.NullInt32 +} + +type GetGroupsRow struct { + Groupid uint32 + Groupname string +} + +func (q *Queries) GetGroups(ctx context.Context, arg GetGroupsParams) ([]GetGroupsRow, error) { + rows, err := q.db.QueryContext(ctx, getGroups, arg.GroupName, arg.GroupId) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetGroupsRow + for rows.Next() { + var i GetGroupsRow + if err := rows.Scan(&i.Groupid, &i.Groupname); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/params_in_nested_func/mysql/query.sql b/internal/endtoend/testdata/params_in_nested_func/mysql/query.sql new file mode 100644 index 0000000000..8a2a78fa36 --- /dev/null +++ b/internal/endtoend/testdata/params_in_nested_func/mysql/query.sql @@ -0,0 +1,9 @@ +-- name: GetGroups :many +SELECT + rg.groupId, + rg.groupName +FROM + RouterGroup rg +WHERE + rg.groupName LIKE CONCAT('%', COALESCE(sqlc.narg('groupName'), rg.groupName), '%') AND + rg.groupId = COALESCE(sqlc.narg('groupId'), rg.groupId); diff --git a/internal/endtoend/testdata/params_in_nested_func/mysql/schema.sql b/internal/endtoend/testdata/params_in_nested_func/mysql/schema.sql new file mode 100644 index 0000000000..12e0fb3b85 --- /dev/null +++ b/internal/endtoend/testdata/params_in_nested_func/mysql/schema.sql @@ -0,0 +1,10 @@ +create table RouterGroup +( + groupId int unsigned auto_increment primary key, + groupName varchar(100) not null, + defaultConfigId int unsigned null, + defaultFirmwareVersion varchar(12) null, + parentGroupId int unsigned null, + firmwarePolicy varchar(45) null, + styles text null +); diff --git a/internal/endtoend/testdata/params_in_nested_func/mysql/sqlc.yaml b/internal/endtoend/testdata/params_in_nested_func/mysql/sqlc.yaml new file mode 100644 index 0000000000..e8b45d313d --- /dev/null +++ b/internal/endtoend/testdata/params_in_nested_func/mysql/sqlc.yaml @@ -0,0 +1,8 @@ +version: '2' +sql: +- schema: schema.sql + queries: query.sql + engine: mysql + gen: + go: + out: db diff --git a/internal/endtoend/testdata/params_in_nested_func/postgresql/db/db.go b/internal/endtoend/testdata/params_in_nested_func/postgresql/db/db.go new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/params_in_nested_func/postgresql/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/params_in_nested_func/postgresql/db/models.go b/internal/endtoend/testdata/params_in_nested_func/postgresql/db/models.go new file mode 100644 index 0000000000..385bc233aa --- /dev/null +++ b/internal/endtoend/testdata/params_in_nested_func/postgresql/db/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "database/sql" +) + +type Routergroup struct { + Groupid int32 + Groupname string + Defaultconfigid sql.NullInt32 + Defaultfirmwareversion sql.NullString + Parentgroupid sql.NullInt32 + Firmwarepolicy sql.NullString + Styles sql.NullString +} diff --git a/internal/endtoend/testdata/params_in_nested_func/postgresql/db/query.sql.go b/internal/endtoend/testdata/params_in_nested_func/postgresql/db/query.sql.go new file mode 100644 index 0000000000..32ab16ccc6 --- /dev/null +++ b/internal/endtoend/testdata/params_in_nested_func/postgresql/db/query.sql.go @@ -0,0 +1,55 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" + "database/sql" +) + +const getGroups = `-- name: GetGroups :many +SELECT + rg.groupId, + rg.groupName +FROM + RouterGroup rg +WHERE + rg.groupName LIKE CONCAT('%', COALESCE($1::text, rg.groupName), '%') AND + rg.groupId = COALESCE($2, rg.groupId) +` + +type GetGroupsParams struct { + GroupName sql.NullString + GroupId sql.NullInt32 +} + +type GetGroupsRow struct { + Groupid int32 + Groupname string +} + +func (q *Queries) GetGroups(ctx context.Context, arg GetGroupsParams) ([]GetGroupsRow, error) { + rows, err := q.db.QueryContext(ctx, getGroups, arg.GroupName, arg.GroupId) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetGroupsRow + for rows.Next() { + var i GetGroupsRow + if err := rows.Scan(&i.Groupid, &i.Groupname); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/params_in_nested_func/postgresql/query.sql b/internal/endtoend/testdata/params_in_nested_func/postgresql/query.sql new file mode 100644 index 0000000000..7732269d25 --- /dev/null +++ b/internal/endtoend/testdata/params_in_nested_func/postgresql/query.sql @@ -0,0 +1,9 @@ +-- name: GetGroups :many +SELECT + rg.groupId, + rg.groupName +FROM + RouterGroup rg +WHERE + rg.groupName LIKE CONCAT('%', COALESCE(sqlc.narg('groupName')::text, rg.groupName), '%') AND + rg.groupId = COALESCE(sqlc.narg('groupId'), rg.groupId); diff --git a/internal/endtoend/testdata/params_in_nested_func/postgresql/schema.sql b/internal/endtoend/testdata/params_in_nested_func/postgresql/schema.sql new file mode 100644 index 0000000000..66cfd02733 --- /dev/null +++ b/internal/endtoend/testdata/params_in_nested_func/postgresql/schema.sql @@ -0,0 +1,10 @@ +create table RouterGroup +( + groupId serial primary key, + groupName varchar(100) not null, + defaultConfigId int null, + defaultFirmwareVersion varchar(12) null, + parentGroupId int null, + firmwarePolicy varchar(45) null, + styles text null +); diff --git a/internal/endtoend/testdata/params_in_nested_func/postgresql/sqlc.yaml b/internal/endtoend/testdata/params_in_nested_func/postgresql/sqlc.yaml new file mode 100644 index 0000000000..936b0171ee --- /dev/null +++ b/internal/endtoend/testdata/params_in_nested_func/postgresql/sqlc.yaml @@ -0,0 +1,8 @@ +version: '2' +sql: +- schema: schema.sql + queries: query.sql + engine: postgresql + gen: + go: + out: db diff --git a/internal/endtoend/testdata/params_location/mysql/go/db.go b/internal/endtoend/testdata/params_location/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/params_location/mysql/go/db.go +++ b/internal/endtoend/testdata/params_location/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/params_location/mysql/go/models.go b/internal/endtoend/testdata/params_location/mysql/go/models.go index b5f5c9b7ed..54ca4ce9d6 100644 --- a/internal/endtoend/testdata/params_location/mysql/go/models.go +++ b/internal/endtoend/testdata/params_location/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/params_location/mysql/go/query.sql.go b/internal/endtoend/testdata/params_location/mysql/go/query.sql.go index ba60001e0b..908e4240d4 100644 --- a/internal/endtoend/testdata/params_location/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/params_location/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/params_location/mysql/query.sql b/internal/endtoend/testdata/params_location/mysql/query.sql index 824583afa8..cfa804c252 100644 --- a/internal/endtoend/testdata/params_location/mysql/query.sql +++ b/internal/endtoend/testdata/params_location/mysql/query.sql @@ -1,17 +1,3 @@ -CREATE TABLE users ( - id integer NOT NULL AUTO_INCREMENT PRIMARY KEY, - first_name varchar(255) NOT NULL, - last_name varchar(255), - age integer NOT NULL, - job_status varchar(10) NOT NULL -) ENGINE=InnoDB; - -CREATE TABLE orders ( - id integer NOT NULL AUTO_INCREMENT PRIMARY KEY, - price DECIMAL(13, 4) NOT NULL, - user_id integer NOT NULL -) ENGINE=InnoDB; - /* name: ListUsersByID :many */ SELECT first_name, id, last_name FROM users WHERE id < ?; diff --git a/internal/endtoend/testdata/params_location/mysql/schema.sql b/internal/endtoend/testdata/params_location/mysql/schema.sql new file mode 100644 index 0000000000..5df4b6c7a7 --- /dev/null +++ b/internal/endtoend/testdata/params_location/mysql/schema.sql @@ -0,0 +1,14 @@ +CREATE TABLE users ( + id integer NOT NULL AUTO_INCREMENT PRIMARY KEY, + first_name varchar(255) NOT NULL, + last_name varchar(255), + age integer NOT NULL, + job_status varchar(10) NOT NULL +) ENGINE=InnoDB; + +CREATE TABLE orders ( + id integer NOT NULL AUTO_INCREMENT PRIMARY KEY, + price DECIMAL(13, 4) NOT NULL, + user_id integer NOT NULL +) ENGINE=InnoDB; + diff --git a/internal/endtoend/testdata/params_location/mysql/sqlc.json b/internal/endtoend/testdata/params_location/mysql/sqlc.json index bfbd23e211..a9e7b055a4 100644 --- a/internal/endtoend/testdata/params_location/mysql/sqlc.json +++ b/internal/endtoend/testdata/params_location/mysql/sqlc.json @@ -4,7 +4,7 @@ { "name": "querytest", "path": "go", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "engine": "mysql" } diff --git a/internal/endtoend/testdata/params_location/postgresql/pgx/v4/exec.json b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/models.go index 512742184a..9a2addf733 100644 --- a/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/query.sql.go index d8dd076226..2422761542 100644 --- a/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/params_location/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/query.sql index 7bec1be5c5..7f973bf409 100644 --- a/internal/endtoend/testdata/params_location/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/query.sql @@ -1,17 +1,3 @@ -CREATE TABLE users ( - id SERIAL NOT NULL, - first_name varchar(255) NOT NULL, - last_name varchar(255), - age integer NOT NULL, - job_status varchar(10) NOT NULL -); - -CREATE TABLE orders ( - id SERIAL NOT NULL, - price DECIMAL(13, 4) NOT NULL, - user_id integer NOT NULL -); - /* name: ListUsersByID :many */ SELECT first_name, id, last_name FROM users WHERE id < $1; diff --git a/internal/endtoend/testdata/params_location/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..a150e2a887 --- /dev/null +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/schema.sql @@ -0,0 +1,14 @@ +CREATE TABLE users ( + id SERIAL NOT NULL, + first_name varchar(255) NOT NULL, + last_name varchar(255), + age integer NOT NULL, + job_status varchar(10) NOT NULL +); + +CREATE TABLE orders ( + id SERIAL NOT NULL, + price DECIMAL(13, 4) NOT NULL, + user_id integer NOT NULL +); + diff --git a/internal/endtoend/testdata/params_location/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/params_location/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/params_location/postgresql/pgx/v5/exec.json b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/models.go index d1c0243acb..333ac0e7e3 100644 --- a/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/query.sql.go index f47e1cb237..5df3216911 100644 --- a/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/params_location/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/query.sql index 7bec1be5c5..7f973bf409 100644 --- a/internal/endtoend/testdata/params_location/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/query.sql @@ -1,17 +1,3 @@ -CREATE TABLE users ( - id SERIAL NOT NULL, - first_name varchar(255) NOT NULL, - last_name varchar(255), - age integer NOT NULL, - job_status varchar(10) NOT NULL -); - -CREATE TABLE orders ( - id SERIAL NOT NULL, - price DECIMAL(13, 4) NOT NULL, - user_id integer NOT NULL -); - /* name: ListUsersByID :many */ SELECT first_name, id, last_name FROM users WHERE id < $1; diff --git a/internal/endtoend/testdata/params_location/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..a150e2a887 --- /dev/null +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/schema.sql @@ -0,0 +1,14 @@ +CREATE TABLE users ( + id SERIAL NOT NULL, + first_name varchar(255) NOT NULL, + last_name varchar(255), + age integer NOT NULL, + job_status varchar(10) NOT NULL +); + +CREATE TABLE orders ( + id SERIAL NOT NULL, + price DECIMAL(13, 4) NOT NULL, + user_id integer NOT NULL +); + diff --git a/internal/endtoend/testdata/params_location/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/params_location/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/params_location/postgresql/stdlib/exec.json b/internal/endtoend/testdata/params_location/postgresql/stdlib/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/params_location/postgresql/stdlib/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/params_location/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/params_location/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/params_location/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/params_location/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/params_location/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/params_location/postgresql/stdlib/go/models.go index b5f5c9b7ed..54ca4ce9d6 100644 --- a/internal/endtoend/testdata/params_location/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/params_location/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/params_location/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/params_location/postgresql/stdlib/go/query.sql.go index e9d33d8aa1..6f4b961034 100644 --- a/internal/endtoend/testdata/params_location/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/params_location/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/params_location/postgresql/stdlib/query.sql b/internal/endtoend/testdata/params_location/postgresql/stdlib/query.sql index 7bec1be5c5..7f973bf409 100644 --- a/internal/endtoend/testdata/params_location/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/params_location/postgresql/stdlib/query.sql @@ -1,17 +1,3 @@ -CREATE TABLE users ( - id SERIAL NOT NULL, - first_name varchar(255) NOT NULL, - last_name varchar(255), - age integer NOT NULL, - job_status varchar(10) NOT NULL -); - -CREATE TABLE orders ( - id SERIAL NOT NULL, - price DECIMAL(13, 4) NOT NULL, - user_id integer NOT NULL -); - /* name: ListUsersByID :many */ SELECT first_name, id, last_name FROM users WHERE id < $1; diff --git a/internal/endtoend/testdata/params_location/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/params_location/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..a150e2a887 --- /dev/null +++ b/internal/endtoend/testdata/params_location/postgresql/stdlib/schema.sql @@ -0,0 +1,14 @@ +CREATE TABLE users ( + id SERIAL NOT NULL, + first_name varchar(255) NOT NULL, + last_name varchar(255), + age integer NOT NULL, + job_status varchar(10) NOT NULL +); + +CREATE TABLE orders ( + id SERIAL NOT NULL, + price DECIMAL(13, 4) NOT NULL, + user_id integer NOT NULL +); + diff --git a/internal/endtoend/testdata/params_location/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/params_location/postgresql/stdlib/sqlc.json index 696ed223db..f5a835c5a6 100644 --- a/internal/endtoend/testdata/params_location/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/params_location/postgresql/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "name": "querytest", "path": "go", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "engine": "postgresql" } diff --git a/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/db.go b/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/db.go +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/models.go b/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/models.go index fb85babb6d..6ed28e2de9 100644 --- a/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/models.go +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/query.sql.go b/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/query.sql.go index c00a46e909..57aba80593 100644 --- a/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/query.sql b/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/query.sql index 6f2de1e48d..e241f76a7a 100644 --- a/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/query.sql +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/query.sql @@ -1,8 +1,3 @@ -CREATE TABLE users ( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - name VARCHAR(255) -) ENGINE=InnoDB; - -- name: FindByID :many SELECT * FROM users WHERE ? = id; diff --git a/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/schema.sql b/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/schema.sql new file mode 100644 index 0000000000..b2c6d8d14e --- /dev/null +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE users ( + id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(255) +) ENGINE=InnoDB; + diff --git a/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/sqlc.json b/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/sqlc.json +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/exec.json b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/db.go b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/db.go +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/models.go b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/models.go index fb85babb6d..6ed28e2de9 100644 --- a/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/models.go +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/query.sql.go b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/query.sql.go index 1ca8c46ddc..a04cba9fe0 100644 --- a/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/query.sql b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/query.sql index 042d4e6f58..50b95ea32e 100644 --- a/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/query.sql +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/query.sql @@ -1,8 +1,3 @@ -CREATE TABLE users ( - id INT PRIMARY KEY, - name VARCHAR(255) -); - -- name: FindByID :many SELECT * FROM users WHERE $1 = id; diff --git a/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/schema.sql b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/schema.sql new file mode 100644 index 0000000000..33ca489ae5 --- /dev/null +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE users ( + id INT PRIMARY KEY, + name VARCHAR(255) +); + diff --git a/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/sqlc.json b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/sqlc.json +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/params_two/mysql/go/db.go b/internal/endtoend/testdata/params_two/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/params_two/mysql/go/db.go +++ b/internal/endtoend/testdata/params_two/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/params_two/mysql/go/models.go b/internal/endtoend/testdata/params_two/mysql/go/models.go index bd0fa15100..de35bade9f 100644 --- a/internal/endtoend/testdata/params_two/mysql/go/models.go +++ b/internal/endtoend/testdata/params_two/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/params_two/mysql/go/query.sql.go b/internal/endtoend/testdata/params_two/mysql/go/query.sql.go index d7bac3804f..9f1edc6aef 100644 --- a/internal/endtoend/testdata/params_two/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/params_two/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/params_two/mysql/query.sql b/internal/endtoend/testdata/params_two/mysql/query.sql index ca95df9cef..66937099c3 100644 --- a/internal/endtoend/testdata/params_two/mysql/query.sql +++ b/internal/endtoend/testdata/params_two/mysql/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (a text, b text); - /* name: FooByAandB :many */ SELECT a, b FROM foo WHERE a = ? and b = ?; diff --git a/internal/endtoend/testdata/params_two/mysql/schema.sql b/internal/endtoend/testdata/params_two/mysql/schema.sql new file mode 100644 index 0000000000..a68a0e4de0 --- /dev/null +++ b/internal/endtoend/testdata/params_two/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); + diff --git a/internal/endtoend/testdata/params_two/mysql/sqlc.json b/internal/endtoend/testdata/params_two/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/params_two/mysql/sqlc.json +++ b/internal/endtoend/testdata/params_two/mysql/sqlc.json @@ -5,7 +5,7 @@ "engine": "mysql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/models.go index bd0fa15100..de35bade9f 100644 --- a/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/query.sql.go index 4ef756cc07..da0ea85d0d 100644 --- a/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/params_two/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/query.sql index 20b49184ce..83fd1ea40c 100644 --- a/internal/endtoend/testdata/params_two/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (a text, b text); - -- name: FooByAandB :many SELECT a, b FROM foo WHERE a = $1 and b = $2; diff --git a/internal/endtoend/testdata/params_two/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..a68a0e4de0 --- /dev/null +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); + diff --git a/internal/endtoend/testdata/params_two/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/params_two/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/models.go index fa800a9a15..3ee86d8810 100644 --- a/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/query.sql.go index 3e5e46a8ae..5c7953cc70 100644 --- a/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/params_two/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/params_two/postgresql/pgx/v5/query.sql index 20b49184ce..83fd1ea40c 100644 --- a/internal/endtoend/testdata/params_two/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v5/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (a text, b text); - -- name: FooByAandB :many SELECT a, b FROM foo WHERE a = $1 and b = $2; diff --git a/internal/endtoend/testdata/params_two/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/params_two/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..a68a0e4de0 --- /dev/null +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); + diff --git a/internal/endtoend/testdata/params_two/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/params_two/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/params_two/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/params_two/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/params_two/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/params_two/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/params_two/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/params_two/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/params_two/postgresql/stdlib/go/models.go index bd0fa15100..de35bade9f 100644 --- a/internal/endtoend/testdata/params_two/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/params_two/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/params_two/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/params_two/postgresql/stdlib/go/query.sql.go index 8b6700cbe2..5797bf0f08 100644 --- a/internal/endtoend/testdata/params_two/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/params_two/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/params_two/postgresql/stdlib/query.sql b/internal/endtoend/testdata/params_two/postgresql/stdlib/query.sql index 20b49184ce..83fd1ea40c 100644 --- a/internal/endtoend/testdata/params_two/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/params_two/postgresql/stdlib/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (a text, b text); - -- name: FooByAandB :many SELECT a, b FROM foo WHERE a = $1 and b = $2; diff --git a/internal/endtoend/testdata/params_two/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/params_two/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..a68a0e4de0 --- /dev/null +++ b/internal/endtoend/testdata/params_two/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); + diff --git a/internal/endtoend/testdata/params_two/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/params_two/postgresql/stdlib/sqlc.json index de427d069f..cd518671ac 100644 --- a/internal/endtoend/testdata/params_two/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/params_two/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "engine": "postgresql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/pattern_in_expr/mysql/go/db.go b/internal/endtoend/testdata/pattern_in_expr/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/pattern_in_expr/mysql/go/db.go +++ b/internal/endtoend/testdata/pattern_in_expr/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/pattern_in_expr/mysql/go/models.go b/internal/endtoend/testdata/pattern_in_expr/mysql/go/models.go index 9a43a248cb..41f892cc4a 100644 --- a/internal/endtoend/testdata/pattern_in_expr/mysql/go/models.go +++ b/internal/endtoend/testdata/pattern_in_expr/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/pattern_in_expr/mysql/go/query.sql.go b/internal/endtoend/testdata/pattern_in_expr/mysql/go/query.sql.go index dafe665dd8..7fdf362fca 100644 --- a/internal/endtoend/testdata/pattern_in_expr/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/pattern_in_expr/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/pattern_in_expr/mysql/query.sql b/internal/endtoend/testdata/pattern_in_expr/mysql/query.sql index 2747ed48c7..f2c378384d 100644 --- a/internal/endtoend/testdata/pattern_in_expr/mysql/query.sql +++ b/internal/endtoend/testdata/pattern_in_expr/mysql/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (a text, b text); -CREATE TABLE bar (a text, b text); /* name: FooByBarB :many */ SELECT a, b from foo where foo.a in (select a from bar where bar.b = ?); diff --git a/internal/endtoend/testdata/pattern_in_expr/mysql/schema.sql b/internal/endtoend/testdata/pattern_in_expr/mysql/schema.sql new file mode 100644 index 0000000000..98a197f8f2 --- /dev/null +++ b/internal/endtoend/testdata/pattern_in_expr/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (a text, b text); diff --git a/internal/endtoend/testdata/pattern_in_expr/mysql/sqlc.json b/internal/endtoend/testdata/pattern_in_expr/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/pattern_in_expr/mysql/sqlc.json +++ b/internal/endtoend/testdata/pattern_in_expr/mysql/sqlc.json @@ -5,7 +5,7 @@ "engine": "mysql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/pattern_matching/mysql/go/db.go b/internal/endtoend/testdata/pattern_matching/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/pattern_matching/mysql/go/db.go +++ b/internal/endtoend/testdata/pattern_matching/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/pattern_matching/mysql/go/models.go b/internal/endtoend/testdata/pattern_matching/mysql/go/models.go index 687953c6e9..a6a5f8c7bb 100644 --- a/internal/endtoend/testdata/pattern_matching/mysql/go/models.go +++ b/internal/endtoend/testdata/pattern_matching/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/pattern_matching/mysql/go/query.sql.go b/internal/endtoend/testdata/pattern_matching/mysql/go/query.sql.go index ecdb72e7bc..447ffb9e92 100644 --- a/internal/endtoend/testdata/pattern_matching/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/pattern_matching/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/pattern_matching/mysql/query.sql b/internal/endtoend/testdata/pattern_matching/mysql/query.sql index 57bbcd0287..02327ed734 100644 --- a/internal/endtoend/testdata/pattern_matching/mysql/query.sql +++ b/internal/endtoend/testdata/pattern_matching/mysql/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE pet (name text); - -- name: PetsByName :many SELECT * FROM pet WHERE name LIKE ?; diff --git a/internal/endtoend/testdata/pattern_matching/mysql/schema.sql b/internal/endtoend/testdata/pattern_matching/mysql/schema.sql new file mode 100644 index 0000000000..8133f35e31 --- /dev/null +++ b/internal/endtoend/testdata/pattern_matching/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE pet (name text); + diff --git a/internal/endtoend/testdata/pattern_matching/mysql/sqlc.json b/internal/endtoend/testdata/pattern_matching/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/pattern_matching/mysql/sqlc.json +++ b/internal/endtoend/testdata/pattern_matching/mysql/sqlc.json @@ -5,7 +5,7 @@ "engine": "mysql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/pattern_matching/postgresql/go/db.go b/internal/endtoend/testdata/pattern_matching/postgresql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/pattern_matching/postgresql/go/db.go +++ b/internal/endtoend/testdata/pattern_matching/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/pattern_matching/postgresql/go/models.go b/internal/endtoend/testdata/pattern_matching/postgresql/go/models.go index 687953c6e9..a6a5f8c7bb 100644 --- a/internal/endtoend/testdata/pattern_matching/postgresql/go/models.go +++ b/internal/endtoend/testdata/pattern_matching/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/pattern_matching/postgresql/go/query.sql.go b/internal/endtoend/testdata/pattern_matching/postgresql/go/query.sql.go index 9fe5916fe9..2c8760f573 100644 --- a/internal/endtoend/testdata/pattern_matching/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/pattern_matching/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/pattern_matching/postgresql/query.sql b/internal/endtoend/testdata/pattern_matching/postgresql/query.sql index 083695e5f2..6fef93e5dc 100644 --- a/internal/endtoend/testdata/pattern_matching/postgresql/query.sql +++ b/internal/endtoend/testdata/pattern_matching/postgresql/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE pet (name text); - -- name: PetsByName :many SELECT * FROM pet WHERE name LIKE $1; diff --git a/internal/endtoend/testdata/pattern_matching/postgresql/schema.sql b/internal/endtoend/testdata/pattern_matching/postgresql/schema.sql new file mode 100644 index 0000000000..8133f35e31 --- /dev/null +++ b/internal/endtoend/testdata/pattern_matching/postgresql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE pet (name text); + diff --git a/internal/endtoend/testdata/pattern_matching/postgresql/sqlc.json b/internal/endtoend/testdata/pattern_matching/postgresql/sqlc.json index de427d069f..cd518671ac 100644 --- a/internal/endtoend/testdata/pattern_matching/postgresql/sqlc.json +++ b/internal/endtoend/testdata/pattern_matching/postgresql/sqlc.json @@ -5,7 +5,7 @@ "engine": "postgresql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/exec.sql.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/exec.sql.go index 208cd658b4..b2064e0ae9 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/exec.sql.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/exec.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: exec.sql package querytest diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/query.sql.go index 5bbd7b752e..75c3f3fbfc 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/sqlc.json index c0fdf400bd..a632d53590 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": ["query.sql", "exec.sql"] } ] diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/exec.sql.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/exec.sql.go index 208cd658b4..b2064e0ae9 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/exec.sql.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/exec.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: exec.sql package querytest diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/query.sql.go index 4f9de9d364..2b71b44b77 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/sqlc.json index 7f2510b1bd..a780e051c0 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": ["query.sql", "exec.sql"] } ] diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/exec.sql.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/exec.sql.go index d3d33639a1..4c03334188 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/exec.sql.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/exec.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: exec.sql package querytest diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/query.sql.go index 46761a06ef..49fc5359d6 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/sqlc.json index 21a843728c..af1dbd0eb1 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": ["query.sql", "exec.sql"] } ] diff --git a/internal/endtoend/testdata/pg_dump/db/db.go b/internal/endtoend/testdata/pg_dump/db/db.go index 3d2b5bf3a3..cd5bbb8e08 100644 --- a/internal/endtoend/testdata/pg_dump/db/db.go +++ b/internal/endtoend/testdata/pg_dump/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/pg_dump/db/models.go b/internal/endtoend/testdata/pg_dump/db/models.go index f8bcd76317..5041799d54 100644 --- a/internal/endtoend/testdata/pg_dump/db/models.go +++ b/internal/endtoend/testdata/pg_dump/db/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/pg_dump/db/query.sql.go b/internal/endtoend/testdata/pg_dump/db/query.sql.go index aadac5de28..85c204d6fb 100644 --- a/internal/endtoend/testdata/pg_dump/db/query.sql.go +++ b/internal/endtoend/testdata/pg_dump/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package db diff --git a/internal/endtoend/testdata/pg_dump/exec.json b/internal/endtoend/testdata/pg_dump/exec.json new file mode 100644 index 0000000000..c85ca2dfa7 --- /dev/null +++ b/internal/endtoend/testdata/pg_dump/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["base"], + "meta": { + "invalid_schema": true + } +} diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/models.go index 065559f1e4..54e621c88d 100644 --- a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/query.sql.go new file mode 100644 index 0000000000..31921b6bc1 --- /dev/null +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listFoo = `-- name: ListFoo :many +SELECT qualified_name, name_query, fts_name_query FROM foo +` + +func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, listFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.QualifiedName, &i.NameQuery, &i.FtsNameQuery); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/query.sql index b64921789f..b475d29f5e 100644 --- a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/query.sql @@ -1,9 +1,2 @@ -CREATE EXTENSION IF NOT EXISTS ltree; - -CREATE TABLE foo ( - qualified_name ltree, - name_query lquery, - fts_name_query ltxtquery -); - +-- name: ListFoo :many SELECT * FROM foo; diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..82fb9b26f7 --- /dev/null +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/schema.sql @@ -0,0 +1,8 @@ +CREATE EXTENSION IF NOT EXISTS ltree; + +CREATE TABLE foo ( + qualified_name ltree, + name_query lquery, + fts_name_query ltxtquery +); + diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/models.go index 1f8e45fe92..ad35c8fc69 100644 --- a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/query.sql.go new file mode 100644 index 0000000000..31921b6bc1 --- /dev/null +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listFoo = `-- name: ListFoo :many +SELECT qualified_name, name_query, fts_name_query FROM foo +` + +func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, listFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.QualifiedName, &i.NameQuery, &i.FtsNameQuery); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/query.sql index b64921789f..b475d29f5e 100644 --- a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/query.sql @@ -1,9 +1,2 @@ -CREATE EXTENSION IF NOT EXISTS ltree; - -CREATE TABLE foo ( - qualified_name ltree, - name_query lquery, - fts_name_query ltxtquery -); - +-- name: ListFoo :many SELECT * FROM foo; diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..82fb9b26f7 --- /dev/null +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/schema.sql @@ -0,0 +1,8 @@ +CREATE EXTENSION IF NOT EXISTS ltree; + +CREATE TABLE foo ( + qualified_name ltree, + name_query lquery, + fts_name_query ltxtquery +); + diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/models.go index 065559f1e4..54e621c88d 100644 --- a/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/query.sql.go new file mode 100644 index 0000000000..762e65ce5b --- /dev/null +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listFoo = `-- name: ListFoo :many +SELECT qualified_name, name_query, fts_name_query FROM foo +` + +func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, listFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.QualifiedName, &i.NameQuery, &i.FtsNameQuery); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/query.sql b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/query.sql index b64921789f..b475d29f5e 100644 --- a/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/query.sql @@ -1,9 +1,2 @@ -CREATE EXTENSION IF NOT EXISTS ltree; - -CREATE TABLE foo ( - qualified_name ltree, - name_query lquery, - fts_name_query ltxtquery -); - +-- name: ListFoo :many SELECT * FROM foo; diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..82fb9b26f7 --- /dev/null +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/schema.sql @@ -0,0 +1,8 @@ +CREATE EXTENSION IF NOT EXISTS ltree; + +CREATE TABLE foo ( + qualified_name ltree, + name_query lquery, + fts_name_query ltxtquery +); + diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/pg_trgm.sql.go b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/pg_trgm.sql.go index b90bca2424..194612b305 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/pg_trgm.sql.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/pg_trgm.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: pg_trgm.sql package querytest diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/pgcrypto.sql.go b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/pgcrypto.sql.go index e62757fc15..af48da80f1 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/pgcrypto.sql.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/pgcrypto.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: pgcrypto.sql package querytest diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/uuid_ossp.sql.go b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/uuid_ossp.sql.go index 026120ac98..e59868c6f3 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/uuid_ossp.sql.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/uuid_ossp.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: uuid_ossp.sql package querytest diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..bf80206205 --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE EXTENSION IF NOT EXISTS "pg_trgm"; +CREATE EXTENSION IF NOT EXISTS "pgcrypto"; +CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; \ No newline at end of file diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/sql/pg_trgm.sql b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/sql/pg_trgm.sql index 42f111ce00..f0edf0955a 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/sql/pg_trgm.sql +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/sql/pg_trgm.sql @@ -1,4 +1,2 @@ -CREATE EXTENSION IF NOT EXISTS "pg_trgm"; - -- name: WordSimilarity :one SELECT word_similarity('word', 'two words'); diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/sql/pgcrypto.sql b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/sql/pgcrypto.sql index 6c94a105c2..f1045a47f2 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/sql/pgcrypto.sql +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/sql/pgcrypto.sql @@ -1,5 +1,3 @@ -CREATE EXTENSION IF NOT EXISTS "pgcrypto"; - -- name: EncodeDigest :one SELECT encode(digest($1, 'sha1'), 'hex'); diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/sql/uuid_ossp.sql b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/sql/uuid_ossp.sql index 389375627f..1716962506 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/sql/uuid_ossp.sql +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/sql/uuid_ossp.sql @@ -1,4 +1,2 @@ -CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; - -- name: GenerateUUID :one SELECT uuid_generate_v4(); diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/sqlc.json index 05ccad880e..520995c96b 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "sql", + "schema": "schema.sql", "queries": "sql" } ] diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/pg_trgm.sql.go b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/pg_trgm.sql.go index b90bca2424..194612b305 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/pg_trgm.sql.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/pg_trgm.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: pg_trgm.sql package querytest diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/pgcrypto.sql.go b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/pgcrypto.sql.go index e62757fc15..af48da80f1 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/pgcrypto.sql.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/pgcrypto.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: pgcrypto.sql package querytest diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/uuid_ossp.sql.go b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/uuid_ossp.sql.go index 5321829fce..2d17d87349 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/uuid_ossp.sql.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/uuid_ossp.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: uuid_ossp.sql package querytest diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..bf80206205 --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE EXTENSION IF NOT EXISTS "pg_trgm"; +CREATE EXTENSION IF NOT EXISTS "pgcrypto"; +CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; \ No newline at end of file diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/sql/pg_trgm.sql b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/sql/pg_trgm.sql index 42f111ce00..f0edf0955a 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/sql/pg_trgm.sql +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/sql/pg_trgm.sql @@ -1,4 +1,2 @@ -CREATE EXTENSION IF NOT EXISTS "pg_trgm"; - -- name: WordSimilarity :one SELECT word_similarity('word', 'two words'); diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/sql/pgcrypto.sql b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/sql/pgcrypto.sql index 6c94a105c2..f1045a47f2 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/sql/pgcrypto.sql +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/sql/pgcrypto.sql @@ -1,5 +1,3 @@ -CREATE EXTENSION IF NOT EXISTS "pgcrypto"; - -- name: EncodeDigest :one SELECT encode(digest($1, 'sha1'), 'hex'); diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/sql/uuid_ossp.sql b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/sql/uuid_ossp.sql index 389375627f..1716962506 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/sql/uuid_ossp.sql +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/sql/uuid_ossp.sql @@ -1,4 +1,2 @@ -CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; - -- name: GenerateUUID :one SELECT uuid_generate_v4(); diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/sqlc.json index ab01c49b7a..7fcfe047f2 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "sql", + "schema": "schema.sql", "queries": "sql" } ] diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/pg_trgm.sql.go b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/pg_trgm.sql.go index ffc8e70064..ba8c0c9aff 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/pg_trgm.sql.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/pg_trgm.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: pg_trgm.sql package querytest diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/pgcrypto.sql.go b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/pgcrypto.sql.go index 161e4ccc95..248873db67 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/pgcrypto.sql.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/pgcrypto.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: pgcrypto.sql package querytest diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/uuid_ossp.sql.go b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/uuid_ossp.sql.go index f9e61702b1..7318c4d149 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/uuid_ossp.sql.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/uuid_ossp.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: uuid_ossp.sql package querytest diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..bf80206205 --- /dev/null +++ b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE EXTENSION IF NOT EXISTS "pg_trgm"; +CREATE EXTENSION IF NOT EXISTS "pgcrypto"; +CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; \ No newline at end of file diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/sql/pg_trgm.sql b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/sql/pg_trgm.sql index 42f111ce00..f0edf0955a 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/sql/pg_trgm.sql +++ b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/sql/pg_trgm.sql @@ -1,4 +1,2 @@ -CREATE EXTENSION IF NOT EXISTS "pg_trgm"; - -- name: WordSimilarity :one SELECT word_similarity('word', 'two words'); diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/sql/pgcrypto.sql b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/sql/pgcrypto.sql index 6c94a105c2..f1045a47f2 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/sql/pgcrypto.sql +++ b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/sql/pgcrypto.sql @@ -1,5 +1,3 @@ -CREATE EXTENSION IF NOT EXISTS "pgcrypto"; - -- name: EncodeDigest :one SELECT encode(digest($1, 'sha1'), 'hex'); diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/sql/uuid_ossp.sql b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/sql/uuid_ossp.sql index 389375627f..1716962506 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/sql/uuid_ossp.sql +++ b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/sql/uuid_ossp.sql @@ -1,4 +1,2 @@ -CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; - -- name: GenerateUUID :one SELECT uuid_generate_v4(); diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/sqlc.json index fce19ff4a1..c78a3298d9 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "sql", + "schema": "schema.sql", "queries": "sql" } ] diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/exec.json b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/query.sql.go index d9146cf3d8..5a2f13da51 100644 --- a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -8,12 +8,10 @@ package querytest import ( "context" "time" - - "github.com/jackc/pgtype" ) const generateSeries = `-- name: GenerateSeries :many -SELECT generate_series($1::timestamp, $2::timestamp) +SELECT generate_series($1::timestamp, $2::timestamp, '10 hours') ` type GenerateSeriesParams struct { @@ -21,15 +19,15 @@ type GenerateSeriesParams struct { Column2 time.Time `json:"column_2"` } -func (q *Queries) GenerateSeries(ctx context.Context, arg GenerateSeriesParams) ([]pgtype.Numeric, error) { +func (q *Queries) GenerateSeries(ctx context.Context, arg GenerateSeriesParams) ([]int64, error) { rows, err := q.db.Query(ctx, generateSeries, arg.Column1, arg.Column2) if err != nil { return nil, err } defer rows.Close() - var items []pgtype.Numeric + var items []int64 for rows.Next() { - var generate_series pgtype.Numeric + var generate_series int64 if err := rows.Scan(&generate_series); err != nil { return nil, err } diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/query.sql index c00238feda..3d483e89ec 100644 --- a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/query.sql @@ -1,2 +1,2 @@ -- name: GenerateSeries :many -SELECT generate_series($1::timestamp, $2::timestamp); +SELECT generate_series($1::timestamp, $2::timestamp, '10 hours'); diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/sqlc.json index 69c340e412..a1dead4a24 100644 --- a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_json_tags": true } diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/exec.json b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/query.sql.go index de11bf7555..b1afe1a0f3 100644 --- a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -12,7 +12,7 @@ import ( ) const generateSeries = `-- name: GenerateSeries :many -SELECT generate_series($1::timestamp, $2::timestamp) +SELECT generate_series($1::timestamp, $2::timestamp, '10 hours') ` type GenerateSeriesParams struct { @@ -20,15 +20,15 @@ type GenerateSeriesParams struct { Column2 pgtype.Timestamp `json:"column_2"` } -func (q *Queries) GenerateSeries(ctx context.Context, arg GenerateSeriesParams) ([]pgtype.Numeric, error) { +func (q *Queries) GenerateSeries(ctx context.Context, arg GenerateSeriesParams) ([]int64, error) { rows, err := q.db.Query(ctx, generateSeries, arg.Column1, arg.Column2) if err != nil { return nil, err } defer rows.Close() - var items []pgtype.Numeric + var items []int64 for rows.Next() { - var generate_series pgtype.Numeric + var generate_series int64 if err := rows.Scan(&generate_series); err != nil { return nil, err } diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/query.sql index c00238feda..3d483e89ec 100644 --- a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/query.sql @@ -1,2 +1,2 @@ -- name: GenerateSeries :many -SELECT generate_series($1::timestamp, $2::timestamp); +SELECT generate_series($1::timestamp, $2::timestamp, '10 hours'); diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/sqlc.json index da9f669a35..fff8b19a30 100644 --- a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_json_tags": true } diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/exec.json b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/query.sql.go index 26487587ed..3f78c01386 100644 --- a/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -11,7 +11,7 @@ import ( ) const generateSeries = `-- name: GenerateSeries :many -SELECT generate_series($1::timestamp, $2::timestamp) +SELECT generate_series($1::timestamp, $2::timestamp, '10 hours') ` type GenerateSeriesParams struct { @@ -19,15 +19,15 @@ type GenerateSeriesParams struct { Column2 time.Time `json:"column_2"` } -func (q *Queries) GenerateSeries(ctx context.Context, arg GenerateSeriesParams) ([]string, error) { +func (q *Queries) GenerateSeries(ctx context.Context, arg GenerateSeriesParams) ([]int64, error) { rows, err := q.db.QueryContext(ctx, generateSeries, arg.Column1, arg.Column2) if err != nil { return nil, err } defer rows.Close() - var items []string + var items []int64 for rows.Next() { - var generate_series string + var generate_series int64 if err := rows.Scan(&generate_series); err != nil { return nil, err } diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/query.sql b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/query.sql index c00238feda..3d483e89ec 100644 --- a/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/query.sql @@ -1,2 +1,2 @@ -- name: GenerateSeries :many -SELECT generate_series($1::timestamp, $2::timestamp); +SELECT generate_series($1::timestamp, $2::timestamp, '10 hours'); diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/sqlc.json index f977c8ac7e..bb6ecf409f 100644 --- a/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_json_tags": true } diff --git a/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/db.go b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/db.go +++ b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/models.go b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/models.go +++ b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/query.sql.go b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/query.sql.go index e3cc362c0e..75e0538c92 100644 --- a/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/query.sql.go +++ b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/db.go b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/db.go +++ b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/models.go b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/models.go +++ b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/query.sql.go b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/query.sql.go index ee914306c5..6b36384a09 100644 --- a/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/query.sql.go +++ b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/pg_timezone_names/go_stdlib/db.go b/internal/endtoend/testdata/pg_timezone_names/go_stdlib/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/pg_timezone_names/go_stdlib/db.go +++ b/internal/endtoend/testdata/pg_timezone_names/go_stdlib/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/pg_timezone_names/go_stdlib/models.go b/internal/endtoend/testdata/pg_timezone_names/go_stdlib/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/pg_timezone_names/go_stdlib/models.go +++ b/internal/endtoend/testdata/pg_timezone_names/go_stdlib/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/pg_timezone_names/go_stdlib/query.sql.go b/internal/endtoend/testdata/pg_timezone_names/go_stdlib/query.sql.go index d4685e8e09..8b18058453 100644 --- a/internal/endtoend/testdata/pg_timezone_names/go_stdlib/query.sql.go +++ b/internal/endtoend/testdata/pg_timezone_names/go_stdlib/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/pg_timezone_names/schema.sql b/internal/endtoend/testdata/pg_timezone_names/schema.sql new file mode 100644 index 0000000000..e0ac49d1ec --- /dev/null +++ b/internal/endtoend/testdata/pg_timezone_names/schema.sql @@ -0,0 +1 @@ +SELECT 1; diff --git a/internal/endtoend/testdata/pg_timezone_names/sqlc.json b/internal/endtoend/testdata/pg_timezone_names/sqlc.json index 404ef769a9..1f0b8cd3d6 100644 --- a/internal/endtoend/testdata/pg_timezone_names/sqlc.json +++ b/internal/endtoend/testdata/pg_timezone_names/sqlc.json @@ -3,7 +3,7 @@ "sql": [ { "engine": "postgresql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "gen": { "go": { @@ -15,7 +15,7 @@ }, { "engine": "postgresql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "gen": { "go": { @@ -27,7 +27,7 @@ }, { "engine": "postgresql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "gen": { "go": { diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/models.go index 2f3b066799..7a00bcb08b 100644 --- a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type User struct { ID int64 } diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/query.sql.go index 62426551e5..4debf38e23 100644 --- a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/query.sql index 3191419956..64493569d3 100644 --- a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE "user" (id bigserial not null); - -- name: User :many SELECT "user".* FROM "user"; diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..7fd1e597cf --- /dev/null +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE "user" (id bigserial not null); + diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/models.go index 2f3b066799..7a00bcb08b 100644 --- a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type User struct { ID int64 } diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/query.sql.go index 62426551e5..4debf38e23 100644 --- a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/query.sql index 3191419956..64493569d3 100644 --- a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE "user" (id bigserial not null); - -- name: User :many SELECT "user".* FROM "user"; diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..7fd1e597cf --- /dev/null +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE "user" (id bigserial not null); + diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/models.go index 2f3b066799..7a00bcb08b 100644 --- a/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type User struct { ID int64 } diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/query.sql.go index 2f0d4de7a8..fc2d9b248e 100644 --- a/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/query.sql b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/query.sql index 3191419956..64493569d3 100644 --- a/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE "user" (id bigserial not null); - -- name: User :many SELECT "user".* FROM "user"; diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..7fd1e597cf --- /dev/null +++ b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE "user" (id bigserial not null); + diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/pg_vector/postgresql/pgx/exec.json b/internal/endtoend/testdata/pg_vector/postgresql/pgx/exec.json new file mode 100644 index 0000000000..c85ca2dfa7 --- /dev/null +++ b/internal/endtoend/testdata/pg_vector/postgresql/pgx/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["base"], + "meta": { + "invalid_schema": true + } +} diff --git a/internal/endtoend/testdata/pg_vector/postgresql/pgx/go/db.go b/internal/endtoend/testdata/pg_vector/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/pg_vector/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/pg_vector/postgresql/pgx/go/models.go b/internal/endtoend/testdata/pg_vector/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..5921a1e292 --- /dev/null +++ b/internal/endtoend/testdata/pg_vector/postgresql/pgx/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/pgvector/pgvector-go" +) + +type Item struct { + ID int64 + Embedding pgvector.Vector +} diff --git a/internal/endtoend/testdata/pg_vector/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/pg_vector/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..20db5866bd --- /dev/null +++ b/internal/endtoend/testdata/pg_vector/postgresql/pgx/go/query.sql.go @@ -0,0 +1,48 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/pgvector/pgvector-go" +) + +const insertVector = `-- name: InsertVector :exec +INSERT INTO items (embedding) VALUES ($1) +` + +func (q *Queries) InsertVector(ctx context.Context, embedding pgvector.Vector) error { + _, err := q.db.Exec(ctx, insertVector, embedding) + return err +} + +const nearestNeighbor = `-- name: NearestNeighbor :many +SELECT id, embedding +FROM items +ORDER BY embedding <-> $1 +LIMIT 5 +` + +func (q *Queries) NearestNeighbor(ctx context.Context, embedding pgvector.Vector) ([]Item, error) { + rows, err := q.db.Query(ctx, nearestNeighbor, embedding) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Item + for rows.Next() { + var i Item + if err := rows.Scan(&i.ID, &i.Embedding); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/pg_vector/postgresql/pgx/query.sql b/internal/endtoend/testdata/pg_vector/postgresql/pgx/query.sql new file mode 100644 index 0000000000..5bcc53958b --- /dev/null +++ b/internal/endtoend/testdata/pg_vector/postgresql/pgx/query.sql @@ -0,0 +1,8 @@ +-- name: InsertVector :exec +INSERT INTO items (embedding) VALUES ($1); + +-- name: NearestNeighbor :many +SELECT * +FROM items +ORDER BY embedding <-> $1 +LIMIT 5; diff --git a/internal/endtoend/testdata/pg_vector/postgresql/pgx/schema.sql b/internal/endtoend/testdata/pg_vector/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..a078405428 --- /dev/null +++ b/internal/endtoend/testdata/pg_vector/postgresql/pgx/schema.sql @@ -0,0 +1,3 @@ +CREATE EXTENSION IF NOT EXISTS "vector"; + +CREATE TABLE items (id bigserial PRIMARY KEY, embedding vector(3)); diff --git a/internal/endtoend/testdata/pg_vector/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/pg_vector/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/pg_vector/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/db.go index 819b76a2d8..4e47262b7d 100644 --- a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package datatype diff --git a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/models.go index 8581ab2803..048c2f7457 100644 --- a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package datatype diff --git a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/query.sql.go index 8b49c11c7d..5c76759055 100644 --- a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package datatype diff --git a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/query.sql index 1c3964cb35..b94846fce2 100644 --- a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar date, baz uuid); - -- name: List :many SELECT * FROM foo; diff --git a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..532ae9943b --- /dev/null +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar date, baz uuid); + diff --git a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/sqlc.json index 4928405dc7..56341eccdd 100644 --- a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "datatype", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_pointers_for_null_types": true } diff --git a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/exec.json b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/db.go index 628fe9c96b..2853d5f77e 100644 --- a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package datatype diff --git a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/models.go index b5596be9ae..af33c734e5 100644 --- a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package datatype diff --git a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/query.sql.go index c1efa7d950..2098df405f 100644 --- a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package datatype diff --git a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/query.sql index b166c01792..b94846fce2 100644 --- a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar inet, baz cidr); - -- name: List :many SELECT * FROM foo; diff --git a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..4b28530e80 --- /dev/null +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar inet, baz cidr); + diff --git a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/sqlc.json index dfe93be76c..7465088d1d 100644 --- a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "datatype", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/prepared_queries/mysql/go/db.go b/internal/endtoend/testdata/prepared_queries/mysql/go/db.go index e1fc772d90..e35a714344 100644 --- a/internal/endtoend/testdata/prepared_queries/mysql/go/db.go +++ b/internal/endtoend/testdata/prepared_queries/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/prepared_queries/mysql/go/models.go b/internal/endtoend/testdata/prepared_queries/mysql/go/models.go index f6e40e212e..d8ac2c0dcb 100644 --- a/internal/endtoend/testdata/prepared_queries/mysql/go/models.go +++ b/internal/endtoend/testdata/prepared_queries/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/prepared_queries/mysql/go/query.sql.go b/internal/endtoend/testdata/prepared_queries/mysql/go/query.sql.go index 77ea2263f1..530dca1939 100644 --- a/internal/endtoend/testdata/prepared_queries/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/prepared_queries/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/prepared_queries/mysql/query.sql b/internal/endtoend/testdata/prepared_queries/mysql/query.sql index bc1fcced6e..b743aee060 100644 --- a/internal/endtoend/testdata/prepared_queries/mysql/query.sql +++ b/internal/endtoend/testdata/prepared_queries/mysql/query.sql @@ -1,9 +1,3 @@ -CREATE TABLE users ( - id SERIAL NOT NULL, - first_name varchar(255) NOT NULL, - last_name varchar(255) -); - /* name: GetUserByID :one */ SELECT first_name, id, last_name FROM users WHERE id = sqlc.arg('target_id'); diff --git a/internal/endtoend/testdata/prepared_queries/mysql/schema.sql b/internal/endtoend/testdata/prepared_queries/mysql/schema.sql new file mode 100644 index 0000000000..c928f3b7ce --- /dev/null +++ b/internal/endtoend/testdata/prepared_queries/mysql/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + id SERIAL NOT NULL, + first_name varchar(255) NOT NULL, + last_name varchar(255) +); + diff --git a/internal/endtoend/testdata/prepared_queries/mysql/sqlc.json b/internal/endtoend/testdata/prepared_queries/mysql/sqlc.json index eb101c3691..9d96bdc1c3 100644 --- a/internal/endtoend/testdata/prepared_queries/mysql/sqlc.json +++ b/internal/endtoend/testdata/prepared_queries/mysql/sqlc.json @@ -4,7 +4,7 @@ { "name": "querytest", "path": "go", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "engine": "mysql", "emit_prepared_queries": true diff --git a/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/db.go index e1fc772d90..e35a714344 100644 --- a/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/models.go index 124f668c41..7043a480a5 100644 --- a/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/query.sql.go index 931a3e7e6a..eca6854f2e 100644 --- a/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/query.sql b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/query.sql index a65f7391a7..d2f54f2037 100644 --- a/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/query.sql @@ -1,9 +1,3 @@ -CREATE TABLE users ( - id SERIAL NOT NULL, - first_name varchar(255) NOT NULL, - last_name varchar(255) -); - /* name: GetUserByID :one */ SELECT first_name, id, last_name FROM users WHERE id = sqlc.arg('target_id'); diff --git a/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..c928f3b7ce --- /dev/null +++ b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE users ( + id SERIAL NOT NULL, + first_name varchar(255) NOT NULL, + last_name varchar(255) +); + diff --git a/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/sqlc.json index 61db21653f..ff1ae98f80 100644 --- a/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "name": "querytest", "path": "go", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "engine": "postgresql", "emit_prepared_queries": true diff --git a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/db.go index c4c6078a5d..6b6e1f86ce 100644 --- a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package primary_key_later diff --git a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/models.go index 6233edc26f..201035a605 100644 --- a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package primary_key_later diff --git a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/queries.sql.go b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/queries.sql.go index b4540cba7a..7f977f1181 100644 --- a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/queries.sql.go +++ b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/queries.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: queries.sql package primary_key_later diff --git a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/db.go index 6cf532a1f4..0e46e3ac82 100644 --- a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package primary_key_later diff --git a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/models.go index 4497427571..e0e8d9f649 100644 --- a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package primary_key_later diff --git a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/queries.sql.go b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/queries.sql.go index b4540cba7a..7f977f1181 100644 --- a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/queries.sql.go +++ b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/queries.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: queries.sql package primary_key_later diff --git a/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/db.go index 14e5d88029..3091c8d82e 100644 --- a/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package primary_key_later diff --git a/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/models.go index 6233edc26f..201035a605 100644 --- a/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package primary_key_later diff --git a/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/queries.sql.go b/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/queries.sql.go index 5a7137dac5..3cb37cdb45 100644 --- a/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/queries.sql.go +++ b/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/queries.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: queries.sql package primary_key_later diff --git a/internal/endtoend/testdata/process_plugin_disabled/gen/codegen.json b/internal/endtoend/testdata/process_plugin_disabled/gen/codegen.json index c59daa1899..06bc46aa71 100644 --- a/internal/endtoend/testdata/process_plugin_disabled/gen/codegen.json +++ b/internal/endtoend/testdata/process_plugin_disabled/gen/codegen.json @@ -43,7 +43,8 @@ "query_parameter_limit": 1, "output_batch_file_name": "", "json_tags_id_uppercase": false, - "omit_unused_structs": false + "omit_unused_structs": false, + "emit_sql_as_comment": false }, "json": { "out": "", @@ -65397,6 +65398,6 @@ "insert_into_table": null } ], - "sqlc_version": "v1.22.0", + "sqlc_version": "v1.30.0", "plugin_options": "eyJmaWxlbmFtZSI6ImNvZGVnZW4uanNvbiIsImluZGVudCI6IiAgIn0=" } diff --git a/internal/endtoend/testdata/process_plugin_format_json/exec.json b/internal/endtoend/testdata/process_plugin_format_json/exec.json new file mode 100644 index 0000000000..2cfb9f266d --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_format_json/exec.json @@ -0,0 +1,4 @@ +{ + "process": "test-json-process-plugin", + "os": [ "darwin", "linux" ] +} diff --git a/internal/endtoend/testdata/process_plugin_format_json/gen/hello.txt b/internal/endtoend/testdata/process_plugin_format_json/gen/hello.txt new file mode 100644 index 0000000000..05d6799f15 --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_format_json/gen/hello.txt @@ -0,0 +1,12 @@ +SELECT id, name, bio FROM authors +WHERE id = $1 LIMIT 1 +SELECT id, name, bio FROM authors +ORDER BY name +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +RETURNING id, name, bio +DELETE FROM authors +WHERE id = $1 diff --git a/internal/endtoend/testdata/process_plugin_format_json/query.sql b/internal/endtoend/testdata/process_plugin_format_json/query.sql new file mode 100644 index 0000000000..75e38b2caf --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_format_json/query.sql @@ -0,0 +1,19 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = $1 LIMIT 1; + +-- name: ListAuthors :many +SELECT * FROM authors +ORDER BY name; + +-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +RETURNING *; + +-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = $1; diff --git a/internal/endtoend/testdata/process_plugin_format_json/schema.sql b/internal/endtoend/testdata/process_plugin_format_json/schema.sql new file mode 100644 index 0000000000..b4fad78497 --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_format_json/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/process_plugin_format_json/sqlc.json b/internal/endtoend/testdata/process_plugin_format_json/sqlc.json new file mode 100644 index 0000000000..28055fa571 --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_format_json/sqlc.json @@ -0,0 +1,25 @@ +{ + "version": "2", + "sql": [ + { + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "codegen": [ + { + "out": "gen", + "plugin": "jsonb" + } + ] + } + ], + "plugins": [ + { + "name": "jsonb", + "process": { + "cmd": "test-json-process-plugin", + "format": "json" + } + } + ] +} diff --git a/internal/endtoend/testdata/process_plugin_sqlc_gen_json/exec.json b/internal/endtoend/testdata/process_plugin_sqlc_gen_json/exec.json index 5be7ac8c74..e38046cf57 100644 --- a/internal/endtoend/testdata/process_plugin_sqlc_gen_json/exec.json +++ b/internal/endtoend/testdata/process_plugin_sqlc_gen_json/exec.json @@ -1,3 +1,4 @@ { + "contexts": ["base"], "process": "sqlc-gen-json" } diff --git a/internal/endtoend/testdata/process_plugin_sqlc_gen_json/gen/codegen.json b/internal/endtoend/testdata/process_plugin_sqlc_gen_json/gen/codegen.json index c59daa1899..0c7282ac9c 100644 --- a/internal/endtoend/testdata/process_plugin_sqlc_gen_json/gen/codegen.json +++ b/internal/endtoend/testdata/process_plugin_sqlc_gen_json/gen/codegen.json @@ -8,47 +8,15 @@ "queries": [ "query.sql" ], - "rename": {}, - "overrides": [], "codegen": { "out": "gen", "plugin": "jsonb", - "options": "eyJmaWxlbmFtZSI6ImNvZGVnZW4uanNvbiIsImluZGVudCI6IiAgIn0=" - }, - "go": { - "emit_interface": false, - "emit_json_tags": false, - "emit_db_tags": false, - "emit_prepared_queries": false, - "emit_exact_table_names": false, - "emit_empty_slices": false, - "emit_exported_queries": false, - "emit_result_struct_pointers": false, - "emit_params_struct_pointers": false, - "emit_methods_with_db_argument": false, - "json_tags_case_style": "", - "package": "", - "out": "", - "sql_package": "", - "sql_driver": "", - "output_db_file_name": "", - "output_models_file_name": "", - "output_querier_file_name": "", - "output_copyfrom_file_name": "", - "output_files_suffix": "", - "emit_enum_valid_method": false, - "emit_all_enum_values": false, - "inflection_exclude_table_names": [], - "emit_pointers_for_null_types": false, - "query_parameter_limit": 1, - "output_batch_file_name": "", - "json_tags_id_uppercase": false, - "omit_unused_structs": false - }, - "json": { - "out": "", - "indent": "", - "filename": "" + "options": "eyJmaWxlbmFtZSI6ImNvZGVnZW4uanNvbiIsImluZGVudCI6IiAgIn0=", + "env": [], + "process": { + "cmd": "sqlc-gen-json" + }, + "wasm": null } }, "catalog": { @@ -65397,6 +65365,7 @@ "insert_into_table": null } ], - "sqlc_version": "v1.22.0", - "plugin_options": "eyJmaWxlbmFtZSI6ImNvZGVnZW4uanNvbiIsImluZGVudCI6IiAgIn0=" + "sqlc_version": "v1.30.0", + "plugin_options": "eyJmaWxlbmFtZSI6ImNvZGVnZW4uanNvbiIsImluZGVudCI6IiAgIn0=", + "global_options": "" } diff --git a/internal/endtoend/testdata/process_plugin_sqlc_gen_test/exec.json b/internal/endtoend/testdata/process_plugin_sqlc_gen_test/exec.json index 7865c9ec17..1aa4920cb9 100644 --- a/internal/endtoend/testdata/process_plugin_sqlc_gen_test/exec.json +++ b/internal/endtoend/testdata/process_plugin_sqlc_gen_test/exec.json @@ -1,3 +1,4 @@ { - "process": "sqlc-gen-test" -} \ No newline at end of file + "process": "sqlc-gen-test", + "os": ["linux", "darwin"] +} diff --git a/internal/endtoend/testdata/process_plugin_sqlc_gen_test/gen/env.json b/internal/endtoend/testdata/process_plugin_sqlc_gen_test/gen/env.json index e58a1fbef1..fa4beb305c 100644 --- a/internal/endtoend/testdata/process_plugin_sqlc_gen_test/gen/env.json +++ b/internal/endtoend/testdata/process_plugin_sqlc_gen_test/gen/env.json @@ -1,6 +1,6 @@ { "env": [ - "SQLC_VERSION=v1.22.0", + "SQLC_VERSION=v1.30.0", "SQLC_DUMMY_VALUE=true" ] } diff --git a/internal/endtoend/testdata/query_parameter_limit/-1/python_postgresql/query.sql b/internal/endtoend/testdata/query_parameter_limit/-1/python_postgresql/query.sql deleted file mode 100644 index 7afab0139a..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/-1/python_postgresql/query.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE bar (id serial not null, name text not null, primary key (id)); - --- name: DeleteBarByID :execrows -DELETE FROM bar WHERE id = $1; - --- name: DeleteBarByIDAndName :execrows -DELETE FROM bar WHERE id = $1 AND name = $2; diff --git a/internal/endtoend/testdata/query_parameter_limit/-1/python_postgresql/sqlc.json b/internal/endtoend/testdata/query_parameter_limit/-1/python_postgresql/sqlc.json deleted file mode 100644 index 3a7bd37085..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/-1/python_postgresql/sqlc.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "version": "2", - "plugins": [ - { - "name": "py", - "wasm": { - "url": "https://downloads.sqlc.dev/plugin/sqlc-gen-python_1.1.0.wasm", - "sha256": "ef58f143a8c116781091441770c7166caaf361dd645f62b8f05f462e9f95c3b2" - } - } - ], - "sql": [ - { - "schema": "query.sql", - "queries": "query.sql", - "engine": "postgresql", - "codegen": [ - { - "plugin": "py", - "out": "python", - "options": { - "package": "querytest", - "emit_sync_querier": true, - "emit_async_querier": true, - "query_parameter_limit": -1 - } - } - ] - } - ] -} diff --git a/internal/endtoend/testdata/query_parameter_limit/-1/python_postgresql/stderr.txt b/internal/endtoend/testdata/query_parameter_limit/-1/python_postgresql/stderr.txt deleted file mode 100644 index efed0cc10b..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/-1/python_postgresql/stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -# package py -error generating code: error generating output: invalid query parameter limit diff --git a/internal/endtoend/testdata/query_parameter_limit/0/python_postgresql/python/models.py b/internal/endtoend/testdata/query_parameter_limit/0/python_postgresql/python/models.py deleted file mode 100644 index b5910b4dce..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/0/python_postgresql/python/models.py +++ /dev/null @@ -1,10 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -import dataclasses - - -@dataclasses.dataclass() -class Bar: - id: int - name: str diff --git a/internal/endtoend/testdata/query_parameter_limit/0/python_postgresql/python/query.py b/internal/endtoend/testdata/query_parameter_limit/0/python_postgresql/python/query.py deleted file mode 100644 index 82183b8839..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/0/python_postgresql/python/query.py +++ /dev/null @@ -1,57 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -# source: query.sql -import dataclasses - -import sqlalchemy -import sqlalchemy.ext.asyncio - -from querytest import models - - -DELETE_BAR_BY_ID = """-- name: delete_bar_by_id \\:execrows -DELETE FROM bar WHERE id = :p1 -""" - - -@dataclasses.dataclass() -class DeleteBarByIDParams: - id: int - - -DELETE_BAR_BY_ID_AND_NAME = """-- name: delete_bar_by_id_and_name \\:execrows -DELETE FROM bar WHERE id = :p1 AND name = :p2 -""" - - -@dataclasses.dataclass() -class DeleteBarByIDAndNameParams: - id: int - name: str - - -class Querier: - def __init__(self, conn: sqlalchemy.engine.Connection): - self._conn = conn - - def delete_bar_by_id(self, arg: DeleteBarByIDParams) -> int: - result = self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID), {"p1": arg.id}) - return result.rowcount - - def delete_bar_by_id_and_name(self, arg: DeleteBarByIDAndNameParams) -> int: - result = self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID_AND_NAME), {"p1": arg.id, "p2": arg.name}) - return result.rowcount - - -class AsyncQuerier: - def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection): - self._conn = conn - - async def delete_bar_by_id(self, arg: DeleteBarByIDParams) -> int: - result = await self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID), {"p1": arg.id}) - return result.rowcount - - async def delete_bar_by_id_and_name(self, arg: DeleteBarByIDAndNameParams) -> int: - result = await self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID_AND_NAME), {"p1": arg.id, "p2": arg.name}) - return result.rowcount diff --git a/internal/endtoend/testdata/query_parameter_limit/0/python_postgresql/query.sql b/internal/endtoend/testdata/query_parameter_limit/0/python_postgresql/query.sql deleted file mode 100644 index 7afab0139a..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/0/python_postgresql/query.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE bar (id serial not null, name text not null, primary key (id)); - --- name: DeleteBarByID :execrows -DELETE FROM bar WHERE id = $1; - --- name: DeleteBarByIDAndName :execrows -DELETE FROM bar WHERE id = $1 AND name = $2; diff --git a/internal/endtoend/testdata/query_parameter_limit/0/python_postgresql/sqlc.json b/internal/endtoend/testdata/query_parameter_limit/0/python_postgresql/sqlc.json deleted file mode 100644 index 03d48784e5..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/0/python_postgresql/sqlc.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "version": "2", - "plugins": [ - { - "name": "py", - "wasm": { - "url": "https://downloads.sqlc.dev/plugin/sqlc-gen-python_1.1.0.wasm", - "sha256": "ef58f143a8c116781091441770c7166caaf361dd645f62b8f05f462e9f95c3b2" - } - } - ], - "sql": [ - { - "schema": "query.sql", - "queries": "query.sql", - "engine": "postgresql", - "codegen": [ - { - "plugin": "py", - "out": "python", - "options": { - "package": "querytest", - "emit_sync_querier": true, - "emit_async_querier": true, - "query_parameter_limit": 0 - } - } - ] - } - ] -} diff --git a/internal/endtoend/testdata/query_parameter_limit/2/python_postgresql/python/models.py b/internal/endtoend/testdata/query_parameter_limit/2/python_postgresql/python/models.py deleted file mode 100644 index b5910b4dce..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/2/python_postgresql/python/models.py +++ /dev/null @@ -1,10 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -import dataclasses - - -@dataclasses.dataclass() -class Bar: - id: int - name: str diff --git a/internal/endtoend/testdata/query_parameter_limit/2/python_postgresql/python/query.py b/internal/endtoend/testdata/query_parameter_limit/2/python_postgresql/python/query.py deleted file mode 100644 index e7a20a42a7..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/2/python_postgresql/python/query.py +++ /dev/null @@ -1,44 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -# source: query.sql -import sqlalchemy -import sqlalchemy.ext.asyncio - -from querytest import models - - -DELETE_BAR_BY_ID = """-- name: delete_bar_by_id \\:execrows -DELETE FROM bar WHERE id = :p1 -""" - - -DELETE_BAR_BY_ID_AND_NAME = """-- name: delete_bar_by_id_and_name \\:execrows -DELETE FROM bar WHERE id = :p1 AND name = :p2 -""" - - -class Querier: - def __init__(self, conn: sqlalchemy.engine.Connection): - self._conn = conn - - def delete_bar_by_id(self, *, id: int) -> int: - result = self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID), {"p1": id}) - return result.rowcount - - def delete_bar_by_id_and_name(self, *, id: int, name: str) -> int: - result = self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID_AND_NAME), {"p1": id, "p2": name}) - return result.rowcount - - -class AsyncQuerier: - def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection): - self._conn = conn - - async def delete_bar_by_id(self, *, id: int) -> int: - result = await self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID), {"p1": id}) - return result.rowcount - - async def delete_bar_by_id_and_name(self, *, id: int, name: str) -> int: - result = await self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID_AND_NAME), {"p1": id, "p2": name}) - return result.rowcount diff --git a/internal/endtoend/testdata/query_parameter_limit/2/python_postgresql/query.sql b/internal/endtoend/testdata/query_parameter_limit/2/python_postgresql/query.sql deleted file mode 100644 index 7afab0139a..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/2/python_postgresql/query.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE bar (id serial not null, name text not null, primary key (id)); - --- name: DeleteBarByID :execrows -DELETE FROM bar WHERE id = $1; - --- name: DeleteBarByIDAndName :execrows -DELETE FROM bar WHERE id = $1 AND name = $2; diff --git a/internal/endtoend/testdata/query_parameter_limit/2/python_postgresql/sqlc.json b/internal/endtoend/testdata/query_parameter_limit/2/python_postgresql/sqlc.json deleted file mode 100644 index 248db1fadc..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/2/python_postgresql/sqlc.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "version": "2", - "plugins": [ - { - "name": "py", - "wasm": { - "url": "https://downloads.sqlc.dev/plugin/sqlc-gen-python_1.1.0.wasm", - "sha256": "ef58f143a8c116781091441770c7166caaf361dd645f62b8f05f462e9f95c3b2" - } - } - ], - "sql": [ - { - "schema": "query.sql", - "queries": "query.sql", - "engine": "postgresql", - "codegen": [ - { - "plugin": "py", - "out": "python", - "options": { - "package": "querytest", - "emit_sync_querier": true, - "emit_async_querier": true, - "query_parameter_limit": 2 - } - } - ] - } - ] -} diff --git a/internal/endtoend/testdata/query_parameter_limit/undefined/python_postgresql/python/models.py b/internal/endtoend/testdata/query_parameter_limit/undefined/python_postgresql/python/models.py deleted file mode 100644 index 5c79cb3ef2..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/undefined/python_postgresql/python/models.py +++ /dev/null @@ -1,12 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -import dataclasses - - -@dataclasses.dataclass() -class Bar: - id: int - name1: str - name2: str - name3: str diff --git a/internal/endtoend/testdata/query_parameter_limit/undefined/python_postgresql/python/query.py b/internal/endtoend/testdata/query_parameter_limit/undefined/python_postgresql/python/query.py deleted file mode 100644 index cec78b563e..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/undefined/python_postgresql/python/query.py +++ /dev/null @@ -1,58 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -# source: query.sql -import sqlalchemy -import sqlalchemy.ext.asyncio - -from querytest import models - - -DELETE_BAR_BY_ID = """-- name: delete_bar_by_id \\:execrows -DELETE FROM bar WHERE id = :p1 -""" - - -DELETE_BAR_BY_ID_AND_NAME = """-- name: delete_bar_by_id_and_name \\:execrows -DELETE FROM bar -WHERE id = :p1 -AND name1 = :p2 -AND name2 = :p3 -AND name3 = :p4 -""" - - -class Querier: - def __init__(self, conn: sqlalchemy.engine.Connection): - self._conn = conn - - def delete_bar_by_id(self, *, id: int) -> int: - result = self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID), {"p1": id}) - return result.rowcount - - def delete_bar_by_id_and_name(self, *, id: int, name1: str, name2: str, name3: str) -> int: - result = self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID_AND_NAME), { - "p1": id, - "p2": name1, - "p3": name2, - "p4": name3, - }) - return result.rowcount - - -class AsyncQuerier: - def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection): - self._conn = conn - - async def delete_bar_by_id(self, *, id: int) -> int: - result = await self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID), {"p1": id}) - return result.rowcount - - async def delete_bar_by_id_and_name(self, *, id: int, name1: str, name2: str, name3: str) -> int: - result = await self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID_AND_NAME), { - "p1": id, - "p2": name1, - "p3": name2, - "p4": name3, - }) - return result.rowcount diff --git a/internal/endtoend/testdata/query_parameter_limit/undefined/python_postgresql/query.sql b/internal/endtoend/testdata/query_parameter_limit/undefined/python_postgresql/query.sql deleted file mode 100644 index 96988f9284..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/undefined/python_postgresql/query.sql +++ /dev/null @@ -1,17 +0,0 @@ -CREATE TABLE bar ( - id serial not null, - name1 text not null, - name2 text not null, - name3 text not null, - primary key (id)); - --- name: DeleteBarByID :execrows -DELETE FROM bar WHERE id = $1; - --- name: DeleteBarByIDAndName :execrows -DELETE FROM bar -WHERE id = $1 -AND name1 = $2 -AND name2 = $3 -AND name3 = $4 -; diff --git a/internal/endtoend/testdata/query_parameter_limit/undefined/python_postgresql/sqlc.json b/internal/endtoend/testdata/query_parameter_limit/undefined/python_postgresql/sqlc.json deleted file mode 100644 index 1e3c0636a6..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/undefined/python_postgresql/sqlc.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "version": "2", - "plugins": [ - { - "name": "py", - "wasm": { - "url": "https://downloads.sqlc.dev/plugin/sqlc-gen-python_1.0.0.wasm", - "sha256": "aca83e1f59f8ffdc604774c2f6f9eb321a2b23e07dc83fc12289d25305fa065b" - } - } - ], - "sql": [ - { - "schema": "query.sql", - "queries": "query.sql", - "engine": "postgresql", - "codegen": [ - { - "plugin": "py", - "out": "python", - "options": { - "package": "querytest", - "emit_sync_querier": true, - "emit_async_querier": true - } - } - ] - } - ] -} diff --git a/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/query.sql b/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/query.sql index eb10e5cb4c..a71d662465 100644 --- a/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/query.sql +++ b/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/query.sql @@ -1,11 +1,3 @@ --- Example queries for sqlc -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - name text NOT NULL, - bio text, - country_code CHAR(2) NOT NULL -); - -- name: GetAuthor :one SELECT * FROM authors WHERE name = $1 AND country_code = $2 LIMIT 1; diff --git a/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/schema.sql b/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/schema.sql new file mode 100644 index 0000000000..6027f56d97 --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text, + country_code CHAR(2) NOT NULL +); diff --git a/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/sqlc.json b/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/sqlc.json index 4d1fb3f94d..c473270913 100644 --- a/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/sqlc.json +++ b/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "query_parameter_limit": -1 } diff --git a/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/stderr.txt b/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/stderr.txt index 2f0a7a559a..9e1760ffca 100644 --- a/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/stderr.txt +++ b/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/stderr.txt @@ -1 +1,2 @@ -error parsing sqlc.json: invalid query parameter limit +# package querytest +error generating code: invalid options: query parameter limit must not be negative diff --git a/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/db.go b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/db.go +++ b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/models.go b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/models.go index 20529a3c63..bf48c95dcc 100644 --- a/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/models.go +++ b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/querier.go b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/querier.go index f9db08ebd0..571c4c2e91 100644 --- a/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/querier.go +++ b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/query.sql.go b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/query.sql.go index f920f33df2..065ea6b556 100644 --- a/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/query.sql b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/query.sql index 7cdc56fadf..7622bafa13 100644 --- a/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/query.sql +++ b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/query.sql @@ -1,11 +1,3 @@ -CREATE TABLE notice ( - id INTEGER NOT NULL, - cnt INTEGER NOT NULL, - status TEXT NOT NULL, - notice_at TIMESTAMP, - created_at TIMESTAMP NOT NULL -); - -- name: MarkNoticeDone :exec UPDATE notice SET status='done', notice_at=$1 diff --git a/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/schema.sql b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/schema.sql new file mode 100644 index 0000000000..f07b5f4d7c --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/schema.sql @@ -0,0 +1,8 @@ +CREATE TABLE notice ( + id INTEGER NOT NULL, + cnt INTEGER NOT NULL, + status TEXT NOT NULL, + notice_at TIMESTAMP, + created_at TIMESTAMP NOT NULL +); + diff --git a/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/sqlc.json b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/sqlc.json index 8cf64b386a..78d96c3e80 100644 --- a/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/sqlc.json +++ b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "engine": "postgresql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "query_parameter_limit": 2, "emit_interface": true, diff --git a/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/db.go b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/db.go +++ b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/models.go b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/models.go index 2d0c5f461d..fff4b9d91a 100644 --- a/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/models.go +++ b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/query.sql.go b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/query.sql.go index 9dfc90e90e..af0d591ad1 100644 --- a/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/query.sql b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/query.sql index 13ee235bd6..b255f75dbd 100644 --- a/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/query.sql +++ b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/query.sql @@ -1,12 +1,3 @@ --- Example queries for sqlc -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - name text NOT NULL, - bio text, - country_code CHAR(2) NOT NULL, - titles TEXT[] -); - -- name: GetAuthor :one SELECT * FROM authors WHERE name = $1 AND country_code = $2 LIMIT 1; @@ -34,15 +25,10 @@ WHERE id IN (sqlc.slice(ids)) AND name = $1; -- name: CreateAuthorOnlyTitles :one INSERT INTO authors (name, titles) VALUES ($1, $2) RETURNING *; -CREATE TABLE clients ( - id INT PRIMARY KEY, - name TEXT NOT NULL -); - -- name: AddNewClient :one INSERT INTO clients ( id, name ) VALUES ( $1, $2 ) -RETURNING *; \ No newline at end of file +RETURNING *; diff --git a/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/schema.sql b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/schema.sql new file mode 100644 index 0000000000..eef7025648 --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/schema.sql @@ -0,0 +1,13 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text, + country_code CHAR(2) NOT NULL, + titles TEXT[] +); + +CREATE TABLE clients ( + id INT PRIMARY KEY, + name TEXT NOT NULL +); diff --git a/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/sqlc.json b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/sqlc.json index 12c7d1c0a0..5aea38de5e 100644 --- a/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/sqlc.json +++ b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "query_parameter_limit": 2 } diff --git a/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/db.go b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/db.go +++ b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/models.go b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/models.go index 64fd8386cc..db9108bb80 100644 --- a/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/models.go +++ b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/querier.go b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/querier.go index 480c4a4ca9..0d2ece1477 100644 --- a/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/querier.go +++ b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/query.sql.go b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/query.sql.go index a4ab8a0d7d..e0aa6b8c1b 100644 --- a/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/query.sql b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/query.sql index eb10e5cb4c..a71d662465 100644 --- a/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/query.sql +++ b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/query.sql @@ -1,11 +1,3 @@ --- Example queries for sqlc -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - name text NOT NULL, - bio text, - country_code CHAR(2) NOT NULL -); - -- name: GetAuthor :one SELECT * FROM authors WHERE name = $1 AND country_code = $2 LIMIT 1; diff --git a/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/schema.sql b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/schema.sql new file mode 100644 index 0000000000..d06fd86126 --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/schema.sql @@ -0,0 +1,8 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text, + country_code CHAR(2) NOT NULL +); + diff --git a/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/sqlc.json b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/sqlc.json index 94207244d9..af2da739c1 100644 --- a/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/sqlc.json +++ b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "query_parameter_limit": 0, "emit_interface": true diff --git a/internal/endtoend/testdata/quoted_colname/sqlite/go/db.go b/internal/endtoend/testdata/quoted_colname/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/quoted_colname/sqlite/go/db.go +++ b/internal/endtoend/testdata/quoted_colname/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/quoted_colname/sqlite/go/models.go b/internal/endtoend/testdata/quoted_colname/sqlite/go/models.go index b4797d1b57..11b0271bc3 100644 --- a/internal/endtoend/testdata/quoted_colname/sqlite/go/models.go +++ b/internal/endtoend/testdata/quoted_colname/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Test struct { ID string } diff --git a/internal/endtoend/testdata/quoted_colname/sqlite/go/query.sql.go b/internal/endtoend/testdata/quoted_colname/sqlite/go/query.sql.go index 701d79cd7c..5c12e677f6 100644 --- a/internal/endtoend/testdata/quoted_colname/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/quoted_colname/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/quoted_colname/sqlite/query.sql b/internal/endtoend/testdata/quoted_colname/sqlite/query.sql index a40ba6fd45..8b8ae15e9a 100644 --- a/internal/endtoend/testdata/quoted_colname/sqlite/query.sql +++ b/internal/endtoend/testdata/quoted_colname/sqlite/query.sql @@ -1,8 +1,2 @@ --- Example queries for sqlc -CREATE TABLE "test" -( - "id" TEXT NOT NULL -); - -- name: TestList :many SELECT * FROM "test"; \ No newline at end of file diff --git a/internal/endtoend/testdata/quoted_colname/sqlite/schema.sql b/internal/endtoend/testdata/quoted_colname/sqlite/schema.sql new file mode 100644 index 0000000000..8e6b5b38d6 --- /dev/null +++ b/internal/endtoend/testdata/quoted_colname/sqlite/schema.sql @@ -0,0 +1,6 @@ +-- Example queries for sqlc +CREATE TABLE "test" +( + "id" TEXT NOT NULL +); + diff --git a/internal/endtoend/testdata/quoted_colname/sqlite/sqlc.json b/internal/endtoend/testdata/quoted_colname/sqlite/sqlc.json index 3ed5eea856..ea4a23425f 100644 --- a/internal/endtoend/testdata/quoted_colname/sqlite/sqlc.json +++ b/internal/endtoend/testdata/quoted_colname/sqlite/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "engine": "sqlite", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "name": "querytest" } diff --git a/internal/endtoend/testdata/quoted_names_complex/sqlite/go/db.go b/internal/endtoend/testdata/quoted_names_complex/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/quoted_names_complex/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/quoted_names_complex/sqlite/go/models.go b/internal/endtoend/testdata/quoted_names_complex/sqlite/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/quoted_names_complex/sqlite/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest diff --git a/internal/endtoend/testdata/quoted_names_complex/sqlite/go/query.sql.go b/internal/endtoend/testdata/quoted_names_complex/sqlite/go/query.sql.go new file mode 100644 index 0000000000..3f59aec9b9 --- /dev/null +++ b/internal/endtoend/testdata/quoted_names_complex/sqlite/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const placeholder = `-- name: Placeholder :exec +SELECT 1 +` + +func (q *Queries) Placeholder(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/quoted_names_complex/sqlite/query.sql b/internal/endtoend/testdata/quoted_names_complex/sqlite/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/quoted_names_complex/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/quoted_names_complex/sqlite/schema.sql b/internal/endtoend/testdata/quoted_names_complex/sqlite/schema.sql new file mode 100644 index 0000000000..fc6a73756e --- /dev/null +++ b/internal/endtoend/testdata/quoted_names_complex/sqlite/schema.sql @@ -0,0 +1,22 @@ +-- Test complex quoted table and column names with special characters +-- Covers spaces, hyphens, uppercase, and mixed operations +CREATE TABLE "user profiles" (id integer primary key, data text); +CREATE TABLE "ORDERS" (id integer primary key, data text); +CREATE TABLE products (id integer primary key, data text); +CREATE TABLE "item-categories" (id integer primary key, data text); + +-- Test ALTER statements with complex identifiers +ALTER TABLE "user profiles" RENAME COLUMN data TO "profile data"; +ALTER TABLE "ORDERS" RENAME TO "customer_orders"; +ALTER TABLE products ADD COLUMN "Price Info" text; + +-- Test mixed case operations across different statement types +INSERT INTO "user profiles" ("profile data") VALUES ('test data'); +UPDATE "ORDERS" SET data = 'updated' WHERE id = 1; +DELETE FROM products WHERE id = 1; + +-- Test DROP with various identifier formats +DROP TABLE "user profiles"; +DROP TABLE "customer_orders"; +DROP TABLE "item-categories"; +DROP TABLE products; diff --git a/internal/endtoend/testdata/quoted_names_complex/sqlite/sqlc.json b/internal/endtoend/testdata/quoted_names_complex/sqlite/sqlc.json new file mode 100644 index 0000000000..cd66df063b --- /dev/null +++ b/internal/endtoend/testdata/quoted_names_complex/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/quoted_tablename/sqlite/go/db.go b/internal/endtoend/testdata/quoted_tablename/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/quoted_tablename/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/quoted_tablename/sqlite/go/models.go b/internal/endtoend/testdata/quoted_tablename/sqlite/go/models.go new file mode 100644 index 0000000000..1bbac6281c --- /dev/null +++ b/internal/endtoend/testdata/quoted_tablename/sqlite/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type User struct { + ID string +} diff --git a/internal/endtoend/testdata/quoted_tablename/sqlite/go/query.sql.go b/internal/endtoend/testdata/quoted_tablename/sqlite/go/query.sql.go new file mode 100644 index 0000000000..e6f06662ab --- /dev/null +++ b/internal/endtoend/testdata/quoted_tablename/sqlite/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const testList = `-- name: TestList :many +SELECT id FROM users +` + +func (q *Queries) TestList(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, testList) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var id string + if err := rows.Scan(&id); err != nil { + return nil, err + } + items = append(items, id) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/quoted_tablename/sqlite/query.sql b/internal/endtoend/testdata/quoted_tablename/sqlite/query.sql new file mode 100644 index 0000000000..0d3b8e238b --- /dev/null +++ b/internal/endtoend/testdata/quoted_tablename/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: TestList :many +SELECT * FROM users; diff --git a/internal/endtoend/testdata/quoted_tablename/sqlite/schema.sql b/internal/endtoend/testdata/quoted_tablename/sqlite/schema.sql new file mode 100644 index 0000000000..078fa24bf6 --- /dev/null +++ b/internal/endtoend/testdata/quoted_tablename/sqlite/schema.sql @@ -0,0 +1,6 @@ +-- Example queries for sqlc +CREATE TABLE "users" +( + id TEXT NOT NULL +); + diff --git a/internal/endtoend/testdata/quoted_tablename/sqlite/sqlc.json b/internal/endtoend/testdata/quoted_tablename/sqlite/sqlc.json new file mode 100644 index 0000000000..ea4a23425f --- /dev/null +++ b/internal/endtoend/testdata/quoted_tablename/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "schema": "schema.sql", + "queries": "query.sql", + "name": "querytest" + } + ] +} \ No newline at end of file diff --git a/internal/endtoend/testdata/ranges/pgx/v5/go/db.go b/internal/endtoend/testdata/ranges/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/ranges/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ranges/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ranges/pgx/v5/go/models.go b/internal/endtoend/testdata/ranges/pgx/v5/go/models.go index fb526e2635..07e82ad410 100644 --- a/internal/endtoend/testdata/ranges/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ranges/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/ranges/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ranges/pgx/v5/go/query.sql.go index 35df855453..7231704edd 100644 --- a/internal/endtoend/testdata/ranges/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ranges/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ranges/pgx/v5/query.sql b/internal/endtoend/testdata/ranges/pgx/v5/query.sql index 5a8e8bf23f..0119001690 100644 --- a/internal/endtoend/testdata/ranges/pgx/v5/query.sql +++ b/internal/endtoend/testdata/ranges/pgx/v5/query.sql @@ -1,30 +1,2 @@ -CREATE TABLE test_table -( - v_daterange_null daterange, - v_datemultirange_null datemultirange, - v_tsrange_null tsrange, - v_tsmultirange_null tsmultirange, - v_tstzrange_null tstzrange, - v_tstzmultirange_null tstzmultirange, - v_numrange_null numrange, - v_nummultirange_null nummultirange, - v_int4range_null int4range, - v_int4multirange_null int4multirange, - v_int8range_null int8range, - v_int8multirange_null int8multirange, - v_daterange daterange not null, - v_datemultirange datemultirange not null, - v_tsrange tsrange not null, - v_tsmultirange tsmultirange not null, - v_tstzrange tstzrange not null, - v_tstzmultirange tstzmultirange not null, - v_numrange numrange not null, - v_nummultirange nummultirange not null, - v_int4range int4range not null, - v_int4multirange int4multirange not null, - v_int8range int8range not null, - v_int8multirange int8multirange not null -); - -- name: SelectTest :many SELECT * from test_table; diff --git a/internal/endtoend/testdata/ranges/pgx/v5/schema.sql b/internal/endtoend/testdata/ranges/pgx/v5/schema.sql new file mode 100644 index 0000000000..d217bb66f1 --- /dev/null +++ b/internal/endtoend/testdata/ranges/pgx/v5/schema.sql @@ -0,0 +1,28 @@ +CREATE TABLE test_table +( + v_daterange_null daterange, + v_datemultirange_null datemultirange, + v_tsrange_null tsrange, + v_tsmultirange_null tsmultirange, + v_tstzrange_null tstzrange, + v_tstzmultirange_null tstzmultirange, + v_numrange_null numrange, + v_nummultirange_null nummultirange, + v_int4range_null int4range, + v_int4multirange_null int4multirange, + v_int8range_null int8range, + v_int8multirange_null int8multirange, + v_daterange daterange not null, + v_datemultirange datemultirange not null, + v_tsrange tsrange not null, + v_tsmultirange tsmultirange not null, + v_tstzrange tstzrange not null, + v_tstzmultirange tstzmultirange not null, + v_numrange numrange not null, + v_nummultirange nummultirange not null, + v_int4range int4range not null, + v_int4multirange int4multirange not null, + v_int8range int8range not null, + v_int8multirange int8multirange not null +); + diff --git a/internal/endtoend/testdata/ranges/pgx/v5/sqlc.json b/internal/endtoend/testdata/ranges/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/ranges/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/ranges/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/models.go index 2fb8f72eca..f09d714a39 100644 --- a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Myview struct { int32 } diff --git a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/query.sql.go index dc2448166c..cee6ee9091 100644 --- a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/query.sql index db4a722fd4..3b3af63640 100644 --- a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/query.sql @@ -1,4 +1,2 @@ -CREATE MATERIALIZED VIEW myview AS (SELECT 1); - -- name: Refresh :exec REFRESH MATERIALIZED VIEW myview; diff --git a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..5b5f556495 --- /dev/null +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE MATERIALIZED VIEW myview AS (SELECT 1); + diff --git a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/models.go index 2fb8f72eca..f09d714a39 100644 --- a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Myview struct { int32 } diff --git a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/query.sql.go index dc2448166c..cee6ee9091 100644 --- a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/query.sql index db4a722fd4..3b3af63640 100644 --- a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/query.sql @@ -1,4 +1,2 @@ -CREATE MATERIALIZED VIEW myview AS (SELECT 1); - -- name: Refresh :exec REFRESH MATERIALIZED VIEW myview; diff --git a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..5b5f556495 --- /dev/null +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE MATERIALIZED VIEW myview AS (SELECT 1); + diff --git a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/relation_does_not_exist/postgresql/schema.sql b/internal/endtoend/testdata/relation_does_not_exist/postgresql/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/relation_does_not_exist/postgresql/sqlc.json b/internal/endtoend/testdata/relation_does_not_exist/postgresql/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/relation_does_not_exist/postgresql/sqlc.json +++ b/internal/endtoend/testdata/relation_does_not_exist/postgresql/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/relation_does_not_exist/postgresql/stderr.txt b/internal/endtoend/testdata/relation_does_not_exist/postgresql/stderr/base.txt similarity index 100% rename from internal/endtoend/testdata/relation_does_not_exist/postgresql/stderr.txt rename to internal/endtoend/testdata/relation_does_not_exist/postgresql/stderr/base.txt diff --git a/internal/endtoend/testdata/relation_does_not_exist/postgresql/stderr/managed-db.txt b/internal/endtoend/testdata/relation_does_not_exist/postgresql/stderr/managed-db.txt new file mode 100644 index 0000000000..5621f9739e --- /dev/null +++ b/internal/endtoend/testdata/relation_does_not_exist/postgresql/stderr/managed-db.txt @@ -0,0 +1,5 @@ +# package querytest +query.sql:2:15: relation "nonexisting_relation" does not exist +query.sql:5:15: relation "nonexisting_relation" does not exist +query.sql:8:8: relation "nonexisting_relation" does not exist +query.sql:11:13: relation "nonexisting_relation" does not exist diff --git a/internal/endtoend/testdata/rename/v1/pgx/v4/go/db.go b/internal/endtoend/testdata/rename/v1/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/rename/v1/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/rename/v1/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/rename/v1/pgx/v4/go/models.go b/internal/endtoend/testdata/rename/v1/pgx/v4/go/models.go index 77aa1bbbf3..7036918b46 100644 --- a/internal/endtoend/testdata/rename/v1/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/rename/v1/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/rename/v1/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/rename/v1/pgx/v4/go/query.sql.go index 531548fbb1..30a1622132 100644 --- a/internal/endtoend/testdata/rename/v1/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/rename/v1/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/rename/v1/pgx/v4/query.sql b/internal/endtoend/testdata/rename/v1/pgx/v4/query.sql index e91722b3f3..a8211d0edb 100644 --- a/internal/endtoend/testdata/rename/v1/pgx/v4/query.sql +++ b/internal/endtoend/testdata/rename/v1/pgx/v4/query.sql @@ -1,7 +1,3 @@ -CREATE TYPE ip_protocol AS enum('tcp', 'ip', 'icmp'); - -CREATE TABLE bar_old (id_old serial not null, ip_old ip_protocol NOT NULL); - -- name: ListFoo :many SELECT id_old as foo_old, id_old as baz_old FROM bar_old diff --git a/internal/endtoend/testdata/rename/v1/pgx/v4/schema.sql b/internal/endtoend/testdata/rename/v1/pgx/v4/schema.sql new file mode 100644 index 0000000000..764436c901 --- /dev/null +++ b/internal/endtoend/testdata/rename/v1/pgx/v4/schema.sql @@ -0,0 +1,4 @@ +CREATE TYPE ip_protocol AS enum('tcp', 'ip', 'icmp'); + +CREATE TABLE bar_old (id_old serial not null, ip_old ip_protocol NOT NULL); + diff --git a/internal/endtoend/testdata/rename/v1/pgx/v4/sqlc.json b/internal/endtoend/testdata/rename/v1/pgx/v4/sqlc.json index 74e88aa712..50288fccd8 100644 --- a/internal/endtoend/testdata/rename/v1/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/rename/v1/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ], diff --git a/internal/endtoend/testdata/rename/v1/pgx/v5/go/db.go b/internal/endtoend/testdata/rename/v1/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/rename/v1/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/rename/v1/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/rename/v1/pgx/v5/go/models.go b/internal/endtoend/testdata/rename/v1/pgx/v5/go/models.go index 77aa1bbbf3..7036918b46 100644 --- a/internal/endtoend/testdata/rename/v1/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/rename/v1/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/rename/v1/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/rename/v1/pgx/v5/go/query.sql.go index 531548fbb1..30a1622132 100644 --- a/internal/endtoend/testdata/rename/v1/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/rename/v1/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/rename/v1/pgx/v5/query.sql b/internal/endtoend/testdata/rename/v1/pgx/v5/query.sql index e91722b3f3..a8211d0edb 100644 --- a/internal/endtoend/testdata/rename/v1/pgx/v5/query.sql +++ b/internal/endtoend/testdata/rename/v1/pgx/v5/query.sql @@ -1,7 +1,3 @@ -CREATE TYPE ip_protocol AS enum('tcp', 'ip', 'icmp'); - -CREATE TABLE bar_old (id_old serial not null, ip_old ip_protocol NOT NULL); - -- name: ListFoo :many SELECT id_old as foo_old, id_old as baz_old FROM bar_old diff --git a/internal/endtoend/testdata/rename/v1/pgx/v5/schema.sql b/internal/endtoend/testdata/rename/v1/pgx/v5/schema.sql new file mode 100644 index 0000000000..764436c901 --- /dev/null +++ b/internal/endtoend/testdata/rename/v1/pgx/v5/schema.sql @@ -0,0 +1,4 @@ +CREATE TYPE ip_protocol AS enum('tcp', 'ip', 'icmp'); + +CREATE TABLE bar_old (id_old serial not null, ip_old ip_protocol NOT NULL); + diff --git a/internal/endtoend/testdata/rename/v1/pgx/v5/sqlc.json b/internal/endtoend/testdata/rename/v1/pgx/v5/sqlc.json index cfc74266d0..89225718f3 100644 --- a/internal/endtoend/testdata/rename/v1/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/rename/v1/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ], diff --git a/internal/endtoend/testdata/rename/v1/stdlib/go/db.go b/internal/endtoend/testdata/rename/v1/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/rename/v1/stdlib/go/db.go +++ b/internal/endtoend/testdata/rename/v1/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/rename/v1/stdlib/go/models.go b/internal/endtoend/testdata/rename/v1/stdlib/go/models.go index 77aa1bbbf3..7036918b46 100644 --- a/internal/endtoend/testdata/rename/v1/stdlib/go/models.go +++ b/internal/endtoend/testdata/rename/v1/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/rename/v1/stdlib/go/query.sql.go b/internal/endtoend/testdata/rename/v1/stdlib/go/query.sql.go index 5c5cb30ba6..b4f51c51fa 100644 --- a/internal/endtoend/testdata/rename/v1/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/rename/v1/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/rename/v1/stdlib/query.sql b/internal/endtoend/testdata/rename/v1/stdlib/query.sql index e91722b3f3..a8211d0edb 100644 --- a/internal/endtoend/testdata/rename/v1/stdlib/query.sql +++ b/internal/endtoend/testdata/rename/v1/stdlib/query.sql @@ -1,7 +1,3 @@ -CREATE TYPE ip_protocol AS enum('tcp', 'ip', 'icmp'); - -CREATE TABLE bar_old (id_old serial not null, ip_old ip_protocol NOT NULL); - -- name: ListFoo :many SELECT id_old as foo_old, id_old as baz_old FROM bar_old diff --git a/internal/endtoend/testdata/rename/v1/stdlib/schema.sql b/internal/endtoend/testdata/rename/v1/stdlib/schema.sql new file mode 100644 index 0000000000..764436c901 --- /dev/null +++ b/internal/endtoend/testdata/rename/v1/stdlib/schema.sql @@ -0,0 +1,4 @@ +CREATE TYPE ip_protocol AS enum('tcp', 'ip', 'icmp'); + +CREATE TABLE bar_old (id_old serial not null, ip_old ip_protocol NOT NULL); + diff --git a/internal/endtoend/testdata/rename/v1/stdlib/sqlc.json b/internal/endtoend/testdata/rename/v1/stdlib/sqlc.json index a7cf0ce2a7..630709db5c 100644 --- a/internal/endtoend/testdata/rename/v1/stdlib/sqlc.json +++ b/internal/endtoend/testdata/rename/v1/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ], diff --git a/internal/endtoend/testdata/rename/v2/pgx/v4/go/db.go b/internal/endtoend/testdata/rename/v2/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/rename/v2/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/rename/v2/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/rename/v2/pgx/v4/go/models.go b/internal/endtoend/testdata/rename/v2/pgx/v4/go/models.go index 77aa1bbbf3..7036918b46 100644 --- a/internal/endtoend/testdata/rename/v2/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/rename/v2/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/rename/v2/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/rename/v2/pgx/v4/go/query.sql.go index 531548fbb1..30a1622132 100644 --- a/internal/endtoend/testdata/rename/v2/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/rename/v2/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/rename/v2/pgx/v4/query.sql b/internal/endtoend/testdata/rename/v2/pgx/v4/query.sql index e91722b3f3..a8211d0edb 100644 --- a/internal/endtoend/testdata/rename/v2/pgx/v4/query.sql +++ b/internal/endtoend/testdata/rename/v2/pgx/v4/query.sql @@ -1,7 +1,3 @@ -CREATE TYPE ip_protocol AS enum('tcp', 'ip', 'icmp'); - -CREATE TABLE bar_old (id_old serial not null, ip_old ip_protocol NOT NULL); - -- name: ListFoo :many SELECT id_old as foo_old, id_old as baz_old FROM bar_old diff --git a/internal/endtoend/testdata/rename/v2/pgx/v4/schema.sql b/internal/endtoend/testdata/rename/v2/pgx/v4/schema.sql new file mode 100644 index 0000000000..764436c901 --- /dev/null +++ b/internal/endtoend/testdata/rename/v2/pgx/v4/schema.sql @@ -0,0 +1,4 @@ +CREATE TYPE ip_protocol AS enum('tcp', 'ip', 'icmp'); + +CREATE TABLE bar_old (id_old serial not null, ip_old ip_protocol NOT NULL); + diff --git a/internal/endtoend/testdata/rename/v2/pgx/v4/sqlc.json b/internal/endtoend/testdata/rename/v2/pgx/v4/sqlc.json index 6f6b0f7878..ae08b824a3 100644 --- a/internal/endtoend/testdata/rename/v2/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/rename/v2/pgx/v4/sqlc.json @@ -2,7 +2,7 @@ "version": "2", "sql": [ { - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "engine": "postgresql", "gen": { diff --git a/internal/endtoend/testdata/rename/v2/pgx/v5/go/db.go b/internal/endtoend/testdata/rename/v2/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/rename/v2/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/rename/v2/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/rename/v2/pgx/v5/go/models.go b/internal/endtoend/testdata/rename/v2/pgx/v5/go/models.go index 77aa1bbbf3..7036918b46 100644 --- a/internal/endtoend/testdata/rename/v2/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/rename/v2/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/rename/v2/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/rename/v2/pgx/v5/go/query.sql.go index 531548fbb1..30a1622132 100644 --- a/internal/endtoend/testdata/rename/v2/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/rename/v2/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/rename/v2/pgx/v5/query.sql b/internal/endtoend/testdata/rename/v2/pgx/v5/query.sql index e91722b3f3..a8211d0edb 100644 --- a/internal/endtoend/testdata/rename/v2/pgx/v5/query.sql +++ b/internal/endtoend/testdata/rename/v2/pgx/v5/query.sql @@ -1,7 +1,3 @@ -CREATE TYPE ip_protocol AS enum('tcp', 'ip', 'icmp'); - -CREATE TABLE bar_old (id_old serial not null, ip_old ip_protocol NOT NULL); - -- name: ListFoo :many SELECT id_old as foo_old, id_old as baz_old FROM bar_old diff --git a/internal/endtoend/testdata/rename/v2/pgx/v5/schema.sql b/internal/endtoend/testdata/rename/v2/pgx/v5/schema.sql new file mode 100644 index 0000000000..764436c901 --- /dev/null +++ b/internal/endtoend/testdata/rename/v2/pgx/v5/schema.sql @@ -0,0 +1,4 @@ +CREATE TYPE ip_protocol AS enum('tcp', 'ip', 'icmp'); + +CREATE TABLE bar_old (id_old serial not null, ip_old ip_protocol NOT NULL); + diff --git a/internal/endtoend/testdata/rename/v2/pgx/v5/sqlc.json b/internal/endtoend/testdata/rename/v2/pgx/v5/sqlc.json index 93e41bef62..8f0a34dbad 100644 --- a/internal/endtoend/testdata/rename/v2/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/rename/v2/pgx/v5/sqlc.json @@ -3,7 +3,7 @@ "sql": [ { "engine": "postgresql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "gen": { "go": { diff --git a/internal/endtoend/testdata/rename/v2/stdlib/go/db.go b/internal/endtoend/testdata/rename/v2/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/rename/v2/stdlib/go/db.go +++ b/internal/endtoend/testdata/rename/v2/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/rename/v2/stdlib/go/models.go b/internal/endtoend/testdata/rename/v2/stdlib/go/models.go index 77aa1bbbf3..7036918b46 100644 --- a/internal/endtoend/testdata/rename/v2/stdlib/go/models.go +++ b/internal/endtoend/testdata/rename/v2/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/rename/v2/stdlib/go/query.sql.go b/internal/endtoend/testdata/rename/v2/stdlib/go/query.sql.go index 5c5cb30ba6..b4f51c51fa 100644 --- a/internal/endtoend/testdata/rename/v2/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/rename/v2/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/rename/v2/stdlib/query.sql b/internal/endtoend/testdata/rename/v2/stdlib/query.sql index e91722b3f3..a8211d0edb 100644 --- a/internal/endtoend/testdata/rename/v2/stdlib/query.sql +++ b/internal/endtoend/testdata/rename/v2/stdlib/query.sql @@ -1,7 +1,3 @@ -CREATE TYPE ip_protocol AS enum('tcp', 'ip', 'icmp'); - -CREATE TABLE bar_old (id_old serial not null, ip_old ip_protocol NOT NULL); - -- name: ListFoo :many SELECT id_old as foo_old, id_old as baz_old FROM bar_old diff --git a/internal/endtoend/testdata/rename/v2/stdlib/schema.sql b/internal/endtoend/testdata/rename/v2/stdlib/schema.sql new file mode 100644 index 0000000000..764436c901 --- /dev/null +++ b/internal/endtoend/testdata/rename/v2/stdlib/schema.sql @@ -0,0 +1,4 @@ +CREATE TYPE ip_protocol AS enum('tcp', 'ip', 'icmp'); + +CREATE TABLE bar_old (id_old serial not null, ip_old ip_protocol NOT NULL); + diff --git a/internal/endtoend/testdata/rename/v2/stdlib/sqlc.json b/internal/endtoend/testdata/rename/v2/stdlib/sqlc.json index 6c62c414d7..22372fffad 100644 --- a/internal/endtoend/testdata/rename/v2/stdlib/sqlc.json +++ b/internal/endtoend/testdata/rename/v2/stdlib/sqlc.json @@ -2,7 +2,7 @@ "version": "2", "sql": [ { - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "engine": "postgresql", "gen": { diff --git a/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/models.go index 33daba171e..ca9c03dd51 100644 --- a/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/query.sql.go index 14304e587a..c3c9a1d03d 100644 --- a/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/models.go index 2e07d2e82d..be032c0c74 100644 --- a/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/query.sql.go index f3a3bcc324..20a0a245a2 100644 --- a/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/returning/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/returning/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/returning/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/returning/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/returning/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/returning/postgresql/stdlib/go/models.go index 33daba171e..ca9c03dd51 100644 --- a/internal/endtoend/testdata/returning/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/returning/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/returning/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/returning/postgresql/stdlib/go/query.sql.go index 3337db0e7a..05d38d3c2a 100644 --- a/internal/endtoend/testdata/returning/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/returning/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/returning/sqlite/go/db.go b/internal/endtoend/testdata/returning/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/returning/sqlite/go/db.go +++ b/internal/endtoend/testdata/returning/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/returning/sqlite/go/models.go b/internal/endtoend/testdata/returning/sqlite/go/models.go index 1962df6427..5385a7eebc 100644 --- a/internal/endtoend/testdata/returning/sqlite/go/models.go +++ b/internal/endtoend/testdata/returning/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/returning/sqlite/go/query.sql.go b/internal/endtoend/testdata/returning/sqlite/go/query.sql.go index d23c28218d..8767922088 100644 --- a/internal/endtoend/testdata/returning/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/returning/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_create/mysql/exec.json b/internal/endtoend/testdata/schema_scoped_create/mysql/exec.json new file mode 100644 index 0000000000..c85ca2dfa7 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_create/mysql/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["base"], + "meta": { + "invalid_schema": true + } +} diff --git a/internal/endtoend/testdata/schema_scoped_create/mysql/go/db.go b/internal/endtoend/testdata/schema_scoped_create/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/schema_scoped_create/mysql/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_create/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/schema_scoped_create/mysql/go/models.go b/internal/endtoend/testdata/schema_scoped_create/mysql/go/models.go index 29a1b21425..d9da85602e 100644 --- a/internal/endtoend/testdata/schema_scoped_create/mysql/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_create/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type FooBar struct { ID uint64 Name string diff --git a/internal/endtoend/testdata/schema_scoped_create/mysql/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_create/mysql/go/query.sql.go index 5941bf0d70..0217d24cf3 100644 --- a/internal/endtoend/testdata/schema_scoped_create/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_create/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_create/mysql/query.sql b/internal/endtoend/testdata/schema_scoped_create/mysql/query.sql index 8e3d810b44..ac7e203e07 100644 --- a/internal/endtoend/testdata/schema_scoped_create/mysql/query.sql +++ b/internal/endtoend/testdata/schema_scoped_create/mysql/query.sql @@ -1,5 +1,2 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null, name text not null); - -- name: SchemaScopedCreate :execresult INSERT INTO foo.bar (id, name) VALUES (?, ?); diff --git a/internal/endtoend/testdata/schema_scoped_create/mysql/schema.sql b/internal/endtoend/testdata/schema_scoped_create/mysql/schema.sql new file mode 100644 index 0000000000..71e23e5c0c --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_create/mysql/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null, name text not null); + diff --git a/internal/endtoend/testdata/schema_scoped_create/mysql/sqlc.json b/internal/endtoend/testdata/schema_scoped_create/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/schema_scoped_create/mysql/sqlc.json +++ b/internal/endtoend/testdata/schema_scoped_create/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/models.go index b526d99ab2..db32907a18 100644 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type FooBar struct { ID int32 Name string diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/query.sql.go index 88f26c3de6..553162e34c 100644 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/query.sql index 6d7262e1d0..ecc6fb1d49 100644 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/query.sql @@ -1,5 +1,2 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null, name text not null); - -- name: SchemaScopedCreate :one INSERT INTO foo.bar (id, name) VALUES ($1, $2) RETURNING id; diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..71e23e5c0c --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null, name text not null); + diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/models.go index b526d99ab2..db32907a18 100644 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type FooBar struct { ID int32 Name string diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/query.sql.go index 88f26c3de6..553162e34c 100644 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/query.sql index 6d7262e1d0..ecc6fb1d49 100644 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/query.sql @@ -1,5 +1,2 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null, name text not null); - -- name: SchemaScopedCreate :one INSERT INTO foo.bar (id, name) VALUES ($1, $2) RETURNING id; diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..71e23e5c0c --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null, name text not null); + diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/models.go index b526d99ab2..db32907a18 100644 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type FooBar struct { ID int32 Name string diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/query.sql.go index c2942ae002..f8431ee605 100644 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/query.sql b/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/query.sql index 6d7262e1d0..ecc6fb1d49 100644 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/query.sql @@ -1,5 +1,2 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null, name text not null); - -- name: SchemaScopedCreate :one INSERT INTO foo.bar (id, name) VALUES ($1, $2) RETURNING id; diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..71e23e5c0c --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null, name text not null); + diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/schema_scoped_delete/mysql/exec.json b/internal/endtoend/testdata/schema_scoped_delete/mysql/exec.json new file mode 100644 index 0000000000..a0e224b3f8 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_delete/mysql/exec.json @@ -0,0 +1,7 @@ +{ + "contexts": ["base"], + "meta": { + "invalid_schema": true + } +} + \ No newline at end of file diff --git a/internal/endtoend/testdata/schema_scoped_delete/mysql/go/db.go b/internal/endtoend/testdata/schema_scoped_delete/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/mysql/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_delete/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/schema_scoped_delete/mysql/go/models.go b/internal/endtoend/testdata/schema_scoped_delete/mysql/go/models.go index f946f6c40a..598edf2ec6 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/mysql/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_delete/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type FooBar struct { ID uint64 } diff --git a/internal/endtoend/testdata/schema_scoped_delete/mysql/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_delete/mysql/go/query.sql.go index 34c98974b9..210e348762 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_delete/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_delete/mysql/query.sql b/internal/endtoend/testdata/schema_scoped_delete/mysql/query.sql index 90464ce29d..3ba74206d2 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/mysql/query.sql +++ b/internal/endtoend/testdata/schema_scoped_delete/mysql/query.sql @@ -1,5 +1,2 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null); - -- name: SchemaScopedDelete :exec DELETE FROM foo.bar WHERE id = ?; diff --git a/internal/endtoend/testdata/schema_scoped_delete/mysql/schema.sql b/internal/endtoend/testdata/schema_scoped_delete/mysql/schema.sql new file mode 100644 index 0000000000..a22ab0907d --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_delete/mysql/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null); + diff --git a/internal/endtoend/testdata/schema_scoped_delete/mysql/sqlc.json b/internal/endtoend/testdata/schema_scoped_delete/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/mysql/sqlc.json +++ b/internal/endtoend/testdata/schema_scoped_delete/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/models.go index 1d88ec458a..f90d97a6eb 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type FooBar struct { ID int32 } diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/query.sql.go index 00bc1b5ec4..ddee18e0e4 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/query.sql index 0587634827..e83763cfbc 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/query.sql @@ -1,5 +1,2 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null); - -- name: SchemaScopedDelete :exec DELETE FROM foo.bar WHERE id = $1; diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..a22ab0907d --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null); + diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/models.go index 1d88ec458a..f90d97a6eb 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type FooBar struct { ID int32 } diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/query.sql.go index 00bc1b5ec4..ddee18e0e4 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/query.sql index 0587634827..e83763cfbc 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/query.sql @@ -1,5 +1,2 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null); - -- name: SchemaScopedDelete :exec DELETE FROM foo.bar WHERE id = $1; diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..a22ab0907d --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null); + diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/models.go index 1d88ec458a..f90d97a6eb 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type FooBar struct { ID int32 } diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/query.sql.go index a8957e88ae..b3066b689b 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/query.sql b/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/query.sql index 0587634827..e83763cfbc 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/query.sql @@ -1,5 +1,2 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null); - -- name: SchemaScopedDelete :exec DELETE FROM foo.bar WHERE id = $1; diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..a22ab0907d --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null); + diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/db.go b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/models.go b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/models.go index c96d3b1ecf..1c13b04072 100644 --- a/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/query.sql.go index 821b2770e3..3f490bbcf0 100644 --- a/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/query.sql b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/query.sql index 88b0416d86..df3634b902 100644 --- a/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/query.sql +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/query.sql @@ -1,10 +1,2 @@ -CREATE SCHEMA foo; - -CREATE TYPE foo.type_user_role AS ENUM ('admin', 'user'); - -CREATE TABLE foo.users ( - role foo.type_user_role -); - -- name: ListUsersByRole :many SELECT * FROM foo.users WHERE role = $1; diff --git a/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/schema.sql b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/schema.sql new file mode 100644 index 0000000000..b04cda66ef --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/schema.sql @@ -0,0 +1,8 @@ +CREATE SCHEMA foo; + +CREATE TYPE foo.type_user_role AS ENUM ('admin', 'user'); + +CREATE TABLE foo.users ( + role foo.type_user_role +); + diff --git a/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/sqlc.json b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/db.go b/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/models.go b/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/models.go index c96d3b1ecf..1c13b04072 100644 --- a/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/query.sql.go index 821b2770e3..3f490bbcf0 100644 --- a/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/query.sql b/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/query.sql index 88b0416d86..df3634b902 100644 --- a/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/query.sql +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/query.sql @@ -1,10 +1,2 @@ -CREATE SCHEMA foo; - -CREATE TYPE foo.type_user_role AS ENUM ('admin', 'user'); - -CREATE TABLE foo.users ( - role foo.type_user_role -); - -- name: ListUsersByRole :many SELECT * FROM foo.users WHERE role = $1; diff --git a/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/schema.sql b/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/schema.sql new file mode 100644 index 0000000000..b04cda66ef --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/schema.sql @@ -0,0 +1,8 @@ +CREATE SCHEMA foo; + +CREATE TYPE foo.type_user_role AS ENUM ('admin', 'user'); + +CREATE TABLE foo.users ( + role foo.type_user_role +); + diff --git a/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/sqlc.json b/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/db.go b/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/models.go b/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/models.go index c96d3b1ecf..1c13b04072 100644 --- a/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/query.sql.go index bb85d1c959..b20ca177cd 100644 --- a/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_enum/stdlib/query.sql b/internal/endtoend/testdata/schema_scoped_enum/stdlib/query.sql index 88b0416d86..df3634b902 100644 --- a/internal/endtoend/testdata/schema_scoped_enum/stdlib/query.sql +++ b/internal/endtoend/testdata/schema_scoped_enum/stdlib/query.sql @@ -1,10 +1,2 @@ -CREATE SCHEMA foo; - -CREATE TYPE foo.type_user_role AS ENUM ('admin', 'user'); - -CREATE TABLE foo.users ( - role foo.type_user_role -); - -- name: ListUsersByRole :many SELECT * FROM foo.users WHERE role = $1; diff --git a/internal/endtoend/testdata/schema_scoped_enum/stdlib/schema.sql b/internal/endtoend/testdata/schema_scoped_enum/stdlib/schema.sql new file mode 100644 index 0000000000..b04cda66ef --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_enum/stdlib/schema.sql @@ -0,0 +1,8 @@ +CREATE SCHEMA foo; + +CREATE TYPE foo.type_user_role AS ENUM ('admin', 'user'); + +CREATE TABLE foo.users ( + role foo.type_user_role +); + diff --git a/internal/endtoend/testdata/schema_scoped_enum/stdlib/sqlc.json b/internal/endtoend/testdata/schema_scoped_enum/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/schema_scoped_enum/stdlib/sqlc.json +++ b/internal/endtoend/testdata/schema_scoped_enum/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/schema_scoped_filter/mysql/exec.json b/internal/endtoend/testdata/schema_scoped_filter/mysql/exec.json new file mode 100644 index 0000000000..c85ca2dfa7 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_filter/mysql/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["base"], + "meta": { + "invalid_schema": true + } +} diff --git a/internal/endtoend/testdata/schema_scoped_filter/mysql/go/db.go b/internal/endtoend/testdata/schema_scoped_filter/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/mysql/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_filter/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/schema_scoped_filter/mysql/go/models.go b/internal/endtoend/testdata/schema_scoped_filter/mysql/go/models.go index f946f6c40a..598edf2ec6 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/mysql/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_filter/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type FooBar struct { ID uint64 } diff --git a/internal/endtoend/testdata/schema_scoped_filter/mysql/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_filter/mysql/go/query.sql.go index f6ee467f9a..40c7da8c0c 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_filter/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_filter/mysql/query.sql b/internal/endtoend/testdata/schema_scoped_filter/mysql/query.sql index a55cfa5e35..11490897dd 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/mysql/query.sql +++ b/internal/endtoend/testdata/schema_scoped_filter/mysql/query.sql @@ -1,5 +1,2 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null); - -- name: SchemaScopedFilter :many SELECT * FROM foo.bar WHERE id = ?; diff --git a/internal/endtoend/testdata/schema_scoped_filter/mysql/schema.sql b/internal/endtoend/testdata/schema_scoped_filter/mysql/schema.sql new file mode 100644 index 0000000000..e5cb43f4bf --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_filter/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null); diff --git a/internal/endtoend/testdata/schema_scoped_filter/mysql/sqlc.json b/internal/endtoend/testdata/schema_scoped_filter/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/mysql/sqlc.json +++ b/internal/endtoend/testdata/schema_scoped_filter/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/models.go index 1d88ec458a..f90d97a6eb 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type FooBar struct { ID int32 } diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/query.sql.go index 61108e9ebe..304d36042d 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/query.sql index 4ea93990a7..11cba02f60 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/query.sql @@ -1,5 +1,2 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null); - -- name: SchemaScopedFilter :many SELECT * FROM foo.bar WHERE id = $1; diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..a22ab0907d --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null); + diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/models.go index 1d88ec458a..f90d97a6eb 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type FooBar struct { ID int32 } diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/query.sql.go index 61108e9ebe..304d36042d 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/query.sql index 4ea93990a7..11cba02f60 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/query.sql @@ -1,5 +1,2 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null); - -- name: SchemaScopedFilter :many SELECT * FROM foo.bar WHERE id = $1; diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..a22ab0907d --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null); + diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/models.go index 1d88ec458a..f90d97a6eb 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type FooBar struct { ID int32 } diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/query.sql.go index 28ec2e060b..3d11584e6e 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/query.sql b/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/query.sql index 4ea93990a7..11cba02f60 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/query.sql @@ -1,5 +1,2 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null); - -- name: SchemaScopedFilter :many SELECT * FROM foo.bar WHERE id = $1; diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..a22ab0907d --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null); + diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/schema_scoped_list/mysql/exec.json b/internal/endtoend/testdata/schema_scoped_list/mysql/exec.json new file mode 100644 index 0000000000..c85ca2dfa7 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_list/mysql/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["base"], + "meta": { + "invalid_schema": true + } +} diff --git a/internal/endtoend/testdata/schema_scoped_list/mysql/go/db.go b/internal/endtoend/testdata/schema_scoped_list/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/schema_scoped_list/mysql/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_list/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/schema_scoped_list/mysql/go/models.go b/internal/endtoend/testdata/schema_scoped_list/mysql/go/models.go index f946f6c40a..598edf2ec6 100644 --- a/internal/endtoend/testdata/schema_scoped_list/mysql/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_list/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type FooBar struct { ID uint64 } diff --git a/internal/endtoend/testdata/schema_scoped_list/mysql/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_list/mysql/go/query.sql.go index 34d83be407..6a26f8a6b4 100644 --- a/internal/endtoend/testdata/schema_scoped_list/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_list/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_list/mysql/query.sql b/internal/endtoend/testdata/schema_scoped_list/mysql/query.sql index 43b898c021..66dab6bfe7 100644 --- a/internal/endtoend/testdata/schema_scoped_list/mysql/query.sql +++ b/internal/endtoend/testdata/schema_scoped_list/mysql/query.sql @@ -1,6 +1,3 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null); - -- name: SchemaScopedList :many SELECT * FROM foo.bar; diff --git a/internal/endtoend/testdata/schema_scoped_list/mysql/schema.sql b/internal/endtoend/testdata/schema_scoped_list/mysql/schema.sql new file mode 100644 index 0000000000..a22ab0907d --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_list/mysql/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null); + diff --git a/internal/endtoend/testdata/schema_scoped_list/mysql/sqlc.json b/internal/endtoend/testdata/schema_scoped_list/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/schema_scoped_list/mysql/sqlc.json +++ b/internal/endtoend/testdata/schema_scoped_list/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/models.go index 1d88ec458a..f90d97a6eb 100644 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type FooBar struct { ID int32 } diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/query.sql.go index 821aedf6ec..333d990343 100644 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/query.sql index ef7b01859a..c508143f43 100644 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/query.sql @@ -1,6 +1,3 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null); - -- name: SchemaScopedList :many SELECT * FROM foo.bar; diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..a22ab0907d --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null); + diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/models.go index 1d88ec458a..f90d97a6eb 100644 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type FooBar struct { ID int32 } diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/query.sql.go index 821aedf6ec..333d990343 100644 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/query.sql index ef7b01859a..c508143f43 100644 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/query.sql @@ -1,6 +1,3 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null); - -- name: SchemaScopedList :many SELECT * FROM foo.bar; diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..a22ab0907d --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null); + diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/models.go index 1d88ec458a..f90d97a6eb 100644 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type FooBar struct { ID int32 } diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/query.sql.go index a2190c6000..33e8ff0096 100644 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/query.sql b/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/query.sql index ef7b01859a..c508143f43 100644 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/query.sql @@ -1,6 +1,3 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null); - -- name: SchemaScopedList :many SELECT * FROM foo.bar; diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..a22ab0907d --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null); + diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/schema_scoped_update/mysql/exec.json b/internal/endtoend/testdata/schema_scoped_update/mysql/exec.json new file mode 100644 index 0000000000..c85ca2dfa7 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_update/mysql/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["base"], + "meta": { + "invalid_schema": true + } +} diff --git a/internal/endtoend/testdata/schema_scoped_update/mysql/go/db.go b/internal/endtoend/testdata/schema_scoped_update/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/schema_scoped_update/mysql/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_update/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/schema_scoped_update/mysql/go/models.go b/internal/endtoend/testdata/schema_scoped_update/mysql/go/models.go index 29a1b21425..d9da85602e 100644 --- a/internal/endtoend/testdata/schema_scoped_update/mysql/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_update/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type FooBar struct { ID uint64 Name string diff --git a/internal/endtoend/testdata/schema_scoped_update/mysql/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_update/mysql/go/query.sql.go index 0c1bbdbc08..8e4d7546d5 100644 --- a/internal/endtoend/testdata/schema_scoped_update/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_update/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_update/mysql/query.sql b/internal/endtoend/testdata/schema_scoped_update/mysql/query.sql index 76d1eb953b..1c3c644037 100644 --- a/internal/endtoend/testdata/schema_scoped_update/mysql/query.sql +++ b/internal/endtoend/testdata/schema_scoped_update/mysql/query.sql @@ -1,5 +1,2 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null, name text not null); - -- name: SchemaScopedUpdate :exec UPDATE foo.bar SET name = ? WHERE id = ?; diff --git a/internal/endtoend/testdata/schema_scoped_update/mysql/schema.sql b/internal/endtoend/testdata/schema_scoped_update/mysql/schema.sql new file mode 100644 index 0000000000..71e23e5c0c --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_update/mysql/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null, name text not null); + diff --git a/internal/endtoend/testdata/schema_scoped_update/mysql/sqlc.json b/internal/endtoend/testdata/schema_scoped_update/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/schema_scoped_update/mysql/sqlc.json +++ b/internal/endtoend/testdata/schema_scoped_update/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/models.go index b526d99ab2..db32907a18 100644 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type FooBar struct { ID int32 Name string diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/query.sql.go index 9a34e18b62..54e213ac9f 100644 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/query.sql index 99d08246a4..3649c25eb4 100644 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/query.sql @@ -1,5 +1,2 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null, name text not null); - -- name: SchemaScopedUpdate :exec UPDATE foo.bar SET name = $2 WHERE id = $1; diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..71e23e5c0c --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null, name text not null); + diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/models.go index b526d99ab2..db32907a18 100644 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type FooBar struct { ID int32 Name string diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/query.sql.go index 9a34e18b62..54e213ac9f 100644 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/query.sql index 99d08246a4..3649c25eb4 100644 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/query.sql @@ -1,5 +1,2 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null, name text not null); - -- name: SchemaScopedUpdate :exec UPDATE foo.bar SET name = $2 WHERE id = $1; diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..71e23e5c0c --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null, name text not null); + diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/models.go index b526d99ab2..db32907a18 100644 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type FooBar struct { ID int32 Name string diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/query.sql.go index c36b94b98d..cfbc8429e9 100644 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/query.sql b/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/query.sql index 99d08246a4..3649c25eb4 100644 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/query.sql @@ -1,5 +1,2 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null, name text not null); - -- name: SchemaScopedUpdate :exec UPDATE foo.bar SET name = $2 WHERE id = $1; diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..71e23e5c0c --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE SCHEMA foo; +CREATE TABLE foo.bar (id serial not null, name text not null); + diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/schema_table_column_ref/issue.md b/internal/endtoend/testdata/schema_table_column_ref/issue.md new file mode 100644 index 0000000000..f58a7d02d1 --- /dev/null +++ b/internal/endtoend/testdata/schema_table_column_ref/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/2948 diff --git a/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/go/db.go b/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/go/models.go b/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..225430ef85 --- /dev/null +++ b/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/go/models.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type AstoriaSlackFeedback struct { + ID int64 + WorkspaceID int64 + CreatedAt pgtype.Timestamp + IssueRaised pgtype.Bool +} + +type AstoriaTicket struct { + ID int64 + WorkspaceID int64 + CreatedAt pgtype.Timestamp + Source string +} diff --git a/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..2b55ca7204 --- /dev/null +++ b/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/go/query.sql.go @@ -0,0 +1,77 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const getTotalSlackQueries = `-- name: GetTotalSlackQueries :one +SELECT + COUNT(*) AS count +FROM astoria.slack_feedback +WHERE astoria.slack_feedback.workspace_id = $1 +AND created_at BETWEEN $2::date AND $3::date +` + +type GetTotalSlackQueriesParams struct { + WorkspaceID int64 + Column2 pgtype.Date + Column3 pgtype.Date +} + +func (q *Queries) GetTotalSlackQueries(ctx context.Context, arg GetTotalSlackQueriesParams) (int64, error) { + row := q.db.QueryRow(ctx, getTotalSlackQueries, arg.WorkspaceID, arg.Column2, arg.Column3) + var count int64 + err := row.Scan(&count) + return count, err +} + +const getTotalSlackQueriesRequestsCreated = `-- name: GetTotalSlackQueriesRequestsCreated :one +SELECT + COUNT(*) AS count +FROM astoria.tickets +WHERE astoria.tickets.workspace_id = $1 + AND source = 'RAISED_FROM_BOT' + AND created_at BETWEEN $2::date AND $3::date +` + +type GetTotalSlackQueriesRequestsCreatedParams struct { + WorkspaceID int64 + Column2 pgtype.Date + Column3 pgtype.Date +} + +func (q *Queries) GetTotalSlackQueriesRequestsCreated(ctx context.Context, arg GetTotalSlackQueriesRequestsCreatedParams) (int64, error) { + row := q.db.QueryRow(ctx, getTotalSlackQueriesRequestsCreated, arg.WorkspaceID, arg.Column2, arg.Column3) + var count int64 + err := row.Scan(&count) + return count, err +} + +const getTotalSlackQueriesResolved = `-- name: GetTotalSlackQueriesResolved :one +SELECT + COUNT(*) AS count +FROM astoria.slack_feedback +WHERE astoria.slack_feedback.workspace_id = $1 + AND (issue_raised = false OR issue_raised IS NULL) + AND created_at BETWEEN $2::date AND $3::date +` + +type GetTotalSlackQueriesResolvedParams struct { + WorkspaceID int64 + Column2 pgtype.Date + Column3 pgtype.Date +} + +func (q *Queries) GetTotalSlackQueriesResolved(ctx context.Context, arg GetTotalSlackQueriesResolvedParams) (int64, error) { + row := q.db.QueryRow(ctx, getTotalSlackQueriesResolved, arg.WorkspaceID, arg.Column2, arg.Column3) + var count int64 + err := row.Scan(&count) + return count, err +} diff --git a/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/query.sql b/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/query.sql new file mode 100644 index 0000000000..3aa8ae1ca6 --- /dev/null +++ b/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/query.sql @@ -0,0 +1,22 @@ +-- name: GetTotalSlackQueries :one +SELECT + COUNT(*) AS count +FROM astoria.slack_feedback +WHERE astoria.slack_feedback.workspace_id = $1 +AND created_at BETWEEN $2::date AND $3::date; + +-- name: GetTotalSlackQueriesResolved :one +SELECT + COUNT(*) AS count +FROM astoria.slack_feedback +WHERE astoria.slack_feedback.workspace_id = $1 + AND (issue_raised = false OR issue_raised IS NULL) + AND created_at BETWEEN $2::date AND $3::date; + +-- name: GetTotalSlackQueriesRequestsCreated :one +SELECT + COUNT(*) AS count +FROM astoria.tickets +WHERE astoria.tickets.workspace_id = $1 + AND source = 'RAISED_FROM_BOT' + AND created_at BETWEEN $2::date AND $3::date; diff --git a/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/schema.sql b/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..48ccc12b84 --- /dev/null +++ b/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/schema.sql @@ -0,0 +1,15 @@ +CREATE SCHEMA astoria; + +CREATE TABLE astoria.slack_feedback ( + id BIGSERIAL PRIMARY KEY, + workspace_id BIGINT NOT NULL, + created_at TIMESTAMP NOT NULL, + issue_raised BOOLEAN +); + +CREATE TABLE astoria.tickets ( + id BIGSERIAL PRIMARY KEY, + workspace_id BIGINT NOT NULL, + created_at TIMESTAMP NOT NULL, + source text NOT NULL +); diff --git a/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/select_column_cast/mysql/go/db.go b/internal/endtoend/testdata/select_column_cast/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/select_column_cast/mysql/go/db.go +++ b/internal/endtoend/testdata/select_column_cast/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_column_cast/mysql/go/models.go b/internal/endtoend/testdata/select_column_cast/mysql/go/models.go index 7c0a88d72b..04bc70ad65 100644 --- a/internal/endtoend/testdata/select_column_cast/mysql/go/models.go +++ b/internal/endtoend/testdata/select_column_cast/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Bar bool } diff --git a/internal/endtoend/testdata/select_column_cast/mysql/go/query.sql.go b/internal/endtoend/testdata/select_column_cast/mysql/go/query.sql.go index f03b6cfb3d..bfe7263f56 100644 --- a/internal/endtoend/testdata/select_column_cast/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/select_column_cast/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_column_cast/mysql/query.sql b/internal/endtoend/testdata/select_column_cast/mysql/query.sql index 2173fd00f3..dc083f3590 100644 --- a/internal/endtoend/testdata/select_column_cast/mysql/query.sql +++ b/internal/endtoend/testdata/select_column_cast/mysql/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (bar BOOLEAN NOT NULL); - -- name: SelectColumnCast :many SELECT CAST(bar AS UNSIGNED) FROM foo; diff --git a/internal/endtoend/testdata/select_column_cast/mysql/schema.sql b/internal/endtoend/testdata/select_column_cast/mysql/schema.sql new file mode 100644 index 0000000000..51f66c6cfc --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar BOOLEAN NOT NULL); + diff --git a/internal/endtoend/testdata/select_column_cast/mysql/sqlc.json b/internal/endtoend/testdata/select_column_cast/mysql/sqlc.json index 534b7e24e9..0390f67889 100644 --- a/internal/endtoend/testdata/select_column_cast/mysql/sqlc.json +++ b/internal/endtoend/testdata/select_column_cast/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/models.go index 7c0a88d72b..04bc70ad65 100644 --- a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Bar bool } diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/query.sql.go index 40b5e175e0..0840542975 100644 --- a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/query.sql index 412fe6b77b..bbb1b9a863 100644 --- a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (bar bool not null); - -- name: SelectColumnCast :many SELECT bar::int FROM foo; diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..1d3eb6dc17 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar bool not null); + diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/models.go index 7c0a88d72b..04bc70ad65 100644 --- a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Bar bool } diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/query.sql.go index 40b5e175e0..0840542975 100644 --- a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/query.sql index 412fe6b77b..bbb1b9a863 100644 --- a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (bar bool not null); - -- name: SelectColumnCast :many SELECT bar::int FROM foo; diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..1d3eb6dc17 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar bool not null); + diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/models.go index 7c0a88d72b..04bc70ad65 100644 --- a/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Bar bool } diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/query.sql.go index 341e9af764..8e24d6bb96 100644 --- a/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/query.sql b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/query.sql index 412fe6b77b..bbb1b9a863 100644 --- a/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (bar bool not null); - -- name: SelectColumnCast :many SELECT bar::int FROM foo; diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..1d3eb6dc17 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar bool not null); + diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_column_cast/sqlite/go/db.go b/internal/endtoend/testdata/select_column_cast/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/select_column_cast/sqlite/go/db.go +++ b/internal/endtoend/testdata/select_column_cast/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_column_cast/sqlite/go/models.go b/internal/endtoend/testdata/select_column_cast/sqlite/go/models.go index 3f44f8fd63..0cd442222e 100644 --- a/internal/endtoend/testdata/select_column_cast/sqlite/go/models.go +++ b/internal/endtoend/testdata/select_column_cast/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Bar string } diff --git a/internal/endtoend/testdata/select_column_cast/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_column_cast/sqlite/go/query.sql.go index a633322d88..1ecd627432 100644 --- a/internal/endtoend/testdata/select_column_cast/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/select_column_cast/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_column_cast/sqlite/query.sql b/internal/endtoend/testdata/select_column_cast/sqlite/query.sql index 686f9ae72a..4775543757 100644 --- a/internal/endtoend/testdata/select_column_cast/sqlite/query.sql +++ b/internal/endtoend/testdata/select_column_cast/sqlite/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (bar TEXT NOT NULL); - -- name: SelectColumnCast :many SELECT CAST(bar AS BLOB) FROM foo; diff --git a/internal/endtoend/testdata/select_column_cast/sqlite/schema.sql b/internal/endtoend/testdata/select_column_cast/sqlite/schema.sql new file mode 100644 index 0000000000..883b4580b6 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar TEXT NOT NULL); + diff --git a/internal/endtoend/testdata/select_column_cast/sqlite/sqlc.json b/internal/endtoend/testdata/select_column_cast/sqlite/sqlc.json index e5c397f043..95b9cd09c0 100644 --- a/internal/endtoend/testdata/select_column_cast/sqlite/sqlc.json +++ b/internal/endtoend/testdata/select_column_cast/sqlite/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "sqlite", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_cte/sqlite/go/db.go b/internal/endtoend/testdata/select_cte/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/select_cte/sqlite/go/db.go +++ b/internal/endtoend/testdata/select_cte/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_cte/sqlite/go/models.go b/internal/endtoend/testdata/select_cte/sqlite/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/select_cte/sqlite/go/models.go +++ b/internal/endtoend/testdata/select_cte/sqlite/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/select_cte/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_cte/sqlite/go/query.sql.go index 70174998ac..672d639af9 100644 --- a/internal/endtoend/testdata/select_cte/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/select_cte/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_cte/sqlite/query.sql b/internal/endtoend/testdata/select_cte/sqlite/query.sql index 22b412b89a..2f538b84e6 100644 --- a/internal/endtoend/testdata/select_cte/sqlite/query.sql +++ b/internal/endtoend/testdata/select_cte/sqlite/query.sql @@ -1,4 +1,3 @@ - -- name: ListAuthors :many WITH abc AS ( SELECT 1 AS n diff --git a/internal/endtoend/testdata/select_cte/sqlite/schema.sql b/internal/endtoend/testdata/select_cte/sqlite/schema.sql new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/internal/endtoend/testdata/select_cte/sqlite/schema.sql @@ -0,0 +1 @@ + diff --git a/internal/endtoend/testdata/select_cte/sqlite/sqlc.json b/internal/endtoend/testdata/select_cte/sqlite/sqlc.json index 3ed5eea856..ea4a23425f 100644 --- a/internal/endtoend/testdata/select_cte/sqlite/sqlc.json +++ b/internal/endtoend/testdata/select_cte/sqlite/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "engine": "sqlite", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "name": "querytest" } diff --git a/internal/endtoend/testdata/select_distinct/pgx/v4/go/db.go b/internal/endtoend/testdata/select_distinct/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/select_distinct/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/select_distinct/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_distinct/pgx/v4/go/models.go b/internal/endtoend/testdata/select_distinct/pgx/v4/go/models.go index 2f89193ee6..91dd1c85fd 100644 --- a/internal/endtoend/testdata/select_distinct/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/select_distinct/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_distinct/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_distinct/pgx/v4/go/query.sql.go index 1537644756..6ff3d6e3e5 100644 --- a/internal/endtoend/testdata/select_distinct/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_distinct/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_distinct/pgx/v4/query.sql b/internal/endtoend/testdata/select_distinct/pgx/v4/query.sql index 4327cd32e4..8f8cafc523 100644 --- a/internal/endtoend/testdata/select_distinct/pgx/v4/query.sql +++ b/internal/endtoend/testdata/select_distinct/pgx/v4/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id serial not null, name text); - -- name: GetBars :many SELECT DISTINCT ON (a.id) a.* FROM bar a; diff --git a/internal/endtoend/testdata/select_distinct/pgx/v4/schema.sql b/internal/endtoend/testdata/select_distinct/pgx/v4/schema.sql new file mode 100644 index 0000000000..a4d38d3ff7 --- /dev/null +++ b/internal/endtoend/testdata/select_distinct/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null, name text); + diff --git a/internal/endtoend/testdata/select_distinct/pgx/v4/sqlc.json b/internal/endtoend/testdata/select_distinct/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/select_distinct/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/select_distinct/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_distinct/pgx/v5/go/db.go b/internal/endtoend/testdata/select_distinct/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/select_distinct/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/select_distinct/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_distinct/pgx/v5/go/models.go b/internal/endtoend/testdata/select_distinct/pgx/v5/go/models.go index 23120a905a..2e5e0b9352 100644 --- a/internal/endtoend/testdata/select_distinct/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/select_distinct/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_distinct/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_distinct/pgx/v5/go/query.sql.go index 1537644756..6ff3d6e3e5 100644 --- a/internal/endtoend/testdata/select_distinct/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_distinct/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_distinct/pgx/v5/query.sql b/internal/endtoend/testdata/select_distinct/pgx/v5/query.sql index 4327cd32e4..8f8cafc523 100644 --- a/internal/endtoend/testdata/select_distinct/pgx/v5/query.sql +++ b/internal/endtoend/testdata/select_distinct/pgx/v5/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id serial not null, name text); - -- name: GetBars :many SELECT DISTINCT ON (a.id) a.* FROM bar a; diff --git a/internal/endtoend/testdata/select_distinct/pgx/v5/schema.sql b/internal/endtoend/testdata/select_distinct/pgx/v5/schema.sql new file mode 100644 index 0000000000..a4d38d3ff7 --- /dev/null +++ b/internal/endtoend/testdata/select_distinct/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null, name text); + diff --git a/internal/endtoend/testdata/select_distinct/pgx/v5/sqlc.json b/internal/endtoend/testdata/select_distinct/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/select_distinct/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/select_distinct/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_distinct/stdlib/go/db.go b/internal/endtoend/testdata/select_distinct/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/select_distinct/stdlib/go/db.go +++ b/internal/endtoend/testdata/select_distinct/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_distinct/stdlib/go/models.go b/internal/endtoend/testdata/select_distinct/stdlib/go/models.go index 2f89193ee6..91dd1c85fd 100644 --- a/internal/endtoend/testdata/select_distinct/stdlib/go/models.go +++ b/internal/endtoend/testdata/select_distinct/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_distinct/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_distinct/stdlib/go/query.sql.go index 6f9999a1a1..c1d4f2ef06 100644 --- a/internal/endtoend/testdata/select_distinct/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_distinct/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_distinct/stdlib/query.sql b/internal/endtoend/testdata/select_distinct/stdlib/query.sql index 4327cd32e4..8f8cafc523 100644 --- a/internal/endtoend/testdata/select_distinct/stdlib/query.sql +++ b/internal/endtoend/testdata/select_distinct/stdlib/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id serial not null, name text); - -- name: GetBars :many SELECT DISTINCT ON (a.id) a.* FROM bar a; diff --git a/internal/endtoend/testdata/select_distinct/stdlib/schema.sql b/internal/endtoend/testdata/select_distinct/stdlib/schema.sql new file mode 100644 index 0000000000..a4d38d3ff7 --- /dev/null +++ b/internal/endtoend/testdata/select_distinct/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null, name text); + diff --git a/internal/endtoend/testdata/select_distinct/stdlib/sqlc.json b/internal/endtoend/testdata/select_distinct/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/select_distinct/stdlib/sqlc.json +++ b/internal/endtoend/testdata/select_distinct/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_empty_column_list/mysql/query.sql b/internal/endtoend/testdata/select_empty_column_list/mysql/query.sql index 81b6ff14a1..ae6cd0c9be 100644 --- a/internal/endtoend/testdata/select_empty_column_list/mysql/query.sql +++ b/internal/endtoend/testdata/select_empty_column_list/mysql/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE bar (name text); - -- name: GetBars :many -SELECT FROM bar; \ No newline at end of file +SELECT FROM bar; diff --git a/internal/endtoend/testdata/select_empty_column_list/mysql/schema.sql b/internal/endtoend/testdata/select_empty_column_list/mysql/schema.sql new file mode 100644 index 0000000000..fb18b4b3a8 --- /dev/null +++ b/internal/endtoend/testdata/select_empty_column_list/mysql/schema.sql @@ -0,0 +1 @@ +CREATE TABLE bar (name text); diff --git a/internal/endtoend/testdata/select_empty_column_list/mysql/sqlc.json b/internal/endtoend/testdata/select_empty_column_list/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/select_empty_column_list/mysql/sqlc.json +++ b/internal/endtoend/testdata/select_empty_column_list/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_empty_column_list/mysql/stderr.txt b/internal/endtoend/testdata/select_empty_column_list/mysql/stderr.txt index 11aeb304b0..2744126cd0 100644 --- a/internal/endtoend/testdata/select_empty_column_list/mysql/stderr.txt +++ b/internal/endtoend/testdata/select_empty_column_list/mysql/stderr.txt @@ -1,2 +1,2 @@ # package querytest -query.sql:4:12: syntax error near "FROM bar;" " +query.sql:2:12: syntax error near "FROM bar;" diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/models.go index 2f89193ee6..91dd1c85fd 100644 --- a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/query.sql.go index 2597118edf..c7ebc00934 100644 --- a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/query.sql index 6853741cba..d67332969c 100644 --- a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE bar (id serial not null, name text); - -- name: GetBars :many SELECT FROM bar LIMIT 5; \ No newline at end of file diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..a4d38d3ff7 --- /dev/null +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null, name text); + diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/models.go index 23120a905a..2e5e0b9352 100644 --- a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/query.sql.go index 2597118edf..c7ebc00934 100644 --- a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/query.sql index 6853741cba..d67332969c 100644 --- a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE bar (id serial not null, name text); - -- name: GetBars :many SELECT FROM bar LIMIT 5; \ No newline at end of file diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..a4d38d3ff7 --- /dev/null +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null, name text); + diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/models.go index 2f89193ee6..91dd1c85fd 100644 --- a/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/query.sql.go index 03ee2a73aa..288c4e4c11 100644 --- a/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/query.sql b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/query.sql index 6853741cba..d67332969c 100644 --- a/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE bar (id serial not null, name text); - -- name: GetBars :many SELECT FROM bar LIMIT 5; \ No newline at end of file diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..a4d38d3ff7 --- /dev/null +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null, name text); + diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_exists/pgx/v4/go/db.go b/internal/endtoend/testdata/select_exists/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/select_exists/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/select_exists/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_exists/pgx/v4/go/models.go b/internal/endtoend/testdata/select_exists/pgx/v4/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/select_exists/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/select_exists/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/select_exists/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_exists/pgx/v4/go/query.sql.go index 0c3311fe16..f7903b1f2b 100644 --- a/internal/endtoend/testdata/select_exists/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_exists/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_exists/pgx/v4/query.sql b/internal/endtoend/testdata/select_exists/pgx/v4/query.sql index aae94835e1..635b4682c2 100644 --- a/internal/endtoend/testdata/select_exists/pgx/v4/query.sql +++ b/internal/endtoend/testdata/select_exists/pgx/v4/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id serial not null); - -- name: BarExists :one SELECT EXISTS ( diff --git a/internal/endtoend/testdata/select_exists/pgx/v4/schema.sql b/internal/endtoend/testdata/select_exists/pgx/v4/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/select_exists/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/select_exists/pgx/v4/sqlc.json b/internal/endtoend/testdata/select_exists/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/select_exists/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/select_exists/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_exists/pgx/v5/go/db.go b/internal/endtoend/testdata/select_exists/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/select_exists/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/select_exists/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_exists/pgx/v5/go/models.go b/internal/endtoend/testdata/select_exists/pgx/v5/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/select_exists/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/select_exists/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/select_exists/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_exists/pgx/v5/go/query.sql.go index 0c3311fe16..f7903b1f2b 100644 --- a/internal/endtoend/testdata/select_exists/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_exists/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_exists/pgx/v5/query.sql b/internal/endtoend/testdata/select_exists/pgx/v5/query.sql index aae94835e1..635b4682c2 100644 --- a/internal/endtoend/testdata/select_exists/pgx/v5/query.sql +++ b/internal/endtoend/testdata/select_exists/pgx/v5/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id serial not null); - -- name: BarExists :one SELECT EXISTS ( diff --git a/internal/endtoend/testdata/select_exists/pgx/v5/schema.sql b/internal/endtoend/testdata/select_exists/pgx/v5/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/select_exists/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/select_exists/pgx/v5/sqlc.json b/internal/endtoend/testdata/select_exists/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/select_exists/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/select_exists/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_exists/sqlite/go/db.go b/internal/endtoend/testdata/select_exists/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/select_exists/sqlite/go/db.go +++ b/internal/endtoend/testdata/select_exists/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_exists/sqlite/go/models.go b/internal/endtoend/testdata/select_exists/sqlite/go/models.go index 214487814e..1344b5dab9 100644 --- a/internal/endtoend/testdata/select_exists/sqlite/go/models.go +++ b/internal/endtoend/testdata/select_exists/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int64 } diff --git a/internal/endtoend/testdata/select_exists/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_exists/sqlite/go/query.sql.go index 4c76a9ddeb..e22e5b6f33 100644 --- a/internal/endtoend/testdata/select_exists/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/select_exists/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_exists/sqlite/query.sql b/internal/endtoend/testdata/select_exists/sqlite/query.sql index f0ad7f354f..5173a4418f 100644 --- a/internal/endtoend/testdata/select_exists/sqlite/query.sql +++ b/internal/endtoend/testdata/select_exists/sqlite/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id int not null primary key autoincrement); - -- name: BarExists :one SELECT EXISTS ( diff --git a/internal/endtoend/testdata/select_exists/sqlite/schema.sql b/internal/endtoend/testdata/select_exists/sqlite/schema.sql new file mode 100644 index 0000000000..52799a37db --- /dev/null +++ b/internal/endtoend/testdata/select_exists/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id int not null primary key autoincrement); + diff --git a/internal/endtoend/testdata/select_exists/sqlite/sqlc.json b/internal/endtoend/testdata/select_exists/sqlite/sqlc.json index 9a3cd68bda..9655954bd4 100644 --- a/internal/endtoend/testdata/select_exists/sqlite/sqlc.json +++ b/internal/endtoend/testdata/select_exists/sqlite/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "name": "querytest", "engine": "sqlite", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_exists/stdlib/go/db.go b/internal/endtoend/testdata/select_exists/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/select_exists/stdlib/go/db.go +++ b/internal/endtoend/testdata/select_exists/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_exists/stdlib/go/models.go b/internal/endtoend/testdata/select_exists/stdlib/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/select_exists/stdlib/go/models.go +++ b/internal/endtoend/testdata/select_exists/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/select_exists/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_exists/stdlib/go/query.sql.go index 6de4f44ef1..fa42d32f60 100644 --- a/internal/endtoend/testdata/select_exists/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_exists/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_exists/stdlib/query.sql b/internal/endtoend/testdata/select_exists/stdlib/query.sql index aae94835e1..635b4682c2 100644 --- a/internal/endtoend/testdata/select_exists/stdlib/query.sql +++ b/internal/endtoend/testdata/select_exists/stdlib/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id serial not null); - -- name: BarExists :one SELECT EXISTS ( diff --git a/internal/endtoend/testdata/select_exists/stdlib/schema.sql b/internal/endtoend/testdata/select_exists/stdlib/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/select_exists/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/select_exists/stdlib/sqlc.json b/internal/endtoend/testdata/select_exists/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/select_exists/stdlib/sqlc.json +++ b/internal/endtoend/testdata/select_exists/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_in_and/sqlite/go/db.go b/internal/endtoend/testdata/select_in_and/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/select_in_and/sqlite/go/db.go +++ b/internal/endtoend/testdata/select_in_and/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_in_and/sqlite/go/models.go b/internal/endtoend/testdata/select_in_and/sqlite/go/models.go index 62e6f470e2..eabb4ea4eb 100644 --- a/internal/endtoend/testdata/select_in_and/sqlite/go/models.go +++ b/internal/endtoend/testdata/select_in_and/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_in_and/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_in_and/sqlite/go/query.sql.go index ee2dc8c821..4a8ebb36b6 100644 --- a/internal/endtoend/testdata/select_in_and/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/select_in_and/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_in_and/sqlite/query.sql b/internal/endtoend/testdata/select_in_and/sqlite/query.sql index 3b7366eedb..4bad135e3d 100644 --- a/internal/endtoend/testdata/select_in_and/sqlite/query.sql +++ b/internal/endtoend/testdata/select_in_and/sqlite/query.sql @@ -1,23 +1,3 @@ --- Example queries for sqlc -CREATE TABLE authors ( - id integer PRIMARY KEY, - name text NOT NULL, - age integer -); - -CREATE TABLE translators ( - id integer PRIMARY KEY, - name text NOT NULL, - age integer -); - -CREATE TABLE books ( - id integer PRIMARY KEY, - author text NOT NULL, - translator text NOT NULL, - year integer -); - -- name: DeleteAuthor :exec DELETE FROM books AS b diff --git a/internal/endtoend/testdata/select_in_and/sqlite/schema.sql b/internal/endtoend/testdata/select_in_and/sqlite/schema.sql new file mode 100644 index 0000000000..76505b14c3 --- /dev/null +++ b/internal/endtoend/testdata/select_in_and/sqlite/schema.sql @@ -0,0 +1,20 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id integer PRIMARY KEY, + name text NOT NULL, + age integer +); + +CREATE TABLE translators ( + id integer PRIMARY KEY, + name text NOT NULL, + age integer +); + +CREATE TABLE books ( + id integer PRIMARY KEY, + author text NOT NULL, + translator text NOT NULL, + year integer +); + diff --git a/internal/endtoend/testdata/select_in_and/sqlite/sqlc.json b/internal/endtoend/testdata/select_in_and/sqlite/sqlc.json index fd6d575377..99b3b5f074 100644 --- a/internal/endtoend/testdata/select_in_and/sqlite/sqlc.json +++ b/internal/endtoend/testdata/select_in_and/sqlite/sqlc.json @@ -1 +1 @@ -{"version": "1", "packages": [{"path": "go", "engine": "sqlite", "schema": "query.sql", "queries": "query.sql", "name": "querytest"}]} \ No newline at end of file +{"version": "1", "packages": [{"path": "go", "engine": "sqlite", "schema": "schema.sql", "queries": "query.sql", "name": "querytest"}]} \ No newline at end of file diff --git a/internal/endtoend/testdata/select_limit/mysql/go/db.go b/internal/endtoend/testdata/select_limit/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/select_limit/mysql/go/db.go +++ b/internal/endtoend/testdata/select_limit/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_limit/mysql/go/models.go b/internal/endtoend/testdata/select_limit/mysql/go/models.go index 3c885fdb45..ef22c3818c 100644 --- a/internal/endtoend/testdata/select_limit/mysql/go/models.go +++ b/internal/endtoend/testdata/select_limit/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_limit/mysql/go/query.sql.go b/internal/endtoend/testdata/select_limit/mysql/go/query.sql.go index 7abc25ba18..2b61d10df1 100644 --- a/internal/endtoend/testdata/select_limit/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/select_limit/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_limit/mysql/query.sql b/internal/endtoend/testdata/select_limit/mysql/query.sql index 4b5e81997f..1fea17c583 100644 --- a/internal/endtoend/testdata/select_limit/mysql/query.sql +++ b/internal/endtoend/testdata/select_limit/mysql/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (a text); - /* name: FooLimit :many */ SELECT a FROM foo LIMIT ?; diff --git a/internal/endtoend/testdata/select_limit/mysql/schema.sql b/internal/endtoend/testdata/select_limit/mysql/schema.sql new file mode 100644 index 0000000000..f30f6c2047 --- /dev/null +++ b/internal/endtoend/testdata/select_limit/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text); + diff --git a/internal/endtoend/testdata/select_limit/mysql/sqlc.json b/internal/endtoend/testdata/select_limit/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/select_limit/mysql/sqlc.json +++ b/internal/endtoend/testdata/select_limit/mysql/sqlc.json @@ -5,7 +5,7 @@ "engine": "mysql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/exec.json b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/models.go index 3c885fdb45..ef22c3818c 100644 --- a/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/query.sql.go index adfb76413e..056d67dbce 100644 --- a/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/query.sql index 2068bc407a..11907d0636 100644 --- a/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (a text); - -- name: FooLimit :many SELECT a FROM foo LIMIT $1; diff --git a/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..f30f6c2047 --- /dev/null +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text); + diff --git a/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/exec.json b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/models.go index cfa2cb9981..670033a63c 100644 --- a/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/query.sql.go index 526fd3cab5..d499f076e4 100644 --- a/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/query.sql index 2068bc407a..11907d0636 100644 --- a/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (a text); - -- name: FooLimit :many SELECT a FROM foo LIMIT $1; diff --git a/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..f30f6c2047 --- /dev/null +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text); + diff --git a/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_limit/postgresql/stdlib/exec.json b/internal/endtoend/testdata/select_limit/postgresql/stdlib/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/select_limit/postgresql/stdlib/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/models.go index 3c885fdb45..ef22c3818c 100644 --- a/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/query.sql.go index f5e821788d..0ddc5a11e1 100644 --- a/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_limit/postgresql/stdlib/query.sql b/internal/endtoend/testdata/select_limit/postgresql/stdlib/query.sql index 2068bc407a..11907d0636 100644 --- a/internal/endtoend/testdata/select_limit/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/select_limit/postgresql/stdlib/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (a text); - -- name: FooLimit :many SELECT a FROM foo LIMIT $1; diff --git a/internal/endtoend/testdata/select_limit/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/select_limit/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..f30f6c2047 --- /dev/null +++ b/internal/endtoend/testdata/select_limit/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text); + diff --git a/internal/endtoend/testdata/select_limit/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/select_limit/postgresql/stdlib/sqlc.json index de427d069f..cd518671ac 100644 --- a/internal/endtoend/testdata/select_limit/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/select_limit/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "engine": "postgresql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_limit/sqlite/go/db.go b/internal/endtoend/testdata/select_limit/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/select_limit/sqlite/go/db.go +++ b/internal/endtoend/testdata/select_limit/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_limit/sqlite/go/models.go b/internal/endtoend/testdata/select_limit/sqlite/go/models.go index 3c885fdb45..ef22c3818c 100644 --- a/internal/endtoend/testdata/select_limit/sqlite/go/models.go +++ b/internal/endtoend/testdata/select_limit/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_limit/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_limit/sqlite/go/query.sql.go index d6abf8c118..c4064b2c6e 100644 --- a/internal/endtoend/testdata/select_limit/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/select_limit/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_limit/sqlite/query.sql b/internal/endtoend/testdata/select_limit/sqlite/query.sql index 4b5e81997f..1fea17c583 100644 --- a/internal/endtoend/testdata/select_limit/sqlite/query.sql +++ b/internal/endtoend/testdata/select_limit/sqlite/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (a text); - /* name: FooLimit :many */ SELECT a FROM foo LIMIT ?; diff --git a/internal/endtoend/testdata/select_limit/sqlite/schema.sql b/internal/endtoend/testdata/select_limit/sqlite/schema.sql new file mode 100644 index 0000000000..f30f6c2047 --- /dev/null +++ b/internal/endtoend/testdata/select_limit/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text); + diff --git a/internal/endtoend/testdata/select_limit/sqlite/sqlc.json b/internal/endtoend/testdata/select_limit/sqlite/sqlc.json index 13e65f3ffd..f8e8051087 100644 --- a/internal/endtoend/testdata/select_limit/sqlite/sqlc.json +++ b/internal/endtoend/testdata/select_limit/sqlite/sqlc.json @@ -5,7 +5,7 @@ "engine": "sqlite", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_nested_count/mysql/go/db.go b/internal/endtoend/testdata/select_nested_count/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/select_nested_count/mysql/go/db.go +++ b/internal/endtoend/testdata/select_nested_count/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_nested_count/mysql/go/models.go b/internal/endtoend/testdata/select_nested_count/mysql/go/models.go index b2ed67ddf1..ff7cddbbb4 100644 --- a/internal/endtoend/testdata/select_nested_count/mysql/go/models.go +++ b/internal/endtoend/testdata/select_nested_count/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_nested_count/mysql/go/query.sql.go b/internal/endtoend/testdata/select_nested_count/mysql/go/query.sql.go index 9106a58c74..613933c70c 100644 --- a/internal/endtoend/testdata/select_nested_count/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/select_nested_count/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_nested_count/mysql/query.sql b/internal/endtoend/testdata/select_nested_count/mysql/query.sql index fb9d37dfa1..3fe51959c3 100644 --- a/internal/endtoend/testdata/select_nested_count/mysql/query.sql +++ b/internal/endtoend/testdata/select_nested_count/mysql/query.sql @@ -1,16 +1,3 @@ -CREATE TABLE authors ( - id bigint PRIMARY KEY, - name text NOT NULL, - bio text -); - -CREATE TABLE books ( - id bigint PRIMARY KEY, - author_id bigint NOT NULL - REFERENCES authors(id), - title text NOT NULL -); - -- name: GetAuthorsWithBooksCount :many SELECT *, ( SELECT COUNT(id) FROM books diff --git a/internal/endtoend/testdata/select_nested_count/mysql/schema.sql b/internal/endtoend/testdata/select_nested_count/mysql/schema.sql new file mode 100644 index 0000000000..dffe2e984b --- /dev/null +++ b/internal/endtoend/testdata/select_nested_count/mysql/schema.sql @@ -0,0 +1,13 @@ +CREATE TABLE authors ( + id bigint PRIMARY KEY, + name text NOT NULL, + bio text +); + +CREATE TABLE books ( + id bigint PRIMARY KEY, + author_id bigint NOT NULL + REFERENCES authors(id), + title text NOT NULL +); + diff --git a/internal/endtoend/testdata/select_nested_count/mysql/sqlc.json b/internal/endtoend/testdata/select_nested_count/mysql/sqlc.json index cb8f8d5ee6..d3ae3f44ec 100644 --- a/internal/endtoend/testdata/select_nested_count/mysql/sqlc.json +++ b/internal/endtoend/testdata/select_nested_count/mysql/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "engine": "mysql" } diff --git a/internal/endtoend/testdata/select_nested_count/postgresql/go/db.go b/internal/endtoend/testdata/select_nested_count/postgresql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/select_nested_count/postgresql/go/db.go +++ b/internal/endtoend/testdata/select_nested_count/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_nested_count/postgresql/go/models.go b/internal/endtoend/testdata/select_nested_count/postgresql/go/models.go index b2ed67ddf1..ff7cddbbb4 100644 --- a/internal/endtoend/testdata/select_nested_count/postgresql/go/models.go +++ b/internal/endtoend/testdata/select_nested_count/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_nested_count/postgresql/go/query.sql.go b/internal/endtoend/testdata/select_nested_count/postgresql/go/query.sql.go index 9106a58c74..613933c70c 100644 --- a/internal/endtoend/testdata/select_nested_count/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/select_nested_count/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_nested_count/postgresql/query.sql b/internal/endtoend/testdata/select_nested_count/postgresql/query.sql index 11079ed4f5..3fe51959c3 100644 --- a/internal/endtoend/testdata/select_nested_count/postgresql/query.sql +++ b/internal/endtoend/testdata/select_nested_count/postgresql/query.sql @@ -1,16 +1,3 @@ -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - name text NOT NULL, - bio text -); - -CREATE TABLE books ( - id BIGSERIAL PRIMARY KEY, - author_id BIGSERIAL NOT NULL - REFERENCES authors(id), - title text NOT NULL -); - -- name: GetAuthorsWithBooksCount :many SELECT *, ( SELECT COUNT(id) FROM books diff --git a/internal/endtoend/testdata/select_nested_count/postgresql/schema.sql b/internal/endtoend/testdata/select_nested_count/postgresql/schema.sql new file mode 100644 index 0000000000..85e8fd5572 --- /dev/null +++ b/internal/endtoend/testdata/select_nested_count/postgresql/schema.sql @@ -0,0 +1,13 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + +CREATE TABLE books ( + id BIGSERIAL PRIMARY KEY, + author_id BIGSERIAL NOT NULL + REFERENCES authors(id), + title text NOT NULL +); + diff --git a/internal/endtoend/testdata/select_nested_count/postgresql/sqlc.json b/internal/endtoend/testdata/select_nested_count/postgresql/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/select_nested_count/postgresql/sqlc.json +++ b/internal/endtoend/testdata/select_nested_count/postgresql/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_nested_count/sqlite/go/db.go b/internal/endtoend/testdata/select_nested_count/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/select_nested_count/sqlite/go/db.go +++ b/internal/endtoend/testdata/select_nested_count/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_nested_count/sqlite/go/models.go b/internal/endtoend/testdata/select_nested_count/sqlite/go/models.go index b2ed67ddf1..ff7cddbbb4 100644 --- a/internal/endtoend/testdata/select_nested_count/sqlite/go/models.go +++ b/internal/endtoend/testdata/select_nested_count/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_nested_count/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_nested_count/sqlite/go/query.sql.go index 9106a58c74..613933c70c 100644 --- a/internal/endtoend/testdata/select_nested_count/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/select_nested_count/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_nested_count/sqlite/query.sql b/internal/endtoend/testdata/select_nested_count/sqlite/query.sql index fb9d37dfa1..3fe51959c3 100644 --- a/internal/endtoend/testdata/select_nested_count/sqlite/query.sql +++ b/internal/endtoend/testdata/select_nested_count/sqlite/query.sql @@ -1,16 +1,3 @@ -CREATE TABLE authors ( - id bigint PRIMARY KEY, - name text NOT NULL, - bio text -); - -CREATE TABLE books ( - id bigint PRIMARY KEY, - author_id bigint NOT NULL - REFERENCES authors(id), - title text NOT NULL -); - -- name: GetAuthorsWithBooksCount :many SELECT *, ( SELECT COUNT(id) FROM books diff --git a/internal/endtoend/testdata/select_nested_count/sqlite/schema.sql b/internal/endtoend/testdata/select_nested_count/sqlite/schema.sql new file mode 100644 index 0000000000..dffe2e984b --- /dev/null +++ b/internal/endtoend/testdata/select_nested_count/sqlite/schema.sql @@ -0,0 +1,13 @@ +CREATE TABLE authors ( + id bigint PRIMARY KEY, + name text NOT NULL, + bio text +); + +CREATE TABLE books ( + id bigint PRIMARY KEY, + author_id bigint NOT NULL + REFERENCES authors(id), + title text NOT NULL +); + diff --git a/internal/endtoend/testdata/select_nested_count/sqlite/sqlc.json b/internal/endtoend/testdata/select_nested_count/sqlite/sqlc.json index d23745bcdf..53eda65f7c 100644 --- a/internal/endtoend/testdata/select_nested_count/sqlite/sqlc.json +++ b/internal/endtoend/testdata/select_nested_count/sqlite/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "engine": "sqlite" } diff --git a/internal/endtoend/testdata/select_not_exists/pgx/v4/go/db.go b/internal/endtoend/testdata/select_not_exists/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/select_not_exists/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/select_not_exists/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_not_exists/pgx/v4/go/models.go b/internal/endtoend/testdata/select_not_exists/pgx/v4/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/select_not_exists/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/select_not_exists/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/select_not_exists/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_not_exists/pgx/v4/go/query.sql.go index 4118d4f236..f9e0b3050d 100644 --- a/internal/endtoend/testdata/select_not_exists/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_not_exists/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_not_exists/pgx/v4/query.sql b/internal/endtoend/testdata/select_not_exists/pgx/v4/query.sql index e389b835bb..f32ee625be 100644 --- a/internal/endtoend/testdata/select_not_exists/pgx/v4/query.sql +++ b/internal/endtoend/testdata/select_not_exists/pgx/v4/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id serial not null); - -- name: BarNotExists :one SELECT NOT EXISTS ( diff --git a/internal/endtoend/testdata/select_not_exists/pgx/v4/schema.sql b/internal/endtoend/testdata/select_not_exists/pgx/v4/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/select_not_exists/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/select_not_exists/pgx/v4/sqlc.json b/internal/endtoend/testdata/select_not_exists/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/select_not_exists/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/select_not_exists/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_not_exists/pgx/v5/go/db.go b/internal/endtoend/testdata/select_not_exists/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/select_not_exists/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/select_not_exists/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_not_exists/pgx/v5/go/models.go b/internal/endtoend/testdata/select_not_exists/pgx/v5/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/select_not_exists/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/select_not_exists/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/select_not_exists/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_not_exists/pgx/v5/go/query.sql.go index 4118d4f236..f9e0b3050d 100644 --- a/internal/endtoend/testdata/select_not_exists/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_not_exists/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_not_exists/pgx/v5/query.sql b/internal/endtoend/testdata/select_not_exists/pgx/v5/query.sql index e389b835bb..f32ee625be 100644 --- a/internal/endtoend/testdata/select_not_exists/pgx/v5/query.sql +++ b/internal/endtoend/testdata/select_not_exists/pgx/v5/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id serial not null); - -- name: BarNotExists :one SELECT NOT EXISTS ( diff --git a/internal/endtoend/testdata/select_not_exists/pgx/v5/schema.sql b/internal/endtoend/testdata/select_not_exists/pgx/v5/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/select_not_exists/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/select_not_exists/pgx/v5/sqlc.json b/internal/endtoend/testdata/select_not_exists/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/select_not_exists/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/select_not_exists/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_not_exists/sqlite/go/db.go b/internal/endtoend/testdata/select_not_exists/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/select_not_exists/sqlite/go/db.go +++ b/internal/endtoend/testdata/select_not_exists/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_not_exists/sqlite/go/models.go b/internal/endtoend/testdata/select_not_exists/sqlite/go/models.go index 214487814e..1344b5dab9 100644 --- a/internal/endtoend/testdata/select_not_exists/sqlite/go/models.go +++ b/internal/endtoend/testdata/select_not_exists/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int64 } diff --git a/internal/endtoend/testdata/select_not_exists/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_not_exists/sqlite/go/query.sql.go index 1a4696ad18..ee1b8e548b 100644 --- a/internal/endtoend/testdata/select_not_exists/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/select_not_exists/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_not_exists/sqlite/query.sql b/internal/endtoend/testdata/select_not_exists/sqlite/query.sql index 473b8461e4..d868c64a0b 100644 --- a/internal/endtoend/testdata/select_not_exists/sqlite/query.sql +++ b/internal/endtoend/testdata/select_not_exists/sqlite/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id integer not null primary key autoincrement); - -- name: BarNotExists :one SELECT NOT EXISTS ( diff --git a/internal/endtoend/testdata/select_not_exists/sqlite/schema.sql b/internal/endtoend/testdata/select_not_exists/sqlite/schema.sql new file mode 100644 index 0000000000..6cc3882f5a --- /dev/null +++ b/internal/endtoend/testdata/select_not_exists/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id integer not null primary key autoincrement); + diff --git a/internal/endtoend/testdata/select_not_exists/sqlite/sqlc.json b/internal/endtoend/testdata/select_not_exists/sqlite/sqlc.json index 9a3cd68bda..9655954bd4 100644 --- a/internal/endtoend/testdata/select_not_exists/sqlite/sqlc.json +++ b/internal/endtoend/testdata/select_not_exists/sqlite/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "name": "querytest", "engine": "sqlite", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_not_exists/stdlib/go/db.go b/internal/endtoend/testdata/select_not_exists/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/select_not_exists/stdlib/go/db.go +++ b/internal/endtoend/testdata/select_not_exists/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_not_exists/stdlib/go/models.go b/internal/endtoend/testdata/select_not_exists/stdlib/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/select_not_exists/stdlib/go/models.go +++ b/internal/endtoend/testdata/select_not_exists/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/select_not_exists/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_not_exists/stdlib/go/query.sql.go index f9ee608f4b..c1d20849df 100644 --- a/internal/endtoend/testdata/select_not_exists/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_not_exists/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_not_exists/stdlib/query.sql b/internal/endtoend/testdata/select_not_exists/stdlib/query.sql index e389b835bb..f32ee625be 100644 --- a/internal/endtoend/testdata/select_not_exists/stdlib/query.sql +++ b/internal/endtoend/testdata/select_not_exists/stdlib/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE bar (id serial not null); - -- name: BarNotExists :one SELECT NOT EXISTS ( diff --git a/internal/endtoend/testdata/select_not_exists/stdlib/schema.sql b/internal/endtoend/testdata/select_not_exists/stdlib/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/select_not_exists/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/select_not_exists/stdlib/sqlc.json b/internal/endtoend/testdata/select_not_exists/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/select_not_exists/stdlib/sqlc.json +++ b/internal/endtoend/testdata/select_not_exists/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_sequence/issue.md b/internal/endtoend/testdata/select_sequence/issue.md new file mode 100644 index 0000000000..38c550fe19 --- /dev/null +++ b/internal/endtoend/testdata/select_sequence/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1634 diff --git a/internal/endtoend/testdata/select_sequence/postgresql/pgx/exec.json b/internal/endtoend/testdata/select_sequence/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/select_sequence/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/select_sequence/postgresql/pgx/go/db.go b/internal/endtoend/testdata/select_sequence/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/select_sequence/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/select_sequence/postgresql/pgx/go/models.go b/internal/endtoend/testdata/select_sequence/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..333ea43ea3 --- /dev/null +++ b/internal/endtoend/testdata/select_sequence/postgresql/pgx/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest diff --git a/internal/endtoend/testdata/select_sequence/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/select_sequence/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..02e74b6afb --- /dev/null +++ b/internal/endtoend/testdata/select_sequence/postgresql/pgx/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getLastValue = `-- name: GetLastValue :one +SELECT last_value FROM my_sequence +` + +func (q *Queries) GetLastValue(ctx context.Context) (int64, error) { + row := q.db.QueryRow(ctx, getLastValue) + var last_value int64 + err := row.Scan(&last_value) + return last_value, err +} diff --git a/internal/endtoend/testdata/select_sequence/postgresql/pgx/query.sql b/internal/endtoend/testdata/select_sequence/postgresql/pgx/query.sql new file mode 100644 index 0000000000..82cc9b0a5c --- /dev/null +++ b/internal/endtoend/testdata/select_sequence/postgresql/pgx/query.sql @@ -0,0 +1,2 @@ +-- name: GetLastValue :one +SELECT last_value FROM my_sequence; diff --git a/internal/endtoend/testdata/select_sequence/postgresql/pgx/schema.sql b/internal/endtoend/testdata/select_sequence/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..94a6932f80 --- /dev/null +++ b/internal/endtoend/testdata/select_sequence/postgresql/pgx/schema.sql @@ -0,0 +1,6 @@ +CREATE SEQUENCE public.my_sequence + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; diff --git a/internal/endtoend/testdata/select_sequence/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/select_sequence/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/select_sequence/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/select_star/mysql/go/db.go b/internal/endtoend/testdata/select_star/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/select_star/mysql/go/db.go +++ b/internal/endtoend/testdata/select_star/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_star/mysql/go/models.go b/internal/endtoend/testdata/select_star/mysql/go/models.go index 41d5cb689a..f5668bd976 100644 --- a/internal/endtoend/testdata/select_star/mysql/go/models.go +++ b/internal/endtoend/testdata/select_star/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_star/mysql/go/query.sql.go b/internal/endtoend/testdata/select_star/mysql/go/query.sql.go index ea14d720b0..dd10b59022 100644 --- a/internal/endtoend/testdata/select_star/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/select_star/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/models.go index 41d5cb689a..f5668bd976 100644 --- a/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/query.sql.go index 5e607a95c3..3259c4c82c 100644 --- a/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/models.go index 98a6c710c0..f68e9f60b9 100644 --- a/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/query.sql.go index 5e607a95c3..3259c4c82c 100644 --- a/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_star/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/select_star/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/select_star/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/select_star/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_star/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/select_star/postgresql/stdlib/go/models.go index 41d5cb689a..f5668bd976 100644 --- a/internal/endtoend/testdata/select_star/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/select_star/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_star/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_star/postgresql/stdlib/go/query.sql.go index ea14d720b0..dd10b59022 100644 --- a/internal/endtoend/testdata/select_star/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_star/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_star/sqlite/go/db.go b/internal/endtoend/testdata/select_star/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/select_star/sqlite/go/db.go +++ b/internal/endtoend/testdata/select_star/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_star/sqlite/go/models.go b/internal/endtoend/testdata/select_star/sqlite/go/models.go index 8bc479df7d..dfbb4f7e0b 100644 --- a/internal/endtoend/testdata/select_star/sqlite/go/models.go +++ b/internal/endtoend/testdata/select_star/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_star/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_star/sqlite/go/query.sql.go index c8359cebcb..2c899f8fa9 100644 --- a/internal/endtoend/testdata/select_star/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/select_star/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_star_quoted/mysql/go/db.go b/internal/endtoend/testdata/select_star_quoted/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/select_star_quoted/mysql/go/db.go +++ b/internal/endtoend/testdata/select_star_quoted/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_star_quoted/mysql/go/models.go b/internal/endtoend/testdata/select_star_quoted/mysql/go/models.go index 3b956750fa..653314bea2 100644 --- a/internal/endtoend/testdata/select_star_quoted/mysql/go/models.go +++ b/internal/endtoend/testdata/select_star_quoted/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_star_quoted/mysql/go/query.sql.go b/internal/endtoend/testdata/select_star_quoted/mysql/go/query.sql.go index 55dda049d3..8dcc27892e 100644 --- a/internal/endtoend/testdata/select_star_quoted/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/select_star_quoted/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/models.go index 20cdf4811c..aefe0b5dcd 100644 --- a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/query.sql.go index f44fa1c328..14fea519b9 100644 --- a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/models.go index 8260c45fd2..a77b945927 100644 --- a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/query.sql.go index dd3ab6771e..f67bea811f 100644 --- a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/models.go index 20cdf4811c..aefe0b5dcd 100644 --- a/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/query.sql.go index 2d7ba63735..4023181a3a 100644 --- a/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_subquery/postgresql/issue.md b/internal/endtoend/testdata/select_subquery/postgresql/issue.md new file mode 100644 index 0000000000..fa59b3a57d --- /dev/null +++ b/internal/endtoend/testdata/select_subquery/postgresql/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/pull/2639 diff --git a/internal/endtoend/testdata/select_subquery/postgresql/stdlib/exec.json b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/exec.json new file mode 100644 index 0000000000..e5dfda7818 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/select_subquery/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/select_subquery/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..f72a5da135 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + A int32 + Alias sql.NullString +} + +type Foo struct { + A int32 + Name sql.NullString +} diff --git a/internal/endtoend/testdata/select_subquery/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/go/query.sql.go new file mode 100644 index 0000000000..1e25e8a86a --- /dev/null +++ b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,53 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const subquery = `-- name: Subquery :many +SELECT + a, + name, + (SELECT alias FROM bar WHERE bar.a=foo.a AND alias = $1 ORDER BY bar.a DESC limit 1) as alias +FROM FOO WHERE a = $2 +` + +type SubqueryParams struct { + Column1 sql.NullString + Column2 sql.NullInt32 +} + +type SubqueryRow struct { + A int32 + Name sql.NullString + Alias sql.NullString +} + +func (q *Queries) Subquery(ctx context.Context, arg SubqueryParams) ([]SubqueryRow, error) { + rows, err := q.db.QueryContext(ctx, subquery, arg.Column1, arg.Column2) + if err != nil { + return nil, err + } + defer rows.Close() + var items []SubqueryRow + for rows.Next() { + var i SubqueryRow + if err := rows.Scan(&i.A, &i.Name, &i.Alias); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/select_subquery/postgresql/stdlib/query.sql b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..3d9b058b05 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/query.sql @@ -0,0 +1,6 @@ +-- name: Subquery :many +SELECT + a, + name, + (SELECT alias FROM bar WHERE bar.a=foo.a AND alias = $1 ORDER BY bar.a DESC limit 1) as alias +FROM FOO WHERE a = $2; diff --git a/internal/endtoend/testdata/select_subquery/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..b256bf60ae --- /dev/null +++ b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a int not null, name text); +CREATE TABLE bar (a int not null, alias text); diff --git a/internal/endtoend/testdata/select_subquery/postgresql/stdlib/sqlc.yaml b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/sqlc.yaml new file mode 100644 index 0000000000..8c68222b49 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "database/sql" diff --git a/internal/endtoend/testdata/select_subquery_alias/issue.md b/internal/endtoend/testdata/select_subquery_alias/issue.md new file mode 100644 index 0000000000..1f15e67216 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_alias/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1990 diff --git a/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/exec.json b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/go/db.go b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/go/models.go b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..9ce044a0b0 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Wallet struct { + ID int64 + Address string + Type string + Balance pgtype.Numeric +} diff --git a/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..9510db3a68 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/go/query.sql.go @@ -0,0 +1,61 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const findWallets = `-- name: FindWallets :many +select id, address, balance, total_balance from +( + select id, address, balance, + sum(balance) over (order by balance desc rows between unbounded preceding and current row) as total_balance, + sum(balance) over (order by balance desc rows between unbounded preceding and current row) - balance as last_balance + from wallets + where type=$1 +) amounts +where amounts.last_balance < $2 +` + +type FindWalletsParams struct { + Column1 pgtype.Text + Column2 pgtype.Numeric +} + +type FindWalletsRow struct { + ID int64 + Address string + Balance pgtype.Numeric + TotalBalance pgtype.Numeric +} + +func (q *Queries) FindWallets(ctx context.Context, arg FindWalletsParams) ([]FindWalletsRow, error) { + rows, err := q.db.Query(ctx, findWallets, arg.Column1, arg.Column2) + if err != nil { + return nil, err + } + defer rows.Close() + var items []FindWalletsRow + for rows.Next() { + var i FindWalletsRow + if err := rows.Scan( + &i.ID, + &i.Address, + &i.Balance, + &i.TotalBalance, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/query.sql b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/query.sql new file mode 100644 index 0000000000..b3412234c9 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/query.sql @@ -0,0 +1,10 @@ +-- name: FindWallets :many +select id, address, balance, total_balance from +( + select id, address, balance, + sum(balance) over (order by balance desc rows between unbounded preceding and current row) as total_balance, + sum(balance) over (order by balance desc rows between unbounded preceding and current row) - balance as last_balance + from wallets + where type=$1 +) amounts +where amounts.last_balance < $2; diff --git a/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/schema.sql b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..275a65e104 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE IF NOT EXISTS wallets +( + id BIGSERIAL PRIMARY KEY, + address VARCHAR(44) NOT NULL, + type VARCHAR(44) NOT NULL, + balance DECIMAL(32, 18) NULL +); diff --git a/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/select_subquery_no_alias/mysql/go/db.go b/internal/endtoend/testdata/select_subquery_no_alias/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/select_subquery_no_alias/mysql/go/models.go b/internal/endtoend/testdata/select_subquery_no_alias/mysql/go/models.go new file mode 100644 index 0000000000..a7e45a1d4e --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/mysql/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A int32 + Name sql.NullString +} diff --git a/internal/endtoend/testdata/select_subquery_no_alias/mysql/go/query.sql.go b/internal/endtoend/testdata/select_subquery_no_alias/mysql/go/query.sql.go new file mode 100644 index 0000000000..6e7e214b72 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/mysql/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const subquery = `-- name: Subquery :many +SELECT a, name FROM (SELECT a, name FROM foo) +` + +func (q *Queries) Subquery(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, subquery) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.A, &i.Name); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/select_subquery_no_alias/mysql/query.sql b/internal/endtoend/testdata/select_subquery_no_alias/mysql/query.sql new file mode 100644 index 0000000000..87477e34ca --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/mysql/query.sql @@ -0,0 +1,2 @@ +-- name: Subquery :many +SELECT * FROM (SELECT * FROM foo); diff --git a/internal/endtoend/testdata/select_subquery_no_alias/mysql/schema.sql b/internal/endtoend/testdata/select_subquery_no_alias/mysql/schema.sql new file mode 100644 index 0000000000..3d06ae047e --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/mysql/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (a int not null, name text); diff --git a/internal/endtoend/testdata/select_subquery_no_alias/mysql/sqlc.yaml b/internal/endtoend/testdata/select_subquery_no_alias/mysql/sqlc.yaml new file mode 100644 index 0000000000..b843ef55e3 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/mysql/sqlc.yaml @@ -0,0 +1,9 @@ +version: "2" +sql: + - engine: "mysql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" diff --git a/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/go/db.go b/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/go/models.go b/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/go/models.go new file mode 100644 index 0000000000..a7e45a1d4e --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A int32 + Name sql.NullString +} diff --git a/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/go/query.sql.go new file mode 100644 index 0000000000..6e7e214b72 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const subquery = `-- name: Subquery :many +SELECT a, name FROM (SELECT a, name FROM foo) +` + +func (q *Queries) Subquery(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, subquery) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.A, &i.Name); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/query.sql b/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/query.sql new file mode 100644 index 0000000000..87477e34ca --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Subquery :many +SELECT * FROM (SELECT * FROM foo); diff --git a/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/schema.sql b/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/schema.sql new file mode 100644 index 0000000000..3d06ae047e --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (a int not null, name text); diff --git a/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/sqlc.yaml b/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/sqlc.yaml new file mode 100644 index 0000000000..8c68222b49 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "database/sql" diff --git a/internal/endtoend/testdata/select_subquery_no_alias/sqlite/go/db.go b/internal/endtoend/testdata/select_subquery_no_alias/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/select_subquery_no_alias/sqlite/go/models.go b/internal/endtoend/testdata/select_subquery_no_alias/sqlite/go/models.go new file mode 100644 index 0000000000..cd99e4407b --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/sqlite/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A int64 + Name sql.NullString +} diff --git a/internal/endtoend/testdata/select_subquery_no_alias/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_subquery_no_alias/sqlite/go/query.sql.go new file mode 100644 index 0000000000..6e7e214b72 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/sqlite/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const subquery = `-- name: Subquery :many +SELECT a, name FROM (SELECT a, name FROM foo) +` + +func (q *Queries) Subquery(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, subquery) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.A, &i.Name); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/select_subquery_no_alias/sqlite/query.sql b/internal/endtoend/testdata/select_subquery_no_alias/sqlite/query.sql new file mode 100644 index 0000000000..87477e34ca --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: Subquery :many +SELECT * FROM (SELECT * FROM foo); diff --git a/internal/endtoend/testdata/select_subquery_no_alias/sqlite/schema.sql b/internal/endtoend/testdata/select_subquery_no_alias/sqlite/schema.sql new file mode 100644 index 0000000000..3d06ae047e --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/sqlite/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (a int not null, name text); diff --git a/internal/endtoend/testdata/select_subquery_no_alias/sqlite/sqlc.yaml b/internal/endtoend/testdata/select_subquery_no_alias/sqlite/sqlc.yaml new file mode 100644 index 0000000000..bd7419948d --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/sqlite/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "sqlite" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "database/sql" diff --git a/internal/endtoend/testdata/select_system/issue.md b/internal/endtoend/testdata/select_system/issue.md new file mode 100644 index 0000000000..7e536076fc --- /dev/null +++ b/internal/endtoend/testdata/select_system/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1745 diff --git a/internal/endtoend/testdata/select_system/pgx/exec.json b/internal/endtoend/testdata/select_system/pgx/exec.json new file mode 100644 index 0000000000..e5dfda7818 --- /dev/null +++ b/internal/endtoend/testdata/select_system/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/select_system/pgx/go/db.go b/internal/endtoend/testdata/select_system/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/select_system/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/select_system/pgx/go/models.go b/internal/endtoend/testdata/select_system/pgx/go/models.go new file mode 100644 index 0000000000..50dff66166 --- /dev/null +++ b/internal/endtoend/testdata/select_system/pgx/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Test struct { + ID pgtype.Int4 +} diff --git a/internal/endtoend/testdata/select_system/pgx/go/query.sql.go b/internal/endtoend/testdata/select_system/pgx/go/query.sql.go new file mode 100644 index 0000000000..cef462dc6f --- /dev/null +++ b/internal/endtoend/testdata/select_system/pgx/go/query.sql.go @@ -0,0 +1,41 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const getSystemColumns = `-- name: GetSystemColumns :one +SELECT + tableoid, xmin, cmin, xmax, cmax, ctid +FROM test +` + +type GetSystemColumnsRow struct { + Tableoid pgtype.Uint32 + Xmin pgtype.Uint32 + Cmin pgtype.Uint32 + Xmax pgtype.Uint32 + Cmax pgtype.Uint32 + Ctid pgtype.TID +} + +func (q *Queries) GetSystemColumns(ctx context.Context) (GetSystemColumnsRow, error) { + row := q.db.QueryRow(ctx, getSystemColumns) + var i GetSystemColumnsRow + err := row.Scan( + &i.Tableoid, + &i.Xmin, + &i.Cmin, + &i.Xmax, + &i.Cmax, + &i.Ctid, + ) + return i, err +} diff --git a/internal/endtoend/testdata/select_system/pgx/query.sql b/internal/endtoend/testdata/select_system/pgx/query.sql new file mode 100644 index 0000000000..11ddeb7495 --- /dev/null +++ b/internal/endtoend/testdata/select_system/pgx/query.sql @@ -0,0 +1,4 @@ +-- name: GetSystemColumns :one +SELECT + tableoid, xmin, cmin, xmax, cmax, ctid +FROM test; diff --git a/internal/endtoend/testdata/select_system/pgx/schema.sql b/internal/endtoend/testdata/select_system/pgx/schema.sql new file mode 100644 index 0000000000..7518997c95 --- /dev/null +++ b/internal/endtoend/testdata/select_system/pgx/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE test ( + id INT +); diff --git a/internal/endtoend/testdata/select_system/pgx/sqlc.yaml b/internal/endtoend/testdata/select_system/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/select_system/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/select_text_array/pgx/v4/go/db.go b/internal/endtoend/testdata/select_text_array/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/select_text_array/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/select_text_array/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_text_array/pgx/v4/go/models.go b/internal/endtoend/testdata/select_text_array/pgx/v4/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/select_text_array/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/select_text_array/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/select_text_array/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_text_array/pgx/v4/go/query.sql.go index 088c7e8320..1c26b31f26 100644 --- a/internal/endtoend/testdata/select_text_array/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_text_array/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_text_array/pgx/v4/schema.sql b/internal/endtoend/testdata/select_text_array/pgx/v4/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/select_text_array/pgx/v4/sqlc.json b/internal/endtoend/testdata/select_text_array/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/select_text_array/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/select_text_array/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_text_array/pgx/v5/go/db.go b/internal/endtoend/testdata/select_text_array/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/select_text_array/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/select_text_array/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_text_array/pgx/v5/go/models.go b/internal/endtoend/testdata/select_text_array/pgx/v5/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/select_text_array/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/select_text_array/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/select_text_array/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_text_array/pgx/v5/go/query.sql.go index 088c7e8320..1c26b31f26 100644 --- a/internal/endtoend/testdata/select_text_array/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_text_array/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_text_array/pgx/v5/schema.sql b/internal/endtoend/testdata/select_text_array/pgx/v5/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/select_text_array/pgx/v5/sqlc.json b/internal/endtoend/testdata/select_text_array/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/select_text_array/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/select_text_array/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_text_array/stdlib/go/db.go b/internal/endtoend/testdata/select_text_array/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/select_text_array/stdlib/go/db.go +++ b/internal/endtoend/testdata/select_text_array/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_text_array/stdlib/go/models.go b/internal/endtoend/testdata/select_text_array/stdlib/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/select_text_array/stdlib/go/models.go +++ b/internal/endtoend/testdata/select_text_array/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/select_text_array/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_text_array/stdlib/go/query.sql.go index af2aca6635..eaf08b1bc5 100644 --- a/internal/endtoend/testdata/select_text_array/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_text_array/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_text_array/stdlib/schema.sql b/internal/endtoend/testdata/select_text_array/stdlib/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/select_text_array/stdlib/sqlc.json b/internal/endtoend/testdata/select_text_array/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/select_text_array/stdlib/sqlc.json +++ b/internal/endtoend/testdata/select_text_array/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_union/mysql/go/db.go b/internal/endtoend/testdata/select_union/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/select_union/mysql/go/db.go +++ b/internal/endtoend/testdata/select_union/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_union/mysql/go/models.go b/internal/endtoend/testdata/select_union/mysql/go/models.go index 9a43a248cb..41f892cc4a 100644 --- a/internal/endtoend/testdata/select_union/mysql/go/models.go +++ b/internal/endtoend/testdata/select_union/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_union/mysql/go/query.sql.go b/internal/endtoend/testdata/select_union/mysql/go/query.sql.go index 432dadd44e..ce48f7b961 100644 --- a/internal/endtoend/testdata/select_union/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/select_union/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -96,6 +96,35 @@ func (q *Queries) SelectUnion(ctx context.Context) ([]Foo, error) { return items, nil } +const selectUnionAliased = `-- name: SelectUnionAliased :many +(SELECT a, b FROM foo) +UNION +SELECT a, b FROM bar +` + +func (q *Queries) SelectUnionAliased(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, selectUnionAliased) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.A, &i.B); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const selectUnionOther = `-- name: SelectUnionOther :many SELECT a, b FROM foo UNION diff --git a/internal/endtoend/testdata/select_union/mysql/query.sql b/internal/endtoend/testdata/select_union/mysql/query.sql index f8aca8b150..c706921bc3 100644 --- a/internal/endtoend/testdata/select_union/mysql/query.sql +++ b/internal/endtoend/testdata/select_union/mysql/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE foo (a text, b text); -CREATE TABLE bar (a text, b text); - -- name: SelectUnion :many SELECT * FROM foo UNION @@ -25,4 +22,9 @@ SELECT * FROM foo; -- name: SelectUnionOther :many SELECT * FROM foo UNION -SELECT * FROM bar; \ No newline at end of file +SELECT * FROM bar; + +-- name: SelectUnionAliased :many +(SELECT * FROM foo) +UNION +SELECT * FROM bar; diff --git a/internal/endtoend/testdata/select_union/mysql/schema.sql b/internal/endtoend/testdata/select_union/mysql/schema.sql new file mode 100644 index 0000000000..47a0314b3b --- /dev/null +++ b/internal/endtoend/testdata/select_union/mysql/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (a text, b text); + diff --git a/internal/endtoend/testdata/select_union/mysql/sqlc.json b/internal/endtoend/testdata/select_union/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/select_union/mysql/sqlc.json +++ b/internal/endtoend/testdata/select_union/mysql/sqlc.json @@ -5,7 +5,7 @@ "engine": "mysql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v4/exec.json b/internal/endtoend/testdata/select_union/postgres/pgx/v4/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v4/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/db.go b/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/models.go b/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/models.go index 9a43a248cb..41f892cc4a 100644 --- a/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/query.sql.go index e25fddae93..253f792c55 100644 --- a/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -87,6 +87,32 @@ func (q *Queries) SelectUnion(ctx context.Context) ([]Foo, error) { return items, nil } +const selectUnionAliased = `-- name: SelectUnionAliased :many +(SELECT a, b FROM foo) +UNION +SELECT a, b FROM foo +` + +func (q *Queries) SelectUnionAliased(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, selectUnionAliased) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.A, &i.B); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const selectUnionOther = `-- name: SelectUnionOther :many SELECT a, b FROM foo UNION diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v4/query.sql b/internal/endtoend/testdata/select_union/postgres/pgx/v4/query.sql index a2fafc7d0a..f44f1fd2af 100644 --- a/internal/endtoend/testdata/select_union/postgres/pgx/v4/query.sql +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v4/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE foo (a text, b text); -CREATE TABLE bar (a text, b text); - -- name: SelectUnion :many SELECT * FROM foo UNION @@ -25,4 +22,9 @@ SELECT * FROM foo; -- name: SelectUnionOther :many SELECT * FROM foo UNION -SELECT * FROM bar; \ No newline at end of file +SELECT * FROM bar; + +-- name: SelectUnionAliased :many +(SELECT * FROM foo) +UNION +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v4/schema.sql b/internal/endtoend/testdata/select_union/postgres/pgx/v4/schema.sql new file mode 100644 index 0000000000..47a0314b3b --- /dev/null +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (a text, b text); + diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v4/sqlc.json b/internal/endtoend/testdata/select_union/postgres/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/select_union/postgres/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v5/exec.json b/internal/endtoend/testdata/select_union/postgres/pgx/v5/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v5/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/db.go b/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/models.go b/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/models.go index 280391175b..4d48e880e1 100644 --- a/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/query.sql.go index e25fddae93..253f792c55 100644 --- a/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -87,6 +87,32 @@ func (q *Queries) SelectUnion(ctx context.Context) ([]Foo, error) { return items, nil } +const selectUnionAliased = `-- name: SelectUnionAliased :many +(SELECT a, b FROM foo) +UNION +SELECT a, b FROM foo +` + +func (q *Queries) SelectUnionAliased(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, selectUnionAliased) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.A, &i.B); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const selectUnionOther = `-- name: SelectUnionOther :many SELECT a, b FROM foo UNION diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v5/query.sql b/internal/endtoend/testdata/select_union/postgres/pgx/v5/query.sql index a2fafc7d0a..f44f1fd2af 100644 --- a/internal/endtoend/testdata/select_union/postgres/pgx/v5/query.sql +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v5/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE foo (a text, b text); -CREATE TABLE bar (a text, b text); - -- name: SelectUnion :many SELECT * FROM foo UNION @@ -25,4 +22,9 @@ SELECT * FROM foo; -- name: SelectUnionOther :many SELECT * FROM foo UNION -SELECT * FROM bar; \ No newline at end of file +SELECT * FROM bar; + +-- name: SelectUnionAliased :many +(SELECT * FROM foo) +UNION +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v5/schema.sql b/internal/endtoend/testdata/select_union/postgres/pgx/v5/schema.sql new file mode 100644 index 0000000000..47a0314b3b --- /dev/null +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (a text, b text); + diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v5/sqlc.json b/internal/endtoend/testdata/select_union/postgres/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/select_union/postgres/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_union/postgres/stdlib/exec.json b/internal/endtoend/testdata/select_union/postgres/stdlib/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/select_union/postgres/stdlib/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/select_union/postgres/stdlib/go/db.go b/internal/endtoend/testdata/select_union/postgres/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/select_union/postgres/stdlib/go/db.go +++ b/internal/endtoend/testdata/select_union/postgres/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_union/postgres/stdlib/go/models.go b/internal/endtoend/testdata/select_union/postgres/stdlib/go/models.go index 9a43a248cb..41f892cc4a 100644 --- a/internal/endtoend/testdata/select_union/postgres/stdlib/go/models.go +++ b/internal/endtoend/testdata/select_union/postgres/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_union/postgres/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_union/postgres/stdlib/go/query.sql.go index f5dc7319ab..827ee31c18 100644 --- a/internal/endtoend/testdata/select_union/postgres/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_union/postgres/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -96,6 +96,35 @@ func (q *Queries) SelectUnion(ctx context.Context) ([]Foo, error) { return items, nil } +const selectUnionAliased = `-- name: SelectUnionAliased :many +(SELECT a, b FROM foo) +UNION +SELECT a, b FROM foo +` + +func (q *Queries) SelectUnionAliased(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, selectUnionAliased) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.A, &i.B); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const selectUnionOther = `-- name: SelectUnionOther :many SELECT a, b FROM foo UNION diff --git a/internal/endtoend/testdata/select_union/postgres/stdlib/query.sql b/internal/endtoend/testdata/select_union/postgres/stdlib/query.sql index a2fafc7d0a..f44f1fd2af 100644 --- a/internal/endtoend/testdata/select_union/postgres/stdlib/query.sql +++ b/internal/endtoend/testdata/select_union/postgres/stdlib/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE foo (a text, b text); -CREATE TABLE bar (a text, b text); - -- name: SelectUnion :many SELECT * FROM foo UNION @@ -25,4 +22,9 @@ SELECT * FROM foo; -- name: SelectUnionOther :many SELECT * FROM foo UNION -SELECT * FROM bar; \ No newline at end of file +SELECT * FROM bar; + +-- name: SelectUnionAliased :many +(SELECT * FROM foo) +UNION +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/select_union/postgres/stdlib/schema.sql b/internal/endtoend/testdata/select_union/postgres/stdlib/schema.sql new file mode 100644 index 0000000000..47a0314b3b --- /dev/null +++ b/internal/endtoend/testdata/select_union/postgres/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (a text, b text); + diff --git a/internal/endtoend/testdata/select_union/postgres/stdlib/sqlc.json b/internal/endtoend/testdata/select_union/postgres/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/select_union/postgres/stdlib/sqlc.json +++ b/internal/endtoend/testdata/select_union/postgres/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_union/sqlite/go/db.go b/internal/endtoend/testdata/select_union/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/select_union/sqlite/go/db.go +++ b/internal/endtoend/testdata/select_union/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_union/sqlite/go/models.go b/internal/endtoend/testdata/select_union/sqlite/go/models.go index 9a43a248cb..41f892cc4a 100644 --- a/internal/endtoend/testdata/select_union/sqlite/go/models.go +++ b/internal/endtoend/testdata/select_union/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/select_union/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_union/sqlite/go/query.sql.go index 667d63bfa6..863e55fa04 100644 --- a/internal/endtoend/testdata/select_union/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/select_union/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_union/sqlite/query.sql b/internal/endtoend/testdata/select_union/sqlite/query.sql index f8aca8b150..67d28d1824 100644 --- a/internal/endtoend/testdata/select_union/sqlite/query.sql +++ b/internal/endtoend/testdata/select_union/sqlite/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE foo (a text, b text); -CREATE TABLE bar (a text, b text); - -- name: SelectUnion :many SELECT * FROM foo UNION @@ -25,4 +22,4 @@ SELECT * FROM foo; -- name: SelectUnionOther :many SELECT * FROM foo UNION -SELECT * FROM bar; \ No newline at end of file +SELECT * FROM bar; diff --git a/internal/endtoend/testdata/select_union/sqlite/schema.sql b/internal/endtoend/testdata/select_union/sqlite/schema.sql new file mode 100644 index 0000000000..47a0314b3b --- /dev/null +++ b/internal/endtoend/testdata/select_union/sqlite/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (a text, b text); + diff --git a/internal/endtoend/testdata/select_union/sqlite/sqlc.json b/internal/endtoend/testdata/select_union/sqlite/sqlc.json index fc58be5b0d..1f9d43df5d 100644 --- a/internal/endtoend/testdata/select_union/sqlite/sqlc.json +++ b/internal/endtoend/testdata/select_union/sqlite/sqlc.json @@ -5,7 +5,7 @@ "engine": "sqlite", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_union_subquery/issue.md b/internal/endtoend/testdata/select_union_subquery/issue.md new file mode 100644 index 0000000000..138725aa27 --- /dev/null +++ b/internal/endtoend/testdata/select_union_subquery/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/2260 diff --git a/internal/endtoend/testdata/select_union_subquery/mysql/go/db.go b/internal/endtoend/testdata/select_union_subquery/mysql/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/select_union_subquery/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/select_union_subquery/mysql/go/models.go b/internal/endtoend/testdata/select_union_subquery/mysql/go/models.go new file mode 100644 index 0000000000..ec1cb8d670 --- /dev/null +++ b/internal/endtoend/testdata/select_union_subquery/mysql/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int32 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/select_union_subquery/mysql/go/query.sql.go b/internal/endtoend/testdata/select_union_subquery/mysql/go/query.sql.go new file mode 100644 index 0000000000..affaa7cdd1 --- /dev/null +++ b/internal/endtoend/testdata/select_union_subquery/mysql/go/query.sql.go @@ -0,0 +1,41 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const testSubqueryUnion = `-- name: TestSubqueryUnion :many +SELECT tmp.id, tmp.name, tmp.bio FROM ( + SELECT id, name, bio FROM authors + UNION + SELECT id, name, bio FROM authors +) tmp LIMIT 5 +` + +func (q *Queries) TestSubqueryUnion(ctx context.Context) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, testSubqueryUnion) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan(&i.ID, &i.Name, &i.Bio); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/select_union_subquery/mysql/query.sql b/internal/endtoend/testdata/select_union_subquery/mysql/query.sql new file mode 100644 index 0000000000..6eaabdcf49 --- /dev/null +++ b/internal/endtoend/testdata/select_union_subquery/mysql/query.sql @@ -0,0 +1,6 @@ +-- name: TestSubqueryUnion :many +SELECT tmp.* FROM ( + SELECT * FROM authors + UNION + SELECT * FROM authors +) tmp LIMIT 5; diff --git a/internal/endtoend/testdata/select_union_subquery/mysql/schema.sql b/internal/endtoend/testdata/select_union_subquery/mysql/schema.sql new file mode 100644 index 0000000000..7793468f4e --- /dev/null +++ b/internal/endtoend/testdata/select_union_subquery/mysql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id int PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/select_union_subquery/mysql/sqlc.yaml b/internal/endtoend/testdata/select_union_subquery/mysql/sqlc.yaml new file mode 100644 index 0000000000..b843ef55e3 --- /dev/null +++ b/internal/endtoend/testdata/select_union_subquery/mysql/sqlc.yaml @@ -0,0 +1,9 @@ +version: "2" +sql: + - engine: "mysql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" diff --git a/internal/endtoend/testdata/select_union_subquery/postgresql/go/db.go b/internal/endtoend/testdata/select_union_subquery/postgresql/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/select_union_subquery/postgresql/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/select_union_subquery/postgresql/go/models.go b/internal/endtoend/testdata/select_union_subquery/postgresql/go/models.go new file mode 100644 index 0000000000..0b43a03de8 --- /dev/null +++ b/internal/endtoend/testdata/select_union_subquery/postgresql/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Author struct { + ID int32 + Name string + Bio pgtype.Text +} diff --git a/internal/endtoend/testdata/select_union_subquery/postgresql/go/query.sql.go b/internal/endtoend/testdata/select_union_subquery/postgresql/go/query.sql.go new file mode 100644 index 0000000000..f960e1cbd9 --- /dev/null +++ b/internal/endtoend/testdata/select_union_subquery/postgresql/go/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const testSubqueryUnion = `-- name: TestSubqueryUnion :many +SELECT tmp.id, tmp.name, tmp.bio FROM ( + SELECT id, name, bio FROM authors + UNION + SELECT id, name, bio FROM authors +) tmp LIMIT 5 +` + +func (q *Queries) TestSubqueryUnion(ctx context.Context) ([]Author, error) { + rows, err := q.db.Query(ctx, testSubqueryUnion) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan(&i.ID, &i.Name, &i.Bio); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/select_union_subquery/postgresql/query.sql b/internal/endtoend/testdata/select_union_subquery/postgresql/query.sql new file mode 100644 index 0000000000..6eaabdcf49 --- /dev/null +++ b/internal/endtoend/testdata/select_union_subquery/postgresql/query.sql @@ -0,0 +1,6 @@ +-- name: TestSubqueryUnion :many +SELECT tmp.* FROM ( + SELECT * FROM authors + UNION + SELECT * FROM authors +) tmp LIMIT 5; diff --git a/internal/endtoend/testdata/select_union_subquery/postgresql/schema.sql b/internal/endtoend/testdata/select_union_subquery/postgresql/schema.sql new file mode 100644 index 0000000000..7793468f4e --- /dev/null +++ b/internal/endtoend/testdata/select_union_subquery/postgresql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id int PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/select_union_subquery/postgresql/sqlc.yaml b/internal/endtoend/testdata/select_union_subquery/postgresql/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/select_union_subquery/postgresql/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/selectstatic/mysql/go/db.go b/internal/endtoend/testdata/selectstatic/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/selectstatic/mysql/go/db.go +++ b/internal/endtoend/testdata/selectstatic/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/selectstatic/mysql/go/models.go b/internal/endtoend/testdata/selectstatic/mysql/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/selectstatic/mysql/go/models.go +++ b/internal/endtoend/testdata/selectstatic/mysql/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/selectstatic/mysql/go/query.sql.go b/internal/endtoend/testdata/selectstatic/mysql/go/query.sql.go index bb07496a99..c6cfed9b63 100644 --- a/internal/endtoend/testdata/selectstatic/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/selectstatic/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/selectstatic/mysql/schema.sql b/internal/endtoend/testdata/selectstatic/mysql/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/selectstatic/mysql/sqlc.json b/internal/endtoend/testdata/selectstatic/mysql/sqlc.json index 3d928ae137..b474940a09 100644 --- a/internal/endtoend/testdata/selectstatic/mysql/sqlc.json +++ b/internal/endtoend/testdata/selectstatic/mysql/sqlc.json @@ -6,7 +6,7 @@ "sql_package": "database/sql", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/show_warnings/mysql/go/db.go b/internal/endtoend/testdata/show_warnings/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/show_warnings/mysql/go/db.go +++ b/internal/endtoend/testdata/show_warnings/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/show_warnings/mysql/go/models.go b/internal/endtoend/testdata/show_warnings/mysql/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/show_warnings/mysql/go/models.go +++ b/internal/endtoend/testdata/show_warnings/mysql/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/show_warnings/mysql/go/query.sql.go b/internal/endtoend/testdata/show_warnings/mysql/go/query.sql.go index c85d3a0577..00482e19f3 100644 --- a/internal/endtoend/testdata/show_warnings/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/show_warnings/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/show_warnings/mysql/schema.sql b/internal/endtoend/testdata/show_warnings/mysql/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/show_warnings/mysql/sqlc.json b/internal/endtoend/testdata/show_warnings/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/show_warnings/mysql/sqlc.json +++ b/internal/endtoend/testdata/show_warnings/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/single_param_conflict/mysql/go/db.go b/internal/endtoend/testdata/single_param_conflict/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/single_param_conflict/mysql/go/db.go +++ b/internal/endtoend/testdata/single_param_conflict/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/single_param_conflict/mysql/go/models.go b/internal/endtoend/testdata/single_param_conflict/mysql/go/models.go index 71d0c8f717..76309f48ac 100644 --- a/internal/endtoend/testdata/single_param_conflict/mysql/go/models.go +++ b/internal/endtoend/testdata/single_param_conflict/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/single_param_conflict/mysql/go/query.sql.go b/internal/endtoend/testdata/single_param_conflict/mysql/go/query.sql.go index e94c513e46..e3ba139207 100644 --- a/internal/endtoend/testdata/single_param_conflict/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/single_param_conflict/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/single_param_conflict/mysql/query.sql b/internal/endtoend/testdata/single_param_conflict/mysql/query.sql index 244a747c3c..23b454dac0 100644 --- a/internal/endtoend/testdata/single_param_conflict/mysql/query.sql +++ b/internal/endtoend/testdata/single_param_conflict/mysql/query.sql @@ -1,10 +1,3 @@ --- Example queries for sqlc -CREATE TABLE authors ( - id BIGINT PRIMARY KEY, - name TEXT NOT NULL, - bio text -); - -- name: GetAuthorIDByID :one SELECT id FROM authors @@ -17,11 +10,6 @@ FROM authors WHERE id = ? LIMIT 1; --- https://github.com/sqlc-dev/sqlc/issues/1290 -CREATE TABLE users ( - sub TEXT PRIMARY KEY -); - -- name: GetUser :one SELECT sub FROM users diff --git a/internal/endtoend/testdata/single_param_conflict/mysql/schema.sql b/internal/endtoend/testdata/single_param_conflict/mysql/schema.sql new file mode 100644 index 0000000000..2f49d219f3 --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/mysql/schema.sql @@ -0,0 +1,11 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id BIGINT PRIMARY KEY, + name TEXT NOT NULL, + bio text +); + +-- https://github.com/sqlc-dev/sqlc/issues/1290 +CREATE TABLE users ( + sub VARCHAR(10) PRIMARY KEY +); diff --git a/internal/endtoend/testdata/single_param_conflict/mysql/sqlc.json b/internal/endtoend/testdata/single_param_conflict/mysql/sqlc.json index ebd191983c..c7c930dbee 100644 --- a/internal/endtoend/testdata/single_param_conflict/mysql/sqlc.json +++ b/internal/endtoend/testdata/single_param_conflict/mysql/sqlc.json @@ -5,7 +5,7 @@ "engine": "mysql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/models.go index 687547d89e..e42f868a67 100644 --- a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/query.sql.go index a904edc966..1912659d8b 100644 --- a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -54,7 +54,7 @@ func (q *Queries) GetUser(ctx context.Context, sub uuid.UUID) (uuid.UUID, error) const setDefaultName = `-- name: SetDefaultName :one UPDATE authors -SET name = "Default Name" +SET name = 'Default Name' WHERE id = $1 RETURNING id ` diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/query.sql index 6a478dc5b1..ca3fc5c6a4 100644 --- a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/query.sql @@ -1,10 +1,3 @@ --- Example queries for sqlc -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - name TEXT NOT NULL, - bio text -); - -- name: GetAuthorIDByID :one SELECT id FROM authors @@ -17,11 +10,6 @@ FROM authors WHERE id = $1 LIMIT 1; --- https://github.com/sqlc-dev/sqlc/issues/1290 -CREATE TABLE users ( - sub UUID PRIMARY KEY -); - -- name: GetUser :one SELECT sub FROM users @@ -32,6 +20,6 @@ LIMIT 1; -- name: SetDefaultName :one UPDATE authors -SET name = "Default Name" +SET name = 'Default Name' WHERE id = $1 RETURNING id; diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..0c4555a034 --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/schema.sql @@ -0,0 +1,11 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name TEXT NOT NULL, + bio text +); + +-- https://github.com/sqlc-dev/sqlc/issues/1290 +CREATE TABLE users ( + sub UUID PRIMARY KEY +); diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/sqlc.json index aa9521eab8..827c74c0d1 100644 --- a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "sql_package": "pgx/v4", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/models.go index 3dd0b394a8..29daab34db 100644 --- a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/query.sql.go index f00070c371..daa903d8c2 100644 --- a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -54,7 +54,7 @@ func (q *Queries) GetUser(ctx context.Context, sub pgtype.UUID) (pgtype.UUID, er const setDefaultName = `-- name: SetDefaultName :one UPDATE authors -SET name = "Default Name" +SET name = 'Default Name' WHERE id = $1 RETURNING id ` diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/query.sql index 6a478dc5b1..ca3fc5c6a4 100644 --- a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/query.sql @@ -1,10 +1,3 @@ --- Example queries for sqlc -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - name TEXT NOT NULL, - bio text -); - -- name: GetAuthorIDByID :one SELECT id FROM authors @@ -17,11 +10,6 @@ FROM authors WHERE id = $1 LIMIT 1; --- https://github.com/sqlc-dev/sqlc/issues/1290 -CREATE TABLE users ( - sub UUID PRIMARY KEY -); - -- name: GetUser :one SELECT sub FROM users @@ -32,6 +20,6 @@ LIMIT 1; -- name: SetDefaultName :one UPDATE authors -SET name = "Default Name" +SET name = 'Default Name' WHERE id = $1 RETURNING id; diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..0c4555a034 --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/schema.sql @@ -0,0 +1,11 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name TEXT NOT NULL, + bio text +); + +-- https://github.com/sqlc-dev/sqlc/issues/1290 +CREATE TABLE users ( + sub UUID PRIMARY KEY +); diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/sqlc.json index 94b58b2000..fbae807cad 100644 --- a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "sql_package": "pgx/v5", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/models.go index 687547d89e..e42f868a67 100644 --- a/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/query.sql.go index 1d992e3b85..0b99078536 100644 --- a/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -54,7 +54,7 @@ func (q *Queries) GetUser(ctx context.Context, sub uuid.UUID) (uuid.UUID, error) const setDefaultName = `-- name: SetDefaultName :one UPDATE authors -SET name = "Default Name" +SET name = 'Default Name' WHERE id = $1 RETURNING id ` diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/query.sql b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/query.sql index 6a478dc5b1..ca3fc5c6a4 100644 --- a/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/query.sql @@ -1,10 +1,3 @@ --- Example queries for sqlc -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - name TEXT NOT NULL, - bio text -); - -- name: GetAuthorIDByID :one SELECT id FROM authors @@ -17,11 +10,6 @@ FROM authors WHERE id = $1 LIMIT 1; --- https://github.com/sqlc-dev/sqlc/issues/1290 -CREATE TABLE users ( - sub UUID PRIMARY KEY -); - -- name: GetUser :one SELECT sub FROM users @@ -32,6 +20,6 @@ LIMIT 1; -- name: SetDefaultName :one UPDATE authors -SET name = "Default Name" +SET name = 'Default Name' WHERE id = $1 RETURNING id; diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..0c4555a034 --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/schema.sql @@ -0,0 +1,11 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name TEXT NOT NULL, + bio text +); + +-- https://github.com/sqlc-dev/sqlc/issues/1290 +CREATE TABLE users ( + sub UUID PRIMARY KEY +); diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/sqlc.json index 2e0c1b1ae1..1a9272b06c 100644 --- a/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "engine": "postgresql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/single_param_conflict/sqlite/go/db.go b/internal/endtoend/testdata/single_param_conflict/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/single_param_conflict/sqlite/go/db.go +++ b/internal/endtoend/testdata/single_param_conflict/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/single_param_conflict/sqlite/go/models.go b/internal/endtoend/testdata/single_param_conflict/sqlite/go/models.go index 71d0c8f717..76309f48ac 100644 --- a/internal/endtoend/testdata/single_param_conflict/sqlite/go/models.go +++ b/internal/endtoend/testdata/single_param_conflict/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/single_param_conflict/sqlite/go/query.sql.go b/internal/endtoend/testdata/single_param_conflict/sqlite/go/query.sql.go index e94c513e46..e3ba139207 100644 --- a/internal/endtoend/testdata/single_param_conflict/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/single_param_conflict/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/single_param_conflict/sqlite/query.sql b/internal/endtoend/testdata/single_param_conflict/sqlite/query.sql index 244a747c3c..23b454dac0 100644 --- a/internal/endtoend/testdata/single_param_conflict/sqlite/query.sql +++ b/internal/endtoend/testdata/single_param_conflict/sqlite/query.sql @@ -1,10 +1,3 @@ --- Example queries for sqlc -CREATE TABLE authors ( - id BIGINT PRIMARY KEY, - name TEXT NOT NULL, - bio text -); - -- name: GetAuthorIDByID :one SELECT id FROM authors @@ -17,11 +10,6 @@ FROM authors WHERE id = ? LIMIT 1; --- https://github.com/sqlc-dev/sqlc/issues/1290 -CREATE TABLE users ( - sub TEXT PRIMARY KEY -); - -- name: GetUser :one SELECT sub FROM users diff --git a/internal/endtoend/testdata/single_param_conflict/sqlite/schema.sql b/internal/endtoend/testdata/single_param_conflict/sqlite/schema.sql new file mode 100644 index 0000000000..376329e101 --- /dev/null +++ b/internal/endtoend/testdata/single_param_conflict/sqlite/schema.sql @@ -0,0 +1,11 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id BIGINT PRIMARY KEY, + name TEXT NOT NULL, + bio text +); + +-- https://github.com/sqlc-dev/sqlc/issues/1290 +CREATE TABLE users ( + sub TEXT PRIMARY KEY +); diff --git a/internal/endtoend/testdata/single_param_conflict/sqlite/sqlc.json b/internal/endtoend/testdata/single_param_conflict/sqlite/sqlc.json index 13e65f3ffd..1f9d43df5d 100644 --- a/internal/endtoend/testdata/single_param_conflict/sqlite/sqlc.json +++ b/internal/endtoend/testdata/single_param_conflict/sqlite/sqlc.json @@ -5,8 +5,8 @@ "engine": "sqlite", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] -} \ No newline at end of file +} diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/query.sql.go index fd2b0914c3..e0766794c9 100644 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/query.sql index 59a2c35138..c1fc6ea341 100644 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/query.sql @@ -1,15 +1,3 @@ --- https://www.postgresql.org/docs/current/sql-syntax-calling-funcs.html -CREATE FUNCTION concat_lower_or_upper(a text, b text, uppercase boolean DEFAULT false) -RETURNS text -AS -$$ - SELECT CASE - WHEN $3 THEN UPPER($1 || ' ' || $2) - ELSE LOWER($1 || ' ' || $2) - END; -$$ -LANGUAGE SQL IMMUTABLE STRICT; - -- name: PositionalNotation :one SELECT concat_lower_or_upper('Hello', 'World', true); diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..8f20642052 --- /dev/null +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/schema.sql @@ -0,0 +1,12 @@ +-- https://www.postgresql.org/docs/current/sql-syntax-calling-funcs.html +CREATE FUNCTION concat_lower_or_upper(a text, b text, uppercase boolean DEFAULT false) +RETURNS text +AS +$$ + SELECT CASE + WHEN $3 THEN UPPER($1 || ' ' || $2) + ELSE LOWER($1 || ' ' || $2) + END; +$$ +LANGUAGE SQL IMMUTABLE STRICT; + diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/query.sql.go index fd2b0914c3..e0766794c9 100644 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/query.sql index 59a2c35138..c1fc6ea341 100644 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/query.sql @@ -1,15 +1,3 @@ --- https://www.postgresql.org/docs/current/sql-syntax-calling-funcs.html -CREATE FUNCTION concat_lower_or_upper(a text, b text, uppercase boolean DEFAULT false) -RETURNS text -AS -$$ - SELECT CASE - WHEN $3 THEN UPPER($1 || ' ' || $2) - ELSE LOWER($1 || ' ' || $2) - END; -$$ -LANGUAGE SQL IMMUTABLE STRICT; - -- name: PositionalNotation :one SELECT concat_lower_or_upper('Hello', 'World', true); diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..8f20642052 --- /dev/null +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/schema.sql @@ -0,0 +1,12 @@ +-- https://www.postgresql.org/docs/current/sql-syntax-calling-funcs.html +CREATE FUNCTION concat_lower_or_upper(a text, b text, uppercase boolean DEFAULT false) +RETURNS text +AS +$$ + SELECT CASE + WHEN $3 THEN UPPER($1 || ' ' || $2) + ELSE LOWER($1 || ' ' || $2) + END; +$$ +LANGUAGE SQL IMMUTABLE STRICT; + diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/models.go index 172574ab22..333ea43ea3 100644 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest - -import () diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/query.sql.go index 3ecc521b9a..76911da54c 100644 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/query.sql b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/query.sql index 59a2c35138..c1fc6ea341 100644 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/query.sql @@ -1,15 +1,3 @@ --- https://www.postgresql.org/docs/current/sql-syntax-calling-funcs.html -CREATE FUNCTION concat_lower_or_upper(a text, b text, uppercase boolean DEFAULT false) -RETURNS text -AS -$$ - SELECT CASE - WHEN $3 THEN UPPER($1 || ' ' || $2) - ELSE LOWER($1 || ' ' || $2) - END; -$$ -LANGUAGE SQL IMMUTABLE STRICT; - -- name: PositionalNotation :one SELECT concat_lower_or_upper('Hello', 'World', true); diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..8f20642052 --- /dev/null +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/schema.sql @@ -0,0 +1,12 @@ +-- https://www.postgresql.org/docs/current/sql-syntax-calling-funcs.html +CREATE FUNCTION concat_lower_or_upper(a text, b text, uppercase boolean DEFAULT false) +RETURNS text +AS +$$ + SELECT CASE + WHEN $3 THEN UPPER($1 || ' ' || $2) + ELSE LOWER($1 || ' ' || $2) + END; +$$ +LANGUAGE SQL IMMUTABLE STRICT; + diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/sqlc.json index de427d069f..cd518671ac 100644 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "engine": "postgresql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/sqlc_arg/mysql/go/db.go b/internal/endtoend/testdata/sqlc_arg/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/sqlc_arg/mysql/go/db.go +++ b/internal/endtoend/testdata/sqlc_arg/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_arg/mysql/go/models.go b/internal/endtoend/testdata/sqlc_arg/mysql/go/models.go index 60a7e7ea71..d870bb7cde 100644 --- a/internal/endtoend/testdata/sqlc_arg/mysql/go/models.go +++ b/internal/endtoend/testdata/sqlc_arg/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Name string } diff --git a/internal/endtoend/testdata/sqlc_arg/mysql/go/query.sql.go b/internal/endtoend/testdata/sqlc_arg/mysql/go/query.sql.go index 6f3a626e57..ae033111a2 100644 --- a/internal/endtoend/testdata/sqlc_arg/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_arg/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_arg/mysql/query.sql b/internal/endtoend/testdata/sqlc_arg/mysql/query.sql index a5fa3f06ec..15cb7001ca 100644 --- a/internal/endtoend/testdata/sqlc_arg/mysql/query.sql +++ b/internal/endtoend/testdata/sqlc_arg/mysql/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (name text not null); - /* name: FuncParamIdent :many */ SELECT name FROM foo WHERE name = sqlc.arg(slug); diff --git a/internal/endtoend/testdata/sqlc_arg/mysql/schema.sql b/internal/endtoend/testdata/sqlc_arg/mysql/schema.sql new file mode 100644 index 0000000000..ec46e55ccb --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null); + diff --git a/internal/endtoend/testdata/sqlc_arg/mysql/sqlc.json b/internal/endtoend/testdata/sqlc_arg/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/sqlc_arg/mysql/sqlc.json +++ b/internal/endtoend/testdata/sqlc_arg/mysql/sqlc.json @@ -5,7 +5,7 @@ "engine": "mysql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/models.go index 60a7e7ea71..d870bb7cde 100644 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Name string } diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/query.sql.go index 25bab121c3..1329a6e015 100644 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/query.sql index 9a8e98e223..2dfaa9cd5c 100644 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (name text not null); - -- name: FuncParamIdent :many SELECT name FROM foo WHERE name = sqlc.arg(slug); diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..ec46e55ccb --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null); + diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/models.go index 60a7e7ea71..d870bb7cde 100644 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Name string } diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/query.sql.go index 25bab121c3..1329a6e015 100644 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/query.sql index 9a8e98e223..2dfaa9cd5c 100644 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (name text not null); - -- name: FuncParamIdent :many SELECT name FROM foo WHERE name = sqlc.arg(slug); diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..ec46e55ccb --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null); + diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/models.go index 60a7e7ea71..d870bb7cde 100644 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Name string } diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/query.sql.go index b5cc396dfd..f7b36b5389 100644 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/query.sql b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/query.sql index 9a8e98e223..2dfaa9cd5c 100644 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (name text not null); - -- name: FuncParamIdent :many SELECT name FROM foo WHERE name = sqlc.arg(slug); diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..ec46e55ccb --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null); + diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/sqlc.json index de427d069f..cd518671ac 100644 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "engine": "postgresql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/sqlc_arg/sqlite/go/db.go b/internal/endtoend/testdata/sqlc_arg/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/sqlc_arg/sqlite/go/db.go +++ b/internal/endtoend/testdata/sqlc_arg/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_arg/sqlite/go/models.go b/internal/endtoend/testdata/sqlc_arg/sqlite/go/models.go index 60a7e7ea71..d870bb7cde 100644 --- a/internal/endtoend/testdata/sqlc_arg/sqlite/go/models.go +++ b/internal/endtoend/testdata/sqlc_arg/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Name string } diff --git a/internal/endtoend/testdata/sqlc_arg/sqlite/go/query.sql.go b/internal/endtoend/testdata/sqlc_arg/sqlite/go/query.sql.go index b02657284d..1ed076d63e 100644 --- a/internal/endtoend/testdata/sqlc_arg/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_arg/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_arg/sqlite/query.sql b/internal/endtoend/testdata/sqlc_arg/sqlite/query.sql index a8a16f7de9..b9a01edbd9 100644 --- a/internal/endtoend/testdata/sqlc_arg/sqlite/query.sql +++ b/internal/endtoend/testdata/sqlc_arg/sqlite/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (name text not null); - /* name: FuncParamIdent :many */ SELECT name FROM foo WHERE name = sqlc.arg(slug); diff --git a/internal/endtoend/testdata/sqlc_arg/sqlite/schema.sql b/internal/endtoend/testdata/sqlc_arg/sqlite/schema.sql new file mode 100644 index 0000000000..ec46e55ccb --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null); + diff --git a/internal/endtoend/testdata/sqlc_arg/sqlite/sqlc.json b/internal/endtoend/testdata/sqlc_arg/sqlite/sqlc.json index fc58be5b0d..1f9d43df5d 100644 --- a/internal/endtoend/testdata/sqlc_arg/sqlite/sqlc.json +++ b/internal/endtoend/testdata/sqlc_arg/sqlite/sqlc.json @@ -5,7 +5,7 @@ "engine": "sqlite", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/sqlc_arg_invalid/mysql/query.sql b/internal/endtoend/testdata/sqlc_arg_invalid/mysql/query.sql index 3e46d7204b..80d171b2c2 100644 --- a/internal/endtoend/testdata/sqlc_arg_invalid/mysql/query.sql +++ b/internal/endtoend/testdata/sqlc_arg_invalid/mysql/query.sql @@ -1,8 +1,3 @@ -CREATE TABLE users ( - id serial, - first_name text not null -); - -- name: WrongFunc :one select id, first_name from users where id = sqlc.argh(target_id); diff --git a/internal/endtoend/testdata/sqlc_arg_invalid/mysql/schema.sql b/internal/endtoend/testdata/sqlc_arg_invalid/mysql/schema.sql new file mode 100644 index 0000000000..b11bfef310 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg_invalid/mysql/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE users ( + id serial, + first_name text not null +); diff --git a/internal/endtoend/testdata/sqlc_arg_invalid/mysql/sqlc.json b/internal/endtoend/testdata/sqlc_arg_invalid/mysql/sqlc.json index bfbd23e211..a9e7b055a4 100644 --- a/internal/endtoend/testdata/sqlc_arg_invalid/mysql/sqlc.json +++ b/internal/endtoend/testdata/sqlc_arg_invalid/mysql/sqlc.json @@ -4,7 +4,7 @@ { "name": "querytest", "path": "go", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "engine": "mysql" } diff --git a/internal/endtoend/testdata/sqlc_arg_invalid/mysql/stderr.txt b/internal/endtoend/testdata/sqlc_arg_invalid/mysql/stderr.txt index 8009988505..73966182fb 100644 --- a/internal/endtoend/testdata/sqlc_arg_invalid/mysql/stderr.txt +++ b/internal/endtoend/testdata/sqlc_arg_invalid/mysql/stderr.txt @@ -1,6 +1,6 @@ # package querytest -query.sql:7:1: function "sqlc.argh" does not exist -query.sql:10:45: expected 1 parameter to sqlc.arg; got 2 -query.sql:13:45: expected 1 parameter to sqlc.arg; got 0 -query.sql:16:54: Invalid argument to sqlc.arg() -query.sql:19:54: Invalid argument to sqlc.arg() +query.sql:1:1: function "sqlc.argh" does not exist +query.sql:5:45: expected 1 parameter to sqlc.arg; got 2 +query.sql:8:45: expected 1 parameter to sqlc.arg; got 0 +query.sql:11:45: expected parameter to sqlc.arg to be string or reference; got *ast.FuncCall +query.sql:14:45: expected parameter to sqlc.arg to be string or reference; got *ast.ParamRef diff --git a/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/query.sql b/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/query.sql index fe25398cce..397850187a 100644 --- a/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/query.sql +++ b/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/query.sql @@ -1,8 +1,3 @@ -CREATE TABLE users ( - id serial, - first_name text not null -); - -- name: WrongFunc :one select id, first_name from users where id = sqlc.argh(target_id); diff --git a/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/schema.sql b/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/schema.sql new file mode 100644 index 0000000000..0a380b5f9d --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE users ( + id serial, + first_name text not null +); \ No newline at end of file diff --git a/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/sqlc.json b/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/sqlc.json index 696ed223db..f5a835c5a6 100644 --- a/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/sqlc.json +++ b/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/sqlc.json @@ -4,7 +4,7 @@ { "name": "querytest", "path": "go", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "engine": "postgresql" } diff --git a/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/stderr.txt b/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/stderr.txt index 8009988505..8dbea1f949 100644 --- a/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/stderr.txt +++ b/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/stderr.txt @@ -1,6 +1,7 @@ # package querytest -query.sql:7:1: function "sqlc.argh" does not exist -query.sql:10:45: expected 1 parameter to sqlc.arg; got 2 -query.sql:13:45: expected 1 parameter to sqlc.arg; got 0 -query.sql:16:54: Invalid argument to sqlc.arg() -query.sql:19:54: Invalid argument to sqlc.arg() +query.sql:1:1: function "sqlc.argh" does not exist +query.sql:5:45: expected 1 parameter to sqlc.arg; got 2 +query.sql:8:45: expected 1 parameter to sqlc.arg; got 0 +query.sql:11:45: expected parameter to sqlc.arg to be string or reference; got *ast.FuncCall +query.sql:14:45: expected parameter to sqlc.arg to be string or reference; got *ast.ParamRef + diff --git a/internal/endtoend/testdata/sqlc_arg_invalid/sqlite/stderr.txt b/internal/endtoend/testdata/sqlc_arg_invalid/sqlite/stderr.txt index 8009988505..be38c8b505 100644 --- a/internal/endtoend/testdata/sqlc_arg_invalid/sqlite/stderr.txt +++ b/internal/endtoend/testdata/sqlc_arg_invalid/sqlite/stderr.txt @@ -2,5 +2,5 @@ query.sql:7:1: function "sqlc.argh" does not exist query.sql:10:45: expected 1 parameter to sqlc.arg; got 2 query.sql:13:45: expected 1 parameter to sqlc.arg; got 0 -query.sql:16:54: Invalid argument to sqlc.arg() -query.sql:19:54: Invalid argument to sqlc.arg() +query.sql:16:45: expected parameter to sqlc.arg to be string or reference; got *ast.FuncCall +query.sql:19:45: expected parameter to sqlc.arg to be string or reference; got *ast.ParamRef diff --git a/internal/endtoend/testdata/sqlc_embed/mysql/exec.json b/internal/endtoend/testdata/sqlc_embed/mysql/exec.json new file mode 100644 index 0000000000..c85ca2dfa7 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/mysql/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["base"], + "meta": { + "invalid_schema": true + } +} diff --git a/internal/endtoend/testdata/sqlc_embed/mysql/go/db.go b/internal/endtoend/testdata/sqlc_embed/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/sqlc_embed/mysql/go/db.go +++ b/internal/endtoend/testdata/sqlc_embed/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_embed/mysql/go/models.go b/internal/endtoend/testdata/sqlc_embed/mysql/go/models.go index c6a50d65da..ca7ee22488 100644 --- a/internal/endtoend/testdata/sqlc_embed/mysql/go/models.go +++ b/internal/endtoend/testdata/sqlc_embed/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_embed/mysql/go/query.sql.go b/internal/endtoend/testdata/sqlc_embed/mysql/go/query.sql.go index 7cc6e16ad5..09f901c7b3 100644 --- a/internal/endtoend/testdata/sqlc_embed/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_embed/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_embed/mysql/query.sql b/internal/endtoend/testdata/sqlc_embed/mysql/query.sql index 314f697384..7822145508 100644 --- a/internal/endtoend/testdata/sqlc_embed/mysql/query.sql +++ b/internal/endtoend/testdata/sqlc_embed/mysql/query.sql @@ -1,22 +1,3 @@ -CREATE SCHEMA IF NOT EXISTS baz; - -CREATE TABLE users ( - id integer NOT NULL PRIMARY KEY, - name varchar(255) NOT NULL, - age integer NULL -); - -CREATE TABLE posts ( - id integer NOT NULL PRIMARY KEY, - user_id integer NOT NULL -); - -CREATE TABLE baz.users ( - id integer NOT NULL PRIMARY KEY, - name varchar(255) NOT NULL -); - - -- name: Only :one SELECT sqlc.embed(users) FROM users; diff --git a/internal/endtoend/testdata/sqlc_embed/mysql/schema.sql b/internal/endtoend/testdata/sqlc_embed/mysql/schema.sql new file mode 100644 index 0000000000..28751aa16e --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/mysql/schema.sql @@ -0,0 +1,19 @@ +CREATE SCHEMA IF NOT EXISTS baz; + +CREATE TABLE users ( + id integer NOT NULL PRIMARY KEY, + name varchar(255) NOT NULL, + age integer NULL +); + +CREATE TABLE posts ( + id integer NOT NULL PRIMARY KEY, + user_id integer NOT NULL +); + +CREATE TABLE baz.users ( + id integer NOT NULL PRIMARY KEY, + name varchar(255) NOT NULL +); + + diff --git a/internal/endtoend/testdata/sqlc_embed/mysql/sqlc.json b/internal/endtoend/testdata/sqlc_embed/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/sqlc_embed/mysql/sqlc.json +++ b/internal/endtoend/testdata/sqlc_embed/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/db.go b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/db.go +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/models.go b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/models.go index b04b0b9162..ae771b23ab 100644 --- a/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/models.go +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/query.sql.go index a431c6a210..643d5d41d6 100644 --- a/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/query.sql b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/query.sql index 314f697384..7822145508 100644 --- a/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/query.sql +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/query.sql @@ -1,22 +1,3 @@ -CREATE SCHEMA IF NOT EXISTS baz; - -CREATE TABLE users ( - id integer NOT NULL PRIMARY KEY, - name varchar(255) NOT NULL, - age integer NULL -); - -CREATE TABLE posts ( - id integer NOT NULL PRIMARY KEY, - user_id integer NOT NULL -); - -CREATE TABLE baz.users ( - id integer NOT NULL PRIMARY KEY, - name varchar(255) NOT NULL -); - - -- name: Only :one SELECT sqlc.embed(users) FROM users; diff --git a/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/schema.sql b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..28751aa16e --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/schema.sql @@ -0,0 +1,19 @@ +CREATE SCHEMA IF NOT EXISTS baz; + +CREATE TABLE users ( + id integer NOT NULL PRIMARY KEY, + name varchar(255) NOT NULL, + age integer NULL +); + +CREATE TABLE posts ( + id integer NOT NULL PRIMARY KEY, + user_id integer NOT NULL +); + +CREATE TABLE baz.users ( + id integer NOT NULL PRIMARY KEY, + name varchar(255) NOT NULL +); + + diff --git a/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/sqlc.json b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/sqlc.json index 67d658b558..c74e245180 100644 --- a/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/sqlc.json +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_json_tags": true, "emit_db_tags": true diff --git a/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/models.go index 680de73cb6..401fe50193 100644 --- a/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/query.sql.go index 9b1b076ff5..460f8fe490 100644 --- a/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/query.sql b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/query.sql index b4c2405ba5..7822145508 100644 --- a/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/query.sql @@ -1,23 +1,3 @@ -CREATE SCHEMA IF NOT EXISTS baz; - -CREATE TABLE users ( - id integer NOT NULL PRIMARY KEY, - name varchar(255) NOT NULL, - age integer NULL -); - -CREATE TABLE posts ( - id integer NOT NULL PRIMARY KEY, - user_id integer NOT NULL, - likes integer[] NOT NULL -); - -CREATE TABLE baz.users ( - id integer NOT NULL PRIMARY KEY, - name varchar(255) NOT NULL -); - - -- name: Only :one SELECT sqlc.embed(users) FROM users; diff --git a/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..7a60bb1659 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/schema.sql @@ -0,0 +1,20 @@ +CREATE SCHEMA IF NOT EXISTS baz; + +CREATE TABLE users ( + id integer NOT NULL PRIMARY KEY, + name varchar(255) NOT NULL, + age integer NULL +); + +CREATE TABLE posts ( + id integer NOT NULL PRIMARY KEY, + user_id integer NOT NULL, + likes integer[] NOT NULL +); + +CREATE TABLE baz.users ( + id integer NOT NULL PRIMARY KEY, + name varchar(255) NOT NULL +); + + diff --git a/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/sqlc_embed/sqlite/go/db.go b/internal/endtoend/testdata/sqlc_embed/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/sqlc_embed/sqlite/go/db.go +++ b/internal/endtoend/testdata/sqlc_embed/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_embed/sqlite/go/models.go b/internal/endtoend/testdata/sqlc_embed/sqlite/go/models.go index 2f45e7e9c2..f261202cb1 100644 --- a/internal/endtoend/testdata/sqlc_embed/sqlite/go/models.go +++ b/internal/endtoend/testdata/sqlc_embed/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_embed/sqlite/go/query.sql.go b/internal/endtoend/testdata/sqlc_embed/sqlite/go/query.sql.go index fafac02949..aafc0897a8 100644 --- a/internal/endtoend/testdata/sqlc_embed/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_embed/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_embed/sqlite/query.sql b/internal/endtoend/testdata/sqlc_embed/sqlite/query.sql index 1aa955d1ab..4b999b5629 100644 --- a/internal/endtoend/testdata/sqlc_embed/sqlite/query.sql +++ b/internal/endtoend/testdata/sqlc_embed/sqlite/query.sql @@ -1,22 +1,3 @@ -ATTACH 'baz.db' AS baz; - -CREATE TABLE users ( - id integer PRIMARY KEY, - name text NOT NULL, - age integer -); - -CREATE TABLE posts ( - id integer PRIMARY KEY, - user_id integer NOT NULL -); - -CREATE TABLE baz.users ( - id integer PRIMARY KEY, - name text NOT NULL -); - - -- name: Only :one SELECT sqlc.embed(users) FROM users; diff --git a/internal/endtoend/testdata/sqlc_embed/sqlite/schema.sql b/internal/endtoend/testdata/sqlc_embed/sqlite/schema.sql new file mode 100644 index 0000000000..a67026ba33 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/sqlite/schema.sql @@ -0,0 +1,19 @@ +ATTACH 'baz.db' AS baz; + +CREATE TABLE users ( + id integer PRIMARY KEY, + name text NOT NULL, + age integer +); + +CREATE TABLE posts ( + id integer PRIMARY KEY, + user_id integer NOT NULL +); + +CREATE TABLE baz.users ( + id integer PRIMARY KEY, + name text NOT NULL +); + + diff --git a/internal/endtoend/testdata/sqlc_embed/sqlite/sqlc.json b/internal/endtoend/testdata/sqlc_embed/sqlite/sqlc.json index bcf1050428..cd66df063b 100644 --- a/internal/endtoend/testdata/sqlc_embed/sqlite/sqlc.json +++ b/internal/endtoend/testdata/sqlc_embed/sqlite/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "sqlite", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/sqlc_narg/mysql/go/db.go b/internal/endtoend/testdata/sqlc_narg/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/sqlc_narg/mysql/go/db.go +++ b/internal/endtoend/testdata/sqlc_narg/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_narg/mysql/go/models.go b/internal/endtoend/testdata/sqlc_narg/mysql/go/models.go index 7a1056b129..040ef7a0ac 100644 --- a/internal/endtoend/testdata/sqlc_narg/mysql/go/models.go +++ b/internal/endtoend/testdata/sqlc_narg/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_narg/mysql/go/query.sql.go b/internal/endtoend/testdata/sqlc_narg/mysql/go/query.sql.go index 83515bde55..1cba711a58 100644 --- a/internal/endtoend/testdata/sqlc_narg/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_narg/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_narg/mysql/query.sql b/internal/endtoend/testdata/sqlc_narg/mysql/query.sql index 634830cbdf..103c7378b8 100644 --- a/internal/endtoend/testdata/sqlc_narg/mysql/query.sql +++ b/internal/endtoend/testdata/sqlc_narg/mysql/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar text not null, maybe_bar text); - -- name: IdentOnNonNullable :many SELECT bar FROM foo WHERE bar = sqlc.narg(bar); diff --git a/internal/endtoend/testdata/sqlc_narg/mysql/schema.sql b/internal/endtoend/testdata/sqlc_narg/mysql/schema.sql new file mode 100644 index 0000000000..787f890733 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text not null, maybe_bar text); + diff --git a/internal/endtoend/testdata/sqlc_narg/mysql/sqlc.json b/internal/endtoend/testdata/sqlc_narg/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/sqlc_narg/mysql/sqlc.json +++ b/internal/endtoend/testdata/sqlc_narg/mysql/sqlc.json @@ -5,7 +5,7 @@ "engine": "mysql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/models.go index 7a1056b129..040ef7a0ac 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/query.sql.go index c6bfe4f9af..a2cff4e894 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/query.sql index 634830cbdf..103c7378b8 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar text not null, maybe_bar text); - -- name: IdentOnNonNullable :many SELECT bar FROM foo WHERE bar = sqlc.narg(bar); diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..787f890733 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text not null, maybe_bar text); + diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/models.go index 81f62c09bc..9875c2fc16 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/query.sql.go index aa230b1fc6..21e8482afc 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/query.sql index 634830cbdf..103c7378b8 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar text not null, maybe_bar text); - -- name: IdentOnNonNullable :many SELECT bar FROM foo WHERE bar = sqlc.narg(bar); diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..787f890733 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text not null, maybe_bar text); + diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/models.go index 7a1056b129..040ef7a0ac 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/query.sql.go index be00339eae..f83af91b6b 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/db.go b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/db.go index 341078e23c..2a33033883 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/db.go +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest_strict diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/models.go b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/models.go index fa58758ce9..d8f6d919d7 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/models.go +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest_strict diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/query.sql.go b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/query.sql.go index 85ac408e00..a9126fa18f 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/query.sql.go +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest_strict diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/query.sql b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/query.sql index 634830cbdf..103c7378b8 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar text not null, maybe_bar text); - -- name: IdentOnNonNullable :many SELECT bar FROM foo WHERE bar = sqlc.narg(bar); diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..cf7329427d --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (bar text not null, maybe_bar text); \ No newline at end of file diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/sqlc.json index 0dcd7ce649..f5873c14cd 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/sqlc.json @@ -3,7 +3,7 @@ "sql": [ { "engine": "postgresql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "gen": { "go": { @@ -14,7 +14,7 @@ }, { "engine": "postgresql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "strict_function_checks": true, "gen": { diff --git a/internal/endtoend/testdata/sqlc_narg/sqlite/go/db.go b/internal/endtoend/testdata/sqlc_narg/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/sqlc_narg/sqlite/go/db.go +++ b/internal/endtoend/testdata/sqlc_narg/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_narg/sqlite/go/models.go b/internal/endtoend/testdata/sqlc_narg/sqlite/go/models.go index 7a1056b129..040ef7a0ac 100644 --- a/internal/endtoend/testdata/sqlc_narg/sqlite/go/models.go +++ b/internal/endtoend/testdata/sqlc_narg/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_narg/sqlite/go/query.sql.go b/internal/endtoend/testdata/sqlc_narg/sqlite/go/query.sql.go index 69f76c570a..c603bcd4ab 100644 --- a/internal/endtoend/testdata/sqlc_narg/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_narg/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_narg/sqlite/query.sql b/internal/endtoend/testdata/sqlc_narg/sqlite/query.sql index 634830cbdf..103c7378b8 100644 --- a/internal/endtoend/testdata/sqlc_narg/sqlite/query.sql +++ b/internal/endtoend/testdata/sqlc_narg/sqlite/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar text not null, maybe_bar text); - -- name: IdentOnNonNullable :many SELECT bar FROM foo WHERE bar = sqlc.narg(bar); diff --git a/internal/endtoend/testdata/sqlc_narg/sqlite/schema.sql b/internal/endtoend/testdata/sqlc_narg/sqlite/schema.sql new file mode 100644 index 0000000000..787f890733 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_narg/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (bar text not null, maybe_bar text); + diff --git a/internal/endtoend/testdata/sqlc_narg/sqlite/sqlc.json b/internal/endtoend/testdata/sqlc_narg/sqlite/sqlc.json index 25c6ea49a2..e63bc00cf9 100644 --- a/internal/endtoend/testdata/sqlc_narg/sqlite/sqlc.json +++ b/internal/endtoend/testdata/sqlc_narg/sqlite/sqlc.json @@ -3,7 +3,7 @@ "sql": [ { "engine": "sqlite", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "gen": { "go": { diff --git a/internal/endtoend/testdata/sqlc_slice/mysql/go/db.go b/internal/endtoend/testdata/sqlc_slice/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/sqlc_slice/mysql/go/db.go +++ b/internal/endtoend/testdata/sqlc_slice/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_slice/mysql/go/models.go b/internal/endtoend/testdata/sqlc_slice/mysql/go/models.go index f074aa6496..77be1976cf 100644 --- a/internal/endtoend/testdata/sqlc_slice/mysql/go/models.go +++ b/internal/endtoend/testdata/sqlc_slice/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_slice/mysql/go/query.sql.go b/internal/endtoend/testdata/sqlc_slice/mysql/go/query.sql.go index 4d944cd4cf..72d5617d0a 100644 --- a/internal/endtoend/testdata/sqlc_slice/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_slice/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_slice/mysql/query.sql b/internal/endtoend/testdata/sqlc_slice/mysql/query.sql index 0cc19c3385..6cf377d00d 100644 --- a/internal/endtoend/testdata/sqlc_slice/mysql/query.sql +++ b/internal/endtoend/testdata/sqlc_slice/mysql/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (id int not null, name text not null, bar text null, mystr text not null); - /* name: FuncParamIdent :many */ SELECT name FROM foo WHERE name = sqlc.arg(slug) diff --git a/internal/endtoend/testdata/sqlc_slice/mysql/schema.sql b/internal/endtoend/testdata/sqlc_slice/mysql/schema.sql new file mode 100644 index 0000000000..9a803f2de4 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id int not null, name text not null, bar text null, mystr text not null); + diff --git a/internal/endtoend/testdata/sqlc_slice/mysql/sqlc.json b/internal/endtoend/testdata/sqlc_slice/mysql/sqlc.json index 56d891c6e7..cd360d69a0 100644 --- a/internal/endtoend/testdata/sqlc_slice/mysql/sqlc.json +++ b/internal/endtoend/testdata/sqlc_slice/mysql/sqlc.json @@ -5,7 +5,7 @@ "engine": "mysql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ], diff --git a/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/db.go b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/db.go +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/models.go b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/models.go index 60a7e7ea71..eeaab97b8d 100644 --- a/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/models.go +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/models.go @@ -1,11 +1,10 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { + ID int32 Name string } diff --git a/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/query.sql.go index 25bab121c3..2def271737 100644 --- a/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -11,10 +11,16 @@ import ( const funcParamIdent = `-- name: FuncParamIdent :many SELECT name FROM foo WHERE name = $1 + AND id IN ($2) ` -func (q *Queries) FuncParamIdent(ctx context.Context, slug string) ([]string, error) { - rows, err := q.db.Query(ctx, funcParamIdent, slug) +type FuncParamIdentParams struct { + Slug string + Favourites []int32 +} + +func (q *Queries) FuncParamIdent(ctx context.Context, arg FuncParamIdentParams) ([]string, error) { + rows, err := q.db.Query(ctx, funcParamIdent, arg.Slug, arg.Favourites) if err != nil { return nil, err } @@ -35,10 +41,16 @@ func (q *Queries) FuncParamIdent(ctx context.Context, slug string) ([]string, er const funcParamString = `-- name: FuncParamString :many SELECT name FROM foo WHERE name = $1 + AND id IN ($2) ` -func (q *Queries) FuncParamString(ctx context.Context, slug string) ([]string, error) { - rows, err := q.db.Query(ctx, funcParamString, slug) +type FuncParamStringParams struct { + Slug string + Favourites []int32 +} + +func (q *Queries) FuncParamString(ctx context.Context, arg FuncParamStringParams) ([]string, error) { + rows, err := q.db.Query(ctx, funcParamString, arg.Slug, arg.Favourites) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/query.sql b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/query.sql index 9a8e98e223..2a5fccf1fc 100644 --- a/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/query.sql +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/query.sql @@ -1,7 +1,7 @@ -CREATE TABLE foo (name text not null); - -- name: FuncParamIdent :many -SELECT name FROM foo WHERE name = sqlc.arg(slug); +SELECT name FROM foo WHERE name = sqlc.arg(slug) + AND id IN (sqlc.slice(favourites)); -- name: FuncParamString :many -SELECT name FROM foo WHERE name = sqlc.arg('slug'); +SELECT name FROM foo WHERE name = sqlc.arg('slug') + AND id IN (sqlc.slice('favourites')); diff --git a/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/schema.sql b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..43e6433e30 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id int not null, name text not null); + diff --git a/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/sqlc.json b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/sqlc.json +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/models.go index 43d5fbb255..eeaab97b8d 100644 --- a/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { ID int32 Name string diff --git a/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/query.sql.go index 241df7a9be..4463788192 100644 --- a/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/query.sql b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/query.sql index 4881393431..3c762d3bc8 100644 --- a/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (id int not null, name text not null); - /* name: FuncParamIdent :many */ SELECT name FROM foo WHERE name = sqlc.arg(slug) diff --git a/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..43e6433e30 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id int not null, name text not null); + diff --git a/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/sqlc.json index de427d069f..cd518671ac 100644 --- a/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "engine": "postgresql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/sqlc_slice/sqlite/go/db.go b/internal/endtoend/testdata/sqlc_slice/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/sqlc_slice/sqlite/go/db.go +++ b/internal/endtoend/testdata/sqlc_slice/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_slice/sqlite/go/models.go b/internal/endtoend/testdata/sqlc_slice/sqlite/go/models.go index 1490d65f0a..392b1ce49b 100644 --- a/internal/endtoend/testdata/sqlc_slice/sqlite/go/models.go +++ b/internal/endtoend/testdata/sqlc_slice/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_slice/sqlite/go/query.sql.go b/internal/endtoend/testdata/sqlc_slice/sqlite/go/query.sql.go index 4f87b49c57..ff3ae7f5ff 100644 --- a/internal/endtoend/testdata/sqlc_slice/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_slice/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_slice/sqlite/query.sql b/internal/endtoend/testdata/sqlc_slice/sqlite/query.sql index dec071ffd0..710341e4c8 100644 --- a/internal/endtoend/testdata/sqlc_slice/sqlite/query.sql +++ b/internal/endtoend/testdata/sqlc_slice/sqlite/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (id int not null, name text not null, bar text); - /* name: FuncParamIdent :many */ SELECT name FROM foo WHERE name = sqlc.arg(slug) diff --git a/internal/endtoend/testdata/sqlc_slice/sqlite/schema.sql b/internal/endtoend/testdata/sqlc_slice/sqlite/schema.sql new file mode 100644 index 0000000000..b01b6f5800 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id int not null, name text not null, bar text); + diff --git a/internal/endtoend/testdata/sqlc_slice/sqlite/sqlc.json b/internal/endtoend/testdata/sqlc_slice/sqlite/sqlc.json index fc58be5b0d..1f9d43df5d 100644 --- a/internal/endtoend/testdata/sqlc_slice/sqlite/sqlc.json +++ b/internal/endtoend/testdata/sqlc_slice/sqlite/sqlc.json @@ -5,7 +5,7 @@ "engine": "sqlite", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/db.go b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/db.go index d38ee8ce1d..f4a04e4acd 100644 --- a/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/db.go +++ b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/models.go b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/models.go index 1490d65f0a..392b1ce49b 100644 --- a/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/models.go +++ b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/query.sql.go b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/query.sql.go index d50e1c87fb..af519ba1e8 100644 --- a/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/query.sql b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/query.sql index fd2440c3a7..57b98577e1 100644 --- a/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/query.sql +++ b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (id int not null, name text not null, bar text); - /* name: FuncParamIdent :many */ SELECT name FROM foo WHERE name = sqlc.arg(slug) diff --git a/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/schema.sql b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/schema.sql new file mode 100644 index 0000000000..b01b6f5800 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id int not null, name text not null, bar text); + diff --git a/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/sqlc.json b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/sqlc.json index 4c29b7e7ab..fcb534e05d 100644 --- a/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/sqlc.json +++ b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/sqlc.json @@ -5,7 +5,7 @@ "engine": "sqlite", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_prepared_queries": true } diff --git a/internal/endtoend/testdata/sqlite_skip_todo/db/db.go b/internal/endtoend/testdata/sqlite_skip_todo/db/db.go new file mode 100644 index 0000000000..cd5bbb8e08 --- /dev/null +++ b/internal/endtoend/testdata/sqlite_skip_todo/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/sqlite_skip_todo/db/models.go b/internal/endtoend/testdata/sqlite_skip_todo/db/models.go new file mode 100644 index 0000000000..69bf4b51b6 --- /dev/null +++ b/internal/endtoend/testdata/sqlite_skip_todo/db/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package db + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullString +} diff --git a/internal/endtoend/testdata/sqlite_skip_todo/db/query.sql.go b/internal/endtoend/testdata/sqlite_skip_todo/db/query.sql.go new file mode 100644 index 0000000000..5bc1ee784c --- /dev/null +++ b/internal/endtoend/testdata/sqlite_skip_todo/db/query.sql.go @@ -0,0 +1,66 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package db + +import ( + "context" + "database/sql" +) + +const getFoo = `-- name: GetFoo :many +SELECT bar FROM foo +WHERE bar = ? +` + +func (q *Queries) GetFoo(ctx context.Context, bar sql.NullString) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, getFoo, bar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var bar sql.NullString + if err := rows.Scan(&bar); err != nil { + return nil, err + } + items = append(items, bar) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listFoo = `-- name: ListFoo :many +SELECT bar FROM foo +` + +func (q *Queries) ListFoo(ctx context.Context) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, listFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var bar sql.NullString + if err := rows.Scan(&bar); err != nil { + return nil, err + } + items = append(items, bar) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/sqlite_skip_todo/query.sql b/internal/endtoend/testdata/sqlite_skip_todo/query.sql new file mode 100644 index 0000000000..e51c45c8c1 --- /dev/null +++ b/internal/endtoend/testdata/sqlite_skip_todo/query.sql @@ -0,0 +1,16 @@ +-- name: PragmaForeignKeysEnable :exec +PRAGMA foreign_keys = 1; + +-- name: ListFoo :many +SELECT * FROM foo; + +-- name: PragmaForeignKeysDisable :exec +PRAGMA foreign_keys = 0; + +-- name: PragmaForeignKeysGet :one +PRAGMA foreign_keys; + +-- name: GetFoo :many +SELECT * FROM foo +WHERE bar = ?; + diff --git a/internal/endtoend/testdata/sqlite_skip_todo/schema.sql b/internal/endtoend/testdata/sqlite_skip_todo/schema.sql new file mode 100644 index 0000000000..010d09e16f --- /dev/null +++ b/internal/endtoend/testdata/sqlite_skip_todo/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo ( + bar text +); diff --git a/internal/endtoend/testdata/sqlite_skip_todo/sqlc.json b/internal/endtoend/testdata/sqlite_skip_todo/sqlc.json new file mode 100644 index 0000000000..cbd787d930 --- /dev/null +++ b/internal/endtoend/testdata/sqlite_skip_todo/sqlc.json @@ -0,0 +1,16 @@ +{ + "version": "2", + "sql": [ + { + "engine": "sqlite", + "queries": "query.sql", + "schema": "schema.sql", + "gen": { + "go": { + "package": "db", + "out": "db" + } + } + } + ] +} diff --git a/internal/endtoend/testdata/sqlite_table_options/sqlite/go/db.go b/internal/endtoend/testdata/sqlite_table_options/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/sqlite_table_options/sqlite/go/db.go +++ b/internal/endtoend/testdata/sqlite_table_options/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlite_table_options/sqlite/go/models.go b/internal/endtoend/testdata/sqlite_table_options/sqlite/go/models.go index 511d959cb0..9a7d98ae0c 100644 --- a/internal/endtoend/testdata/sqlite_table_options/sqlite/go/models.go +++ b/internal/endtoend/testdata/sqlite_table_options/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/sqlite_table_options/sqlite/go/query.sql.go b/internal/endtoend/testdata/sqlite_table_options/sqlite/go/query.sql.go index 4a0b107b70..a805253f1b 100644 --- a/internal/endtoend/testdata/sqlite_table_options/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/sqlite_table_options/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlite_table_options/sqlite/query.sql b/internal/endtoend/testdata/sqlite_table_options/sqlite/query.sql index d54bfdfe73..749f91601d 100644 --- a/internal/endtoend/testdata/sqlite_table_options/sqlite/query.sql +++ b/internal/endtoend/testdata/sqlite_table_options/sqlite/query.sql @@ -1,27 +1,3 @@ -CREATE TABLE authors1 ( - id INTEGER PRIMARY KEY, - name text NOT NULL, - bio text -) STRICT, WITHOUT ROWID; - -CREATE TABLE authors2 ( - id INTEGER PRIMARY KEY, - name text NOT NULL, - bio text -) WITHOUT ROWID, STRICT; - -CREATE TABLE authors3 ( - id INTEGER PRIMARY KEY, - name text NOT NULL, - bio text -) WITHOUT ROWID; - -CREATE TABLE authors4 ( - id INTEGER PRIMARY KEY, - name text NOT NULL, - bio text -) STRICT; - -- name: GetAuthor :one SELECT * FROM authors1 WHERE id = ?1 LIMIT 1; diff --git a/internal/endtoend/testdata/sqlite_table_options/sqlite/schema.sql b/internal/endtoend/testdata/sqlite_table_options/sqlite/schema.sql new file mode 100644 index 0000000000..bb0741a8e3 --- /dev/null +++ b/internal/endtoend/testdata/sqlite_table_options/sqlite/schema.sql @@ -0,0 +1,24 @@ +CREATE TABLE authors1 ( + id INTEGER PRIMARY KEY, + name text NOT NULL, + bio text +) STRICT, WITHOUT ROWID; + +CREATE TABLE authors2 ( + id INTEGER PRIMARY KEY, + name text NOT NULL, + bio text +) WITHOUT ROWID, STRICT; + +CREATE TABLE authors3 ( + id INTEGER PRIMARY KEY, + name text NOT NULL, + bio text +) WITHOUT ROWID; + +CREATE TABLE authors4 ( + id INTEGER PRIMARY KEY, + name text NOT NULL, + bio text +) STRICT; + diff --git a/internal/endtoend/testdata/sqlite_table_options/sqlite/sqlc.json b/internal/endtoend/testdata/sqlite_table_options/sqlite/sqlc.json index 3ed5eea856..ea4a23425f 100644 --- a/internal/endtoend/testdata/sqlite_table_options/sqlite/sqlc.json +++ b/internal/endtoend/testdata/sqlite_table_options/sqlite/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "engine": "sqlite", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "name": "querytest" } diff --git a/internal/endtoend/testdata/star_expansion/mysql/go/db.go b/internal/endtoend/testdata/star_expansion/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/star_expansion/mysql/go/db.go +++ b/internal/endtoend/testdata/star_expansion/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion/mysql/go/models.go b/internal/endtoend/testdata/star_expansion/mysql/go/models.go index bd0fa15100..de35bade9f 100644 --- a/internal/endtoend/testdata/star_expansion/mysql/go/models.go +++ b/internal/endtoend/testdata/star_expansion/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion/mysql/go/query.sql.go b/internal/endtoend/testdata/star_expansion/mysql/go/query.sql.go index 236f756cc2..0f1f3f6658 100644 --- a/internal/endtoend/testdata/star_expansion/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion/mysql/query.sql b/internal/endtoend/testdata/star_expansion/mysql/query.sql index 4515ce46e6..2461d01236 100644 --- a/internal/endtoend/testdata/star_expansion/mysql/query.sql +++ b/internal/endtoend/testdata/star_expansion/mysql/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (a text, b text); - /* name: StarExpansion :many */ SELECT *, *, foo.* FROM foo; diff --git a/internal/endtoend/testdata/star_expansion/mysql/schema.sql b/internal/endtoend/testdata/star_expansion/mysql/schema.sql new file mode 100644 index 0000000000..a68a0e4de0 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); + diff --git a/internal/endtoend/testdata/star_expansion/mysql/sqlc.json b/internal/endtoend/testdata/star_expansion/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/star_expansion/mysql/sqlc.json +++ b/internal/endtoend/testdata/star_expansion/mysql/sqlc.json @@ -5,7 +5,7 @@ "engine": "mysql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/models.go index bd0fa15100..de35bade9f 100644 --- a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/query.sql.go index a7ac000d70..f3e0c2094b 100644 --- a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/query.sql index 77ef29f8e7..9588332d88 100644 --- a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (a text, b text); - -- name: StarExpansion :many SELECT *, *, foo.* FROM foo; diff --git a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..a68a0e4de0 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); + diff --git a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/models.go index fa800a9a15..3ee86d8810 100644 --- a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/query.sql.go index 1acdbb1c53..f30529e266 100644 --- a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/query.sql index 77ef29f8e7..9588332d88 100644 --- a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (a text, b text); - -- name: StarExpansion :many SELECT *, *, foo.* FROM foo; diff --git a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..a68a0e4de0 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); + diff --git a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/models.go index bd0fa15100..de35bade9f 100644 --- a/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/query.sql.go index f3c21bb7b7..a9484ac78f 100644 --- a/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion/postgresql/stdlib/query.sql b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/query.sql index 77ef29f8e7..9588332d88 100644 --- a/internal/endtoend/testdata/star_expansion/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (a text, b text); - -- name: StarExpansion :many SELECT *, *, foo.* FROM foo; diff --git a/internal/endtoend/testdata/star_expansion/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..a68a0e4de0 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); + diff --git a/internal/endtoend/testdata/star_expansion/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/sqlc.json index de427d069f..cd518671ac 100644 --- a/internal/endtoend/testdata/star_expansion/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "engine": "postgresql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/star_expansion/sqlite/go/db.go b/internal/endtoend/testdata/star_expansion/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/star_expansion/sqlite/go/db.go +++ b/internal/endtoend/testdata/star_expansion/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion/sqlite/go/models.go b/internal/endtoend/testdata/star_expansion/sqlite/go/models.go index bd0fa15100..de35bade9f 100644 --- a/internal/endtoend/testdata/star_expansion/sqlite/go/models.go +++ b/internal/endtoend/testdata/star_expansion/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion/sqlite/go/query.sql.go b/internal/endtoend/testdata/star_expansion/sqlite/go/query.sql.go index f3c21bb7b7..a9484ac78f 100644 --- a/internal/endtoend/testdata/star_expansion/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion/sqlite/query.sql b/internal/endtoend/testdata/star_expansion/sqlite/query.sql index 6cc8506280..6249bb48b7 100644 --- a/internal/endtoend/testdata/star_expansion/sqlite/query.sql +++ b/internal/endtoend/testdata/star_expansion/sqlite/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (a text, b text); - -- name: StarExpansion :many SELECT *, *, foo.* FROM foo; diff --git a/internal/endtoend/testdata/star_expansion/sqlite/schema.sql b/internal/endtoend/testdata/star_expansion/sqlite/schema.sql new file mode 100644 index 0000000000..a68a0e4de0 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); + diff --git a/internal/endtoend/testdata/star_expansion/sqlite/sqlc.json b/internal/endtoend/testdata/star_expansion/sqlite/sqlc.json index fc58be5b0d..1f9d43df5d 100644 --- a/internal/endtoend/testdata/star_expansion/sqlite/sqlc.json +++ b/internal/endtoend/testdata/star_expansion/sqlite/sqlc.json @@ -5,7 +5,7 @@ "engine": "sqlite", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/db.go b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/models.go b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/models.go index d38098e5d7..ba8c0a9c1d 100644 --- a/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/query.sql.go index 892754dba8..897f99f876 100644 --- a/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_cte/pgx/v4/query.sql b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/query.sql index 5be315bfad..d7fb4cfa92 100644 --- a/internal/endtoend/testdata/star_expansion_cte/pgx/v4/query.sql +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE foo (a text, b text); -CREATE TABLE bar (c text, d text); - -- name: StarExpansionCTE :many WITH cte AS (SELECT * FROM foo) SELECT * FROM bar; diff --git a/internal/endtoend/testdata/star_expansion_cte/pgx/v4/schema.sql b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/schema.sql new file mode 100644 index 0000000000..423ca3dd1e --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (c text, d text); + diff --git a/internal/endtoend/testdata/star_expansion_cte/pgx/v4/sqlc.json b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/star_expansion_cte/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/db.go b/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/models.go b/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/models.go index c959615772..0df50c9ca2 100644 --- a/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/query.sql.go index 5efa43c5f1..cb49d0ecca 100644 --- a/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_cte/pgx/v5/query.sql b/internal/endtoend/testdata/star_expansion_cte/pgx/v5/query.sql index 5be315bfad..d7fb4cfa92 100644 --- a/internal/endtoend/testdata/star_expansion_cte/pgx/v5/query.sql +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v5/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE foo (a text, b text); -CREATE TABLE bar (c text, d text); - -- name: StarExpansionCTE :many WITH cte AS (SELECT * FROM foo) SELECT * FROM bar; diff --git a/internal/endtoend/testdata/star_expansion_cte/pgx/v5/schema.sql b/internal/endtoend/testdata/star_expansion_cte/pgx/v5/schema.sql new file mode 100644 index 0000000000..423ca3dd1e --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v5/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (c text, d text); + diff --git a/internal/endtoend/testdata/star_expansion_cte/pgx/v5/sqlc.json b/internal/endtoend/testdata/star_expansion_cte/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/star_expansion_cte/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/star_expansion_cte/stdlib/go/db.go b/internal/endtoend/testdata/star_expansion_cte/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/star_expansion_cte/stdlib/go/db.go +++ b/internal/endtoend/testdata/star_expansion_cte/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_cte/stdlib/go/models.go b/internal/endtoend/testdata/star_expansion_cte/stdlib/go/models.go index d38098e5d7..ba8c0a9c1d 100644 --- a/internal/endtoend/testdata/star_expansion_cte/stdlib/go/models.go +++ b/internal/endtoend/testdata/star_expansion_cte/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_cte/stdlib/go/query.sql.go b/internal/endtoend/testdata/star_expansion_cte/stdlib/go/query.sql.go index cf95d167cb..b9de05170d 100644 --- a/internal/endtoend/testdata/star_expansion_cte/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_cte/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_cte/stdlib/query.sql b/internal/endtoend/testdata/star_expansion_cte/stdlib/query.sql index 5be315bfad..d7fb4cfa92 100644 --- a/internal/endtoend/testdata/star_expansion_cte/stdlib/query.sql +++ b/internal/endtoend/testdata/star_expansion_cte/stdlib/query.sql @@ -1,6 +1,3 @@ -CREATE TABLE foo (a text, b text); -CREATE TABLE bar (c text, d text); - -- name: StarExpansionCTE :many WITH cte AS (SELECT * FROM foo) SELECT * FROM bar; diff --git a/internal/endtoend/testdata/star_expansion_cte/stdlib/schema.sql b/internal/endtoend/testdata/star_expansion_cte/stdlib/schema.sql new file mode 100644 index 0000000000..423ca3dd1e --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_cte/stdlib/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (c text, d text); + diff --git a/internal/endtoend/testdata/star_expansion_cte/stdlib/sqlc.json b/internal/endtoend/testdata/star_expansion_cte/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/star_expansion_cte/stdlib/sqlc.json +++ b/internal/endtoend/testdata/star_expansion_cte/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/exec.json b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/go/db.go b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/go/models.go b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..53c5c498a6 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Version struct { + ID int64 + Name pgtype.Text + PreviousVersionID int64 +} diff --git a/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..490760a235 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/go/query.sql.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getLatestVersionWithSubquery = `-- name: GetLatestVersionWithSubquery :one +SELECT * +FROM versions +WHERE versions.id IN ( + WITH RECURSIVE search_tree(id) AS ( + SELECT id, 0 as chain_id, 0 as chain_counter + FROM versions + ) + SELECT DISTINCT ON (search_tree.chain_id) + search_tree.id + FROM search_tree + ORDER BY search_tree.chain_id, chain_counter DESC +) +` + +func (q *Queries) GetLatestVersionWithSubquery(ctx context.Context) (Version, error) { + row := q.db.QueryRow(ctx, getLatestVersionWithSubquery) + var i Version + err := row.Scan(&i.ID, &i.Name, &i.PreviousVersionID) + return i, err +} diff --git a/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/query.sql b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/query.sql new file mode 100644 index 0000000000..4a667243fd --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/query.sql @@ -0,0 +1,13 @@ +-- name: GetLatestVersionWithSubquery :one +SELECT * +FROM versions +WHERE versions.id IN ( + WITH RECURSIVE search_tree(id) AS ( + SELECT id, 0 as chain_id, 0 as chain_counter + FROM versions + ) + SELECT DISTINCT ON (search_tree.chain_id) + search_tree.id + FROM search_tree + ORDER BY search_tree.chain_id, chain_counter DESC +); diff --git a/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/schema.sql b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..1825de4f8f --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/schema.sql @@ -0,0 +1,6 @@ +-- Example queries for sqlc +CREATE TABLE versions ( + id BIGSERIAL PRIMARY KEY, + name TEXT, + previous_version_id bigint NOT NULL +); diff --git a/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/stderr.txt b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/stderr.txt new file mode 100644 index 0000000000..2a064b8184 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/stderr.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:1:1: star expansion failed for query diff --git a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/db.go b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/models.go b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/models.go index d38098e5d7..ba8c0a9c1d 100644 --- a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/query.sql.go index 515779748b..bff7a6caac 100644 --- a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/query.sql b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/query.sql index 347be0ce69..f91c7b7472 100644 --- a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/query.sql +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (a text, b text); -CREATE TABLE bar (c text, d text); -- name: StarExpansionCTE :many WITH cte AS (SELECT * FROM foo) SELECT * FROM cte; diff --git a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/schema.sql b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/schema.sql new file mode 100644 index 0000000000..786c5b6dd2 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (c text, d text); diff --git a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/sqlc.json b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/db.go b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/models.go b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/models.go index c959615772..0df50c9ca2 100644 --- a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/query.sql.go index 2c21522d96..e4fa778124 100644 --- a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/query.sql b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/query.sql index 347be0ce69..f91c7b7472 100644 --- a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/query.sql +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (a text, b text); -CREATE TABLE bar (c text, d text); -- name: StarExpansionCTE :many WITH cte AS (SELECT * FROM foo) SELECT * FROM cte; diff --git a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/schema.sql b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/schema.sql new file mode 100644 index 0000000000..786c5b6dd2 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (c text, d text); diff --git a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/sqlc.json b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/db.go b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/db.go +++ b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/models.go b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/models.go index d38098e5d7..ba8c0a9c1d 100644 --- a/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/models.go +++ b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/query.sql.go b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/query.sql.go index a4a6fed9f0..7dd824b9d0 100644 --- a/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_from_cte/stdlib/query.sql b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/query.sql index 347be0ce69..f91c7b7472 100644 --- a/internal/endtoend/testdata/star_expansion_from_cte/stdlib/query.sql +++ b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (a text, b text); -CREATE TABLE bar (c text, d text); -- name: StarExpansionCTE :many WITH cte AS (SELECT * FROM foo) SELECT * FROM cte; diff --git a/internal/endtoend/testdata/star_expansion_from_cte/stdlib/schema.sql b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/schema.sql new file mode 100644 index 0000000000..786c5b6dd2 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (c text, d text); diff --git a/internal/endtoend/testdata/star_expansion_from_cte/stdlib/sqlc.json b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/star_expansion_from_cte/stdlib/sqlc.json +++ b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/star_expansion_join/mysql/go/db.go b/internal/endtoend/testdata/star_expansion_join/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/star_expansion_join/mysql/go/db.go +++ b/internal/endtoend/testdata/star_expansion_join/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_join/mysql/go/models.go b/internal/endtoend/testdata/star_expansion_join/mysql/go/models.go index d38098e5d7..ba8c0a9c1d 100644 --- a/internal/endtoend/testdata/star_expansion_join/mysql/go/models.go +++ b/internal/endtoend/testdata/star_expansion_join/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_join/mysql/go/query.sql.go b/internal/endtoend/testdata/star_expansion_join/mysql/go/query.sql.go index 330c67cead..6bbaa96959 100644 --- a/internal/endtoend/testdata/star_expansion_join/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_join/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_join/mysql/query.sql b/internal/endtoend/testdata/star_expansion_join/mysql/query.sql index 1f0b2377bc..02da113914 100644 --- a/internal/endtoend/testdata/star_expansion_join/mysql/query.sql +++ b/internal/endtoend/testdata/star_expansion_join/mysql/query.sql @@ -1,5 +1,2 @@ -CREATE TABLE foo (a text, b text); -CREATE TABLE bar (c text, d text); - /* name: StarExpansionJoin :many */ SELECT * FROM foo, bar; diff --git a/internal/endtoend/testdata/star_expansion_join/mysql/schema.sql b/internal/endtoend/testdata/star_expansion_join/mysql/schema.sql new file mode 100644 index 0000000000..423ca3dd1e --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_join/mysql/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (c text, d text); + diff --git a/internal/endtoend/testdata/star_expansion_join/mysql/sqlc.json b/internal/endtoend/testdata/star_expansion_join/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/star_expansion_join/mysql/sqlc.json +++ b/internal/endtoend/testdata/star_expansion_join/mysql/sqlc.json @@ -5,7 +5,7 @@ "engine": "mysql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/models.go index d38098e5d7..ba8c0a9c1d 100644 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/query.sql.go index 85a8696dc2..7d631caa11 100644 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/query.sql index 9234796c0e..9322d7b413 100644 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (a text, b text); -CREATE TABLE bar (c text, d text); -- name: StarExpansionJoin :many SELECT * FROM foo, bar; diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..786c5b6dd2 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (c text, d text); diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/models.go index c959615772..0df50c9ca2 100644 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/query.sql.go index 8220f9de26..52832a0fa9 100644 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/query.sql index 9234796c0e..9322d7b413 100644 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (a text, b text); -CREATE TABLE bar (c text, d text); -- name: StarExpansionJoin :many SELECT * FROM foo, bar; diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..786c5b6dd2 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (c text, d text); diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/models.go index d38098e5d7..ba8c0a9c1d 100644 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/query.sql.go index 330c67cead..6bbaa96959 100644 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/query.sql b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/query.sql index 9234796c0e..9322d7b413 100644 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (a text, b text); -CREATE TABLE bar (c text, d text); -- name: StarExpansionJoin :many SELECT * FROM foo, bar; diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..786c5b6dd2 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); +CREATE TABLE bar (c text, d text); diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/sqlc.json index de427d069f..cd518671ac 100644 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "engine": "postgresql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/star_expansion_reserved/mysql/go/db.go b/internal/endtoend/testdata/star_expansion_reserved/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/mysql/go/db.go +++ b/internal/endtoend/testdata/star_expansion_reserved/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_reserved/mysql/go/models.go b/internal/endtoend/testdata/star_expansion_reserved/mysql/go/models.go index 607ecae53e..7d67becd1c 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/mysql/go/models.go +++ b/internal/endtoend/testdata/star_expansion_reserved/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_reserved/mysql/go/query.sql.go b/internal/endtoend/testdata/star_expansion_reserved/mysql/go/query.sql.go index 7fdc7c9a7d..d644aa972b 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_reserved/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_reserved/mysql/query.sql b/internal/endtoend/testdata/star_expansion_reserved/mysql/query.sql index d7a5672d7a..e4cad82754 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/mysql/query.sql +++ b/internal/endtoend/testdata/star_expansion_reserved/mysql/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (`group` text, `key` text); - /* name: StarExpansionReserved :many */ SELECT * FROM foo; diff --git a/internal/endtoend/testdata/star_expansion_reserved/mysql/schema.sql b/internal/endtoend/testdata/star_expansion_reserved/mysql/schema.sql new file mode 100644 index 0000000000..b3408491eb --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_reserved/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (`group` text, `key` text); + diff --git a/internal/endtoend/testdata/star_expansion_reserved/mysql/sqlc.json b/internal/endtoend/testdata/star_expansion_reserved/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/mysql/sqlc.json +++ b/internal/endtoend/testdata/star_expansion_reserved/mysql/sqlc.json @@ -5,7 +5,7 @@ "engine": "mysql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/models.go index 607ecae53e..7d67becd1c 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/query.sql.go index 707da6cc40..4fa961bbc6 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/query.sql index 6efc2efc01..a97dd94b98 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/query.sql @@ -1,3 +1,2 @@ -CREATE TABLE foo ("group" text, key text); -- name: StarExpansionReserved :many SELECT * FROM foo; diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..ba3ec0b513 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo ("group" text, key text); diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/models.go index 3a66cc6236..526beb2de2 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/query.sql.go index 707da6cc40..4fa961bbc6 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/query.sql index 6efc2efc01..a97dd94b98 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/query.sql @@ -1,3 +1,2 @@ -CREATE TABLE foo ("group" text, key text); -- name: StarExpansionReserved :many SELECT * FROM foo; diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..ba3ec0b513 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo ("group" text, key text); diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/models.go index 607ecae53e..7d67becd1c 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/query.sql.go index f3cb141420..bbc49099eb 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/query.sql b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/query.sql index 6efc2efc01..a97dd94b98 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/query.sql @@ -1,3 +1,2 @@ -CREATE TABLE foo ("group" text, key text); -- name: StarExpansionReserved :many SELECT * FROM foo; diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..ba3ec0b513 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo ("group" text, key text); diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/sqlc.json index de427d069f..cd518671ac 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "engine": "postgresql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/star_expansion_series/issue.md b/internal/endtoend/testdata/star_expansion_series/issue.md new file mode 100644 index 0000000000..72e3e3aa9f --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_series/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1995 diff --git a/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/go/db.go b/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/go/models.go b/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..1551cdb9d1 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Alertreport struct { + Eventdate pgtype.Date +} diff --git a/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..ffd6da5afc --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/go/query.sql.go @@ -0,0 +1,56 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const countAlertReportBy = `-- name: CountAlertReportBy :many +select DATE_TRUNC($1,ts)::text as datetime,coalesce(count,0) as count from +( + SELECT DATE_TRUNC($1,eventdate) as hr ,count(*) + FROM alertreport + where eventdate between $2 and $3 + GROUP BY 1 +) AS cnt +right outer join ( SELECT ts FROM generate_series ( $2, $3, CONCAT('1 ',$1)::interval) AS ts ) as dte +on DATE_TRUNC($1, ts ) = cnt.hr +order by 1 asc +` + +type CountAlertReportByParams struct { + DateTrunc string + Eventdate pgtype.Date + Eventdate_2 pgtype.Date +} + +type CountAlertReportByRow struct { + Datetime string + Count int64 +} + +func (q *Queries) CountAlertReportBy(ctx context.Context, arg CountAlertReportByParams) ([]CountAlertReportByRow, error) { + rows, err := q.db.Query(ctx, countAlertReportBy, arg.DateTrunc, arg.Eventdate, arg.Eventdate_2) + if err != nil { + return nil, err + } + defer rows.Close() + var items []CountAlertReportByRow + for rows.Next() { + var i CountAlertReportByRow + if err := rows.Scan(&i.Datetime, &i.Count); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/query.sql b/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/query.sql new file mode 100644 index 0000000000..df13ae9a96 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/query.sql @@ -0,0 +1,11 @@ +-- name: CountAlertReportBy :many +select DATE_TRUNC($1,ts)::text as datetime,coalesce(count,0) as count from +( + SELECT DATE_TRUNC($1,eventdate) as hr ,count(*) + FROM alertreport + where eventdate between $2 and $3 + GROUP BY 1 +) AS cnt +right outer join ( SELECT * FROM generate_series ( $2, $3, CONCAT('1 ',$1)::interval) AS ts ) as dte +on DATE_TRUNC($1, ts ) = cnt.hr +order by 1 asc; diff --git a/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/schema.sql b/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..533757a462 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE alertreport ( + eventdate date +); diff --git a/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/star_expansion_subquery/mysql/go/db.go b/internal/endtoend/testdata/star_expansion_subquery/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/mysql/go/db.go +++ b/internal/endtoend/testdata/star_expansion_subquery/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_subquery/mysql/go/models.go b/internal/endtoend/testdata/star_expansion_subquery/mysql/go/models.go index bd0fa15100..de35bade9f 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/mysql/go/models.go +++ b/internal/endtoend/testdata/star_expansion_subquery/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_subquery/mysql/go/query.sql.go b/internal/endtoend/testdata/star_expansion_subquery/mysql/go/query.sql.go index caa5b7cff2..f00d659c95 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_subquery/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_subquery/mysql/query.sql b/internal/endtoend/testdata/star_expansion_subquery/mysql/query.sql index 2237338679..0b66b9ee97 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/mysql/query.sql +++ b/internal/endtoend/testdata/star_expansion_subquery/mysql/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (a text, b text); - /* name: StarExpansionSubquery :many */ SELECT * FROM foo WHERE EXISTS (SELECT * FROM foo); diff --git a/internal/endtoend/testdata/star_expansion_subquery/mysql/schema.sql b/internal/endtoend/testdata/star_expansion_subquery/mysql/schema.sql new file mode 100644 index 0000000000..a68a0e4de0 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_subquery/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); + diff --git a/internal/endtoend/testdata/star_expansion_subquery/mysql/sqlc.json b/internal/endtoend/testdata/star_expansion_subquery/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/mysql/sqlc.json +++ b/internal/endtoend/testdata/star_expansion_subquery/mysql/sqlc.json @@ -5,7 +5,7 @@ "engine": "mysql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/models.go index bd0fa15100..de35bade9f 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/query.sql.go index 9104f3064a..eee7e0b9a5 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/query.sql index d06367d8cd..53110a5ee8 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (a text, b text); - -- name: StarExpansionSubquery :many SELECT * FROM foo WHERE EXISTS (SELECT * FROM foo); diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..a68a0e4de0 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); + diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/models.go index fa800a9a15..3ee86d8810 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/query.sql.go index 9104f3064a..eee7e0b9a5 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/query.sql index d06367d8cd..53110a5ee8 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (a text, b text); - -- name: StarExpansionSubquery :many SELECT * FROM foo WHERE EXISTS (SELECT * FROM foo); diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..a68a0e4de0 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); + diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/models.go index bd0fa15100..de35bade9f 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/query.sql.go index caa5b7cff2..f00d659c95 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/query.sql b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/query.sql index d06367d8cd..53110a5ee8 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (a text, b text); - -- name: StarExpansionSubquery :many SELECT * FROM foo WHERE EXISTS (SELECT * FROM foo); diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..a68a0e4de0 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a text, b text); + diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/sqlc.json index de427d069f..cd518671ac 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "engine": "postgresql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/strict_function_checks/postgresql/schema.sql b/internal/endtoend/testdata/strict_function_checks/postgresql/schema.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/endtoend/testdata/strict_function_checks/postgresql/sqlc.json b/internal/endtoend/testdata/strict_function_checks/postgresql/sqlc.json index 935bb9f278..6cb9103c1a 100644 --- a/internal/endtoend/testdata/strict_function_checks/postgresql/sqlc.json +++ b/internal/endtoend/testdata/strict_function_checks/postgresql/sqlc.json @@ -4,7 +4,7 @@ { "name": "querytest", "path": "go", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "engine": "postgresql", "strict_function_checks": true diff --git a/internal/endtoend/testdata/strict_function_checks/postgresql/stderr.txt b/internal/endtoend/testdata/strict_function_checks/postgresql/stderr/base.txt similarity index 100% rename from internal/endtoend/testdata/strict_function_checks/postgresql/stderr.txt rename to internal/endtoend/testdata/strict_function_checks/postgresql/stderr/base.txt diff --git a/internal/endtoend/testdata/strict_function_checks/postgresql/stderr/managed-db.txt b/internal/endtoend/testdata/strict_function_checks/postgresql/stderr/managed-db.txt new file mode 100644 index 0000000000..16996b66fd --- /dev/null +++ b/internal/endtoend/testdata/strict_function_checks/postgresql/stderr/managed-db.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:2:8: function doesntexist() does not exist diff --git a/internal/endtoend/testdata/subquery_calculated_column/mysql/go/db.go b/internal/endtoend/testdata/subquery_calculated_column/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/mysql/go/db.go +++ b/internal/endtoend/testdata/subquery_calculated_column/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/subquery_calculated_column/mysql/go/models.go b/internal/endtoend/testdata/subquery_calculated_column/mysql/go/models.go index a1ac02ccf5..530968fc6b 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/mysql/go/models.go +++ b/internal/endtoend/testdata/subquery_calculated_column/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/subquery_calculated_column/mysql/go/query.sql.go b/internal/endtoend/testdata/subquery_calculated_column/mysql/go/query.sql.go index 34959e0396..769c49f53c 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/subquery_calculated_column/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/subquery_calculated_column/mysql/query.sql b/internal/endtoend/testdata/subquery_calculated_column/mysql/query.sql index 7e1281cc8e..16f1683204 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/mysql/query.sql +++ b/internal/endtoend/testdata/subquery_calculated_column/mysql/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (a int, b int); - -- name: SubqueryCalcColumn :many SELECT sum FROM (SELECT a + b AS sum FROM foo) AS f; diff --git a/internal/endtoend/testdata/subquery_calculated_column/mysql/schema.sql b/internal/endtoend/testdata/subquery_calculated_column/mysql/schema.sql new file mode 100644 index 0000000000..ac4621fe03 --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a int, b int); + diff --git a/internal/endtoend/testdata/subquery_calculated_column/mysql/sqlc.json b/internal/endtoend/testdata/subquery_calculated_column/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/mysql/sqlc.json +++ b/internal/endtoend/testdata/subquery_calculated_column/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/models.go index a1ac02ccf5..530968fc6b 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/query.sql.go index aec34a3382..ae4c42a967 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/query.sql index 7e1281cc8e..16f1683204 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (a int, b int); - -- name: SubqueryCalcColumn :many SELECT sum FROM (SELECT a + b AS sum FROM foo) AS f; diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..ac4621fe03 --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a int, b int); + diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/models.go index 81cc7f3173..95e7754cd6 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/query.sql.go index aec34a3382..ae4c42a967 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/query.sql index 7e1281cc8e..16f1683204 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (a int, b int); - -- name: SubqueryCalcColumn :many SELECT sum FROM (SELECT a + b AS sum FROM foo) AS f; diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..ac4621fe03 --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a int, b int); + diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/models.go index a1ac02ccf5..530968fc6b 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/query.sql.go index 34959e0396..769c49f53c 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/query.sql b/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/query.sql index 7e1281cc8e..16f1683204 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (a int, b int); - -- name: SubqueryCalcColumn :many SELECT sum FROM (SELECT a + b AS sum FROM foo) AS f; diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..ac4621fe03 --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a int, b int); + diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/db.go b/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/db.go +++ b/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/models.go b/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/models.go index b024264998..2d8fab6f2f 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/models.go +++ b/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/query.sql.go b/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/query.sql.go index 086d1cb7a8..6dbafb8f41 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/subquery_calculated_column/sqlite/query.sql b/internal/endtoend/testdata/subquery_calculated_column/sqlite/query.sql index 7e1281cc8e..16f1683204 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/sqlite/query.sql +++ b/internal/endtoend/testdata/subquery_calculated_column/sqlite/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (a int, b int); - -- name: SubqueryCalcColumn :many SELECT sum FROM (SELECT a + b AS sum FROM foo) AS f; diff --git a/internal/endtoend/testdata/subquery_calculated_column/sqlite/schema.sql b/internal/endtoend/testdata/subquery_calculated_column/sqlite/schema.sql new file mode 100644 index 0000000000..ac4621fe03 --- /dev/null +++ b/internal/endtoend/testdata/subquery_calculated_column/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a int, b int); + diff --git a/internal/endtoend/testdata/subquery_calculated_column/sqlite/sqlc.json b/internal/endtoend/testdata/subquery_calculated_column/sqlite/sqlc.json index fcb288cb35..d4963e751f 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/sqlite/sqlc.json +++ b/internal/endtoend/testdata/subquery_calculated_column/sqlite/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "sqlite", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/sum_type/issue.md b/internal/endtoend/testdata/sum_type/issue.md new file mode 100644 index 0000000000..b125c05134 --- /dev/null +++ b/internal/endtoend/testdata/sum_type/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1106 \ No newline at end of file diff --git a/internal/endtoend/testdata/sum_type/postgresql/pgx/exec.json b/internal/endtoend/testdata/sum_type/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/sum_type/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/sum_type/postgresql/pgx/go/db.go b/internal/endtoend/testdata/sum_type/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/sum_type/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/sum_type/postgresql/pgx/go/models.go b/internal/endtoend/testdata/sum_type/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..605dd34145 --- /dev/null +++ b/internal/endtoend/testdata/sum_type/postgresql/pgx/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Order struct { + ID int64 + Quantity pgtype.Numeric + OrderCatalog pgtype.Int4 +} diff --git a/internal/endtoend/testdata/sum_type/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/sum_type/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..1efbbbe147 --- /dev/null +++ b/internal/endtoend/testdata/sum_type/postgresql/pgx/go/query.sql.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const sumOrder = `-- name: SumOrder :one +SELECT SUM(quantity) FROM orders +` + +func (q *Queries) SumOrder(ctx context.Context) (pgtype.Numeric, error) { + row := q.db.QueryRow(ctx, sumOrder) + var sum pgtype.Numeric + err := row.Scan(&sum) + return sum, err +} diff --git a/internal/endtoend/testdata/sum_type/postgresql/pgx/query.sql b/internal/endtoend/testdata/sum_type/postgresql/pgx/query.sql new file mode 100644 index 0000000000..7effc6e765 --- /dev/null +++ b/internal/endtoend/testdata/sum_type/postgresql/pgx/query.sql @@ -0,0 +1,2 @@ +-- name: SumOrder :one +SELECT SUM(quantity) FROM orders; \ No newline at end of file diff --git a/internal/endtoend/testdata/sum_type/postgresql/pgx/schema.sql b/internal/endtoend/testdata/sum_type/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..85df079afe --- /dev/null +++ b/internal/endtoend/testdata/sum_type/postgresql/pgx/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE orders ( + id BIGSERIAL PRIMARY KEY, + quantity decimal NOT NULL, + order_catalog int +); \ No newline at end of file diff --git a/internal/endtoend/testdata/sum_type/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/sum_type/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..01489e0ffc --- /dev/null +++ b/internal/endtoend/testdata/sum_type/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" \ No newline at end of file diff --git a/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/models.go index d0fd4d84a9..c871303d2d 100644 --- a/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/models.go @@ -1,14 +1,16 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () +import ( + "github.com/jackc/pgtype" +) type Transaction struct { ID int64 Uri string ProgramID string - Data string + Data pgtype.JSONB } diff --git a/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/query.sql.go index c42aee02b5..a8f159ee8a 100644 --- a/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/query.sql.go @@ -1,42 +1,42 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest import ( "context" + + "github.com/jackc/pgtype" ) const getTransaction = `-- name: GetTransaction :many SELECT - json_extract(transactions.data, '$.transaction.signatures[0]'), - json_group_array(instructions.value) + jsonb_extract_path(transactions.data, '$.transaction.signatures[0]'), + jsonb_agg(instructions.value) FROM transactions, - json_each(json_extract(transactions.data, '$.transaction.message.instructions')) AS instructions + jsonb_each(jsonb_extract_path(transactions.data, '$.transaction.message.instructions[0]')) AS instructions WHERE transactions.program_id = $1 - AND json_extract(transactions.data, '$.transaction.signatures[0]') > $2 - AND json_extract(json_extract(transactions.data, '$.transaction.message.accountKeys'), '$[' || json_extract(instructions.value, '$.programIdIndex') || ']') = transactions.program_id + AND jsonb_extract_path(transactions.data, '$.transaction.signatures[0]') @> to_jsonb($2::text) + AND jsonb_extract_path(jsonb_extract_path(transactions.data, '$.transaction.message.accountKeys'), 'key') = to_jsonb(transactions.program_id) GROUP BY transactions.id -LIMIT $3 ` type GetTransactionParams struct { ProgramID string Data string - Limit int32 } type GetTransactionRow struct { - JsonExtract interface{} - JsonGroupArray interface{} + JsonbExtractPath pgtype.JSONB + JsonbAgg pgtype.JSONB } func (q *Queries) GetTransaction(ctx context.Context, arg GetTransactionParams) ([]GetTransactionRow, error) { - rows, err := q.db.Query(ctx, getTransaction, arg.ProgramID, arg.Data, arg.Limit) + rows, err := q.db.Query(ctx, getTransaction, arg.ProgramID, arg.Data) if err != nil { return nil, err } @@ -44,7 +44,7 @@ func (q *Queries) GetTransaction(ctx context.Context, arg GetTransactionParams) var items []GetTransactionRow for rows.Next() { var i GetTransactionRow - if err := rows.Scan(&i.JsonExtract, &i.JsonGroupArray); err != nil { + if err := rows.Scan(&i.JsonbExtractPath, &i.JsonbAgg); err != nil { return nil, err } items = append(items, i) diff --git a/internal/endtoend/testdata/table_function/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/query.sql index 0fbe85cbac..99f02a70ef 100644 --- a/internal/endtoend/testdata/table_function/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/query.sql @@ -1,20 +1,12 @@ -CREATE TABLE transactions ( - id BIGSERIAL PRIMARY KEY, - uri text NOT NULL, - program_id text NOT NULL, - data text NOT NULL -); - /* name: GetTransaction :many */ SELECT - json_extract(transactions.data, '$.transaction.signatures[0]'), - json_group_array(instructions.value) + jsonb_extract_path(transactions.data, '$.transaction.signatures[0]'), + jsonb_agg(instructions.value) FROM transactions, - json_each(json_extract(transactions.data, '$.transaction.message.instructions')) AS instructions + jsonb_each(jsonb_extract_path(transactions.data, '$.transaction.message.instructions[0]')) AS instructions WHERE - transactions.program_id = $1 - AND json_extract(transactions.data, '$.transaction.signatures[0]') > $2 - AND json_extract(json_extract(transactions.data, '$.transaction.message.accountKeys'), '$[' || json_extract(instructions.value, '$.programIdIndex') || ']') = transactions.program_id -GROUP BY transactions.id -LIMIT $3; \ No newline at end of file + transactions.program_id = sqlc.arg('program_id') + AND jsonb_extract_path(transactions.data, '$.transaction.signatures[0]') @> to_jsonb(sqlc.arg('data')::text) + AND jsonb_extract_path(jsonb_extract_path(transactions.data, '$.transaction.message.accountKeys'), 'key') = to_jsonb(transactions.program_id) +GROUP BY transactions.id; \ No newline at end of file diff --git a/internal/endtoend/testdata/table_function/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..455651b8ad --- /dev/null +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE transactions ( + id BIGSERIAL PRIMARY KEY, + uri TEXT NOT NULL, + program_id TEXT NOT NULL, + data JSONB NOT NULL +); + diff --git a/internal/endtoend/testdata/table_function/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/table_function/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/models.go index d0fd4d84a9..10e1baa1e3 100644 --- a/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/models.go @@ -1,14 +1,12 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Transaction struct { ID int64 Uri string ProgramID string - Data string + Data []byte } diff --git a/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/query.sql.go index c42aee02b5..bb2e0fea33 100644 --- a/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -11,32 +11,30 @@ import ( const getTransaction = `-- name: GetTransaction :many SELECT - json_extract(transactions.data, '$.transaction.signatures[0]'), - json_group_array(instructions.value) + jsonb_extract_path(transactions.data, '$.transaction.signatures[0]'), + jsonb_agg(instructions.value) FROM transactions, - json_each(json_extract(transactions.data, '$.transaction.message.instructions')) AS instructions + jsonb_each(jsonb_extract_path(transactions.data, '$.transaction.message.instructions[0]')) AS instructions WHERE transactions.program_id = $1 - AND json_extract(transactions.data, '$.transaction.signatures[0]') > $2 - AND json_extract(json_extract(transactions.data, '$.transaction.message.accountKeys'), '$[' || json_extract(instructions.value, '$.programIdIndex') || ']') = transactions.program_id + AND jsonb_extract_path(transactions.data, '$.transaction.signatures[0]') @> to_jsonb($2::text) + AND jsonb_extract_path(jsonb_extract_path(transactions.data, '$.transaction.message.accountKeys'), 'key') = to_jsonb(transactions.program_id) GROUP BY transactions.id -LIMIT $3 ` type GetTransactionParams struct { ProgramID string Data string - Limit int32 } type GetTransactionRow struct { - JsonExtract interface{} - JsonGroupArray interface{} + JsonbExtractPath []byte + JsonbAgg []byte } func (q *Queries) GetTransaction(ctx context.Context, arg GetTransactionParams) ([]GetTransactionRow, error) { - rows, err := q.db.Query(ctx, getTransaction, arg.ProgramID, arg.Data, arg.Limit) + rows, err := q.db.Query(ctx, getTransaction, arg.ProgramID, arg.Data) if err != nil { return nil, err } @@ -44,7 +42,7 @@ func (q *Queries) GetTransaction(ctx context.Context, arg GetTransactionParams) var items []GetTransactionRow for rows.Next() { var i GetTransactionRow - if err := rows.Scan(&i.JsonExtract, &i.JsonGroupArray); err != nil { + if err := rows.Scan(&i.JsonbExtractPath, &i.JsonbAgg); err != nil { return nil, err } items = append(items, i) diff --git a/internal/endtoend/testdata/table_function/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/table_function/postgresql/pgx/v5/query.sql index 0fbe85cbac..99f02a70ef 100644 --- a/internal/endtoend/testdata/table_function/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v5/query.sql @@ -1,20 +1,12 @@ -CREATE TABLE transactions ( - id BIGSERIAL PRIMARY KEY, - uri text NOT NULL, - program_id text NOT NULL, - data text NOT NULL -); - /* name: GetTransaction :many */ SELECT - json_extract(transactions.data, '$.transaction.signatures[0]'), - json_group_array(instructions.value) + jsonb_extract_path(transactions.data, '$.transaction.signatures[0]'), + jsonb_agg(instructions.value) FROM transactions, - json_each(json_extract(transactions.data, '$.transaction.message.instructions')) AS instructions + jsonb_each(jsonb_extract_path(transactions.data, '$.transaction.message.instructions[0]')) AS instructions WHERE - transactions.program_id = $1 - AND json_extract(transactions.data, '$.transaction.signatures[0]') > $2 - AND json_extract(json_extract(transactions.data, '$.transaction.message.accountKeys'), '$[' || json_extract(instructions.value, '$.programIdIndex') || ']') = transactions.program_id -GROUP BY transactions.id -LIMIT $3; \ No newline at end of file + transactions.program_id = sqlc.arg('program_id') + AND jsonb_extract_path(transactions.data, '$.transaction.signatures[0]') @> to_jsonb(sqlc.arg('data')::text) + AND jsonb_extract_path(jsonb_extract_path(transactions.data, '$.transaction.message.accountKeys'), 'key') = to_jsonb(transactions.program_id) +GROUP BY transactions.id; \ No newline at end of file diff --git a/internal/endtoend/testdata/table_function/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/table_function/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..455651b8ad --- /dev/null +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v5/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE transactions ( + id BIGSERIAL PRIMARY KEY, + uri TEXT NOT NULL, + program_id TEXT NOT NULL, + data JSONB NOT NULL +); + diff --git a/internal/endtoend/testdata/table_function/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/table_function/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/table_function/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/table_function/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/table_function/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/table_function/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/table_function/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/table_function/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/table_function/postgresql/stdlib/go/models.go index d0fd4d84a9..6a505de96b 100644 --- a/internal/endtoend/testdata/table_function/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/table_function/postgresql/stdlib/go/models.go @@ -1,14 +1,16 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () +import ( + "encoding/json" +) type Transaction struct { ID int64 Uri string ProgramID string - Data string + Data json.RawMessage } diff --git a/internal/endtoend/testdata/table_function/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/table_function/postgresql/stdlib/go/query.sql.go index f59f708b45..a3d4157ab5 100644 --- a/internal/endtoend/testdata/table_function/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/table_function/postgresql/stdlib/go/query.sql.go @@ -1,42 +1,41 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest import ( "context" + "encoding/json" ) const getTransaction = `-- name: GetTransaction :many SELECT - json_extract(transactions.data, '$.transaction.signatures[0]'), - json_group_array(instructions.value) + jsonb_extract_path(transactions.data, '$.transaction.signatures[0]'), + jsonb_agg(instructions.value) FROM transactions, - json_each(json_extract(transactions.data, '$.transaction.message.instructions')) AS instructions + jsonb_each(jsonb_extract_path(transactions.data, '$.transaction.message.instructions[0]')) AS instructions WHERE transactions.program_id = $1 - AND json_extract(transactions.data, '$.transaction.signatures[0]') > $2 - AND json_extract(json_extract(transactions.data, '$.transaction.message.accountKeys'), '$[' || json_extract(instructions.value, '$.programIdIndex') || ']') = transactions.program_id + AND jsonb_extract_path(transactions.data, '$.transaction.signatures[0]') @> to_jsonb($2::text) + AND jsonb_extract_path(jsonb_extract_path(transactions.data, '$.transaction.message.accountKeys'), 'key') = to_jsonb(transactions.program_id) GROUP BY transactions.id -LIMIT $3 ` type GetTransactionParams struct { ProgramID string Data string - Limit int32 } type GetTransactionRow struct { - JsonExtract interface{} - JsonGroupArray interface{} + JsonbExtractPath json.RawMessage + JsonbAgg json.RawMessage } func (q *Queries) GetTransaction(ctx context.Context, arg GetTransactionParams) ([]GetTransactionRow, error) { - rows, err := q.db.QueryContext(ctx, getTransaction, arg.ProgramID, arg.Data, arg.Limit) + rows, err := q.db.QueryContext(ctx, getTransaction, arg.ProgramID, arg.Data) if err != nil { return nil, err } @@ -44,7 +43,7 @@ func (q *Queries) GetTransaction(ctx context.Context, arg GetTransactionParams) var items []GetTransactionRow for rows.Next() { var i GetTransactionRow - if err := rows.Scan(&i.JsonExtract, &i.JsonGroupArray); err != nil { + if err := rows.Scan(&i.JsonbExtractPath, &i.JsonbAgg); err != nil { return nil, err } items = append(items, i) diff --git a/internal/endtoend/testdata/table_function/postgresql/stdlib/query.sql b/internal/endtoend/testdata/table_function/postgresql/stdlib/query.sql index 94da269962..99f02a70ef 100644 --- a/internal/endtoend/testdata/table_function/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/table_function/postgresql/stdlib/query.sql @@ -1,20 +1,12 @@ -CREATE TABLE transactions ( - id BIGSERIAL PRIMARY KEY, - uri text NOT NULL, - program_id text NOT NULL, - data text NOT NULL -); - /* name: GetTransaction :many */ SELECT - json_extract(transactions.data, '$.transaction.signatures[0]'), - json_group_array(instructions.value) + jsonb_extract_path(transactions.data, '$.transaction.signatures[0]'), + jsonb_agg(instructions.value) FROM transactions, - json_each(json_extract(transactions.data, '$.transaction.message.instructions')) AS instructions + jsonb_each(jsonb_extract_path(transactions.data, '$.transaction.message.instructions[0]')) AS instructions WHERE - transactions.program_id = $1 - AND json_extract(transactions.data, '$.transaction.signatures[0]') > $2 - AND json_extract(json_extract(transactions.data, '$.transaction.message.accountKeys'), '$[' || json_extract(instructions.value, '$.programIdIndex') || ']') = transactions.program_id -GROUP BY transactions.id -LIMIT $3; + transactions.program_id = sqlc.arg('program_id') + AND jsonb_extract_path(transactions.data, '$.transaction.signatures[0]') @> to_jsonb(sqlc.arg('data')::text) + AND jsonb_extract_path(jsonb_extract_path(transactions.data, '$.transaction.message.accountKeys'), 'key') = to_jsonb(transactions.program_id) +GROUP BY transactions.id; \ No newline at end of file diff --git a/internal/endtoend/testdata/table_function/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/table_function/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..455651b8ad --- /dev/null +++ b/internal/endtoend/testdata/table_function/postgresql/stdlib/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE transactions ( + id BIGSERIAL PRIMARY KEY, + uri TEXT NOT NULL, + program_id TEXT NOT NULL, + data JSONB NOT NULL +); + diff --git a/internal/endtoend/testdata/table_function/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/table_function/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/table_function/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/table_function/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/table_function/sqlite/go/db.go b/internal/endtoend/testdata/table_function/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/table_function/sqlite/go/db.go +++ b/internal/endtoend/testdata/table_function/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/table_function/sqlite/go/models.go b/internal/endtoend/testdata/table_function/sqlite/go/models.go index 0b93217d84..7005f62ee8 100644 --- a/internal/endtoend/testdata/table_function/sqlite/go/models.go +++ b/internal/endtoend/testdata/table_function/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Transaction struct { Uri string ProgramID string diff --git a/internal/endtoend/testdata/table_function/sqlite/go/query.sql.go b/internal/endtoend/testdata/table_function/sqlite/go/query.sql.go index bdfec65de1..b4f04af9a0 100644 --- a/internal/endtoend/testdata/table_function/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/table_function/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/table_function/sqlite/query.sql b/internal/endtoend/testdata/table_function/sqlite/query.sql index bbc43dba7e..867e1114cb 100644 --- a/internal/endtoend/testdata/table_function/sqlite/query.sql +++ b/internal/endtoend/testdata/table_function/sqlite/query.sql @@ -1,9 +1,3 @@ -CREATE TABLE transactions ( - uri text NOT NULL, - program_id text NOT NULL, - data text NOT NULL -); - /* name: GetTransaction :many */ SELECT json_extract(transactions.data, '$.transaction.signatures[0]'), diff --git a/internal/endtoend/testdata/table_function/sqlite/schema.sql b/internal/endtoend/testdata/table_function/sqlite/schema.sql new file mode 100644 index 0000000000..90741e70db --- /dev/null +++ b/internal/endtoend/testdata/table_function/sqlite/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE transactions ( + uri text NOT NULL, + program_id text NOT NULL, + data text NOT NULL +); + diff --git a/internal/endtoend/testdata/table_function/sqlite/sqlc.json b/internal/endtoend/testdata/table_function/sqlite/sqlc.json index fcb288cb35..d4963e751f 100644 --- a/internal/endtoend/testdata/table_function/sqlite/sqlc.json +++ b/internal/endtoend/testdata/table_function/sqlite/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "sqlite", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/go/db.go b/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/go/models.go b/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/go/models.go new file mode 100644 index 0000000000..b074ef45c0 --- /dev/null +++ b/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/go/models.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name sql.NullString +} + +type Book struct { + ID int64 + Title sql.NullString +} + +type User struct { + ID int64 + Name sql.NullString +} diff --git a/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/go/query.sql.go b/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/go/query.sql.go new file mode 100644 index 0000000000..1e7221315b --- /dev/null +++ b/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/go/query.sql.go @@ -0,0 +1,183 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const deleteAuthor = `-- name: DeleteAuthor :exec +DELETE FROM "Authors" WHERE id = ? +` + +func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { + _, err := q.db.ExecContext(ctx, deleteAuthor, id) + return err +} + +const deleteBook = `-- name: DeleteBook :exec +DELETE FROM Books WHERE id = ? +` + +func (q *Queries) DeleteBook(ctx context.Context, id int64) error { + _, err := q.db.ExecContext(ctx, deleteBook, id) + return err +} + +const deleteUser = `-- name: DeleteUser :exec +DELETE FROM users WHERE id = ? +` + +func (q *Queries) DeleteUser(ctx context.Context, id int64) error { + _, err := q.db.ExecContext(ctx, deleteUser, id) + return err +} + +const deleteUserMixedCase = `-- name: DeleteUserMixedCase :exec +DELETE FROM users WHERE id = ? +` + +func (q *Queries) DeleteUserMixedCase(ctx context.Context, id int64) error { + _, err := q.db.ExecContext(ctx, deleteUserMixedCase, id) + return err +} + +const getAuthor = `-- name: GetAuthor :one +SELECT id, name FROM "Authors" WHERE id = ? +` + +func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { + row := q.db.QueryRowContext(ctx, getAuthor, id) + var i Author + err := row.Scan(&i.ID, &i.Name) + return i, err +} + +const getBook = `-- name: GetBook :one +SELECT id, title FROM Books WHERE id = ? +` + +func (q *Queries) GetBook(ctx context.Context, id int64) (Book, error) { + row := q.db.QueryRowContext(ctx, getBook, id) + var i Book + err := row.Scan(&i.ID, &i.Title) + return i, err +} + +const getUser = `-- name: GetUser :one +SELECT id, name FROM users WHERE id = ? +` + +func (q *Queries) GetUser(ctx context.Context, id int64) (User, error) { + row := q.db.QueryRowContext(ctx, getUser, id) + var i User + err := row.Scan(&i.ID, &i.Name) + return i, err +} + +const getUserMixedCase = `-- name: GetUserMixedCase :one +SELECT id, name FROM users WHERE id = ? +` + +func (q *Queries) GetUserMixedCase(ctx context.Context, id int64) (User, error) { + row := q.db.QueryRowContext(ctx, getUserMixedCase, id) + var i User + err := row.Scan(&i.ID, &i.Name) + return i, err +} + +const insertAuthor = `-- name: InsertAuthor :exec +INSERT INTO "Authors" (name) VALUES (?) +` + +func (q *Queries) InsertAuthor(ctx context.Context, name sql.NullString) error { + _, err := q.db.ExecContext(ctx, insertAuthor, name) + return err +} + +const insertBook = `-- name: InsertBook :exec +INSERT INTO Books (title) VALUES (?) +` + +func (q *Queries) InsertBook(ctx context.Context, title sql.NullString) error { + _, err := q.db.ExecContext(ctx, insertBook, title) + return err +} + +const insertUser = `-- name: InsertUser :exec +INSERT INTO users (name) VALUES (?) +` + +func (q *Queries) InsertUser(ctx context.Context, name sql.NullString) error { + _, err := q.db.ExecContext(ctx, insertUser, name) + return err +} + +const insertUserMixedCase = `-- name: InsertUserMixedCase :exec +INSERT INTO users (name) VALUES (?) +` + +func (q *Queries) InsertUserMixedCase(ctx context.Context, name sql.NullString) error { + _, err := q.db.ExecContext(ctx, insertUserMixedCase, name) + return err +} + +const updateAuthor = `-- name: UpdateAuthor :exec +UPDATE "Authors" SET name = ? WHERE id = ? +` + +type UpdateAuthorParams struct { + Name sql.NullString + ID int64 +} + +func (q *Queries) UpdateAuthor(ctx context.Context, arg UpdateAuthorParams) error { + _, err := q.db.ExecContext(ctx, updateAuthor, arg.Name, arg.ID) + return err +} + +const updateBook = `-- name: UpdateBook :exec +UPDATE Books SET title = ? WHERE id = ? +` + +type UpdateBookParams struct { + Title sql.NullString + ID int64 +} + +func (q *Queries) UpdateBook(ctx context.Context, arg UpdateBookParams) error { + _, err := q.db.ExecContext(ctx, updateBook, arg.Title, arg.ID) + return err +} + +const updateUser = `-- name: UpdateUser :exec +UPDATE users SET name = ? WHERE id = ? +` + +type UpdateUserParams struct { + Name sql.NullString + ID int64 +} + +func (q *Queries) UpdateUser(ctx context.Context, arg UpdateUserParams) error { + _, err := q.db.ExecContext(ctx, updateUser, arg.Name, arg.ID) + return err +} + +const updateUserMixedCase = `-- name: UpdateUserMixedCase :exec +UPDATE users SET name = ? WHERE id = ? +` + +type UpdateUserMixedCaseParams struct { + Name sql.NullString + ID int64 +} + +func (q *Queries) UpdateUserMixedCase(ctx context.Context, arg UpdateUserMixedCaseParams) error { + _, err := q.db.ExecContext(ctx, updateUserMixedCase, arg.Name, arg.ID) + return err +} diff --git a/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/query.sql b/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/query.sql new file mode 100644 index 0000000000..6312be57a5 --- /dev/null +++ b/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/query.sql @@ -0,0 +1,47 @@ +-- name: InsertUser :exec +INSERT INTO users (name) VALUES (?); + +-- name: InsertUserMixedCase :exec +INSERT INTO users (name) VALUES (?); + +-- name: InsertAuthor :exec +INSERT INTO "Authors" (name) VALUES (?); + +-- name: InsertBook :exec +INSERT INTO Books (title) VALUES (?); + +-- name: UpdateUser :exec +UPDATE users SET name = ? WHERE id = ?; + +-- name: UpdateUserMixedCase :exec +UPDATE users SET name = ? WHERE id = ?; + +-- name: UpdateAuthor :exec +UPDATE "Authors" SET name = ? WHERE id = ?; + +-- name: UpdateBook :exec +UPDATE Books SET title = ? WHERE id = ?; + +-- name: DeleteUser :exec +DELETE FROM users WHERE id = ?; + +-- name: DeleteUserMixedCase :exec +DELETE FROM users WHERE id = ?; + +-- name: DeleteAuthor :exec +DELETE FROM "Authors" WHERE id = ?; + +-- name: DeleteBook :exec +DELETE FROM Books WHERE id = ?; + +-- name: GetUser :one +SELECT * FROM users WHERE id = ?; + +-- name: GetUserMixedCase :one +SELECT * FROM users WHERE id = ?; + +-- name: GetAuthor :one +SELECT * FROM "Authors" WHERE id = ?; + +-- name: GetBook :one +SELECT * FROM Books WHERE id = ?; diff --git a/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/schema.sql b/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/schema.sql new file mode 100644 index 0000000000..3c43ae1d5d --- /dev/null +++ b/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/schema.sql @@ -0,0 +1,13 @@ +-- Test table name case sensitivity handling across different SQLite operations +-- Create tables with different case patterns to verify consistent name resolution +CREATE TABLE users (id integer primary key, name text); +CREATE TABLE "Authors" (id integer primary key, name text); +CREATE TABLE Books (id integer primary key, title text); + +-- Create a temporary table to test drop operations +CREATE TABLE temp_orders (id integer primary key); +DROP TABLE temp_orders; + +-- Create another temp table with quoted identifier +CREATE TABLE "temp_products" (id integer primary key); +DROP TABLE "temp_products"; diff --git a/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/sqlc.json b/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/sqlc.json new file mode 100644 index 0000000000..cd66df063b --- /dev/null +++ b/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/truncate/mysql/go/db.go b/internal/endtoend/testdata/truncate/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/truncate/mysql/go/db.go +++ b/internal/endtoend/testdata/truncate/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/truncate/mysql/go/models.go b/internal/endtoend/testdata/truncate/mysql/go/models.go index 40001531be..65820844a6 100644 --- a/internal/endtoend/testdata/truncate/mysql/go/models.go +++ b/internal/endtoend/testdata/truncate/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID uint64 } diff --git a/internal/endtoend/testdata/truncate/mysql/go/query.sql.go b/internal/endtoend/testdata/truncate/mysql/go/query.sql.go index 2fcc425a8e..d465593707 100644 --- a/internal/endtoend/testdata/truncate/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/truncate/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/truncate/mysql/query.sql b/internal/endtoend/testdata/truncate/mysql/query.sql index 0ced1754e1..47b8985c7a 100644 --- a/internal/endtoend/testdata/truncate/mysql/query.sql +++ b/internal/endtoend/testdata/truncate/mysql/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE bar (id serial not null); - -- name: Truncate :exec TRUNCATE bar; diff --git a/internal/endtoend/testdata/truncate/mysql/schema.sql b/internal/endtoend/testdata/truncate/mysql/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/truncate/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/truncate/mysql/sqlc.json b/internal/endtoend/testdata/truncate/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/truncate/mysql/sqlc.json +++ b/internal/endtoend/testdata/truncate/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/query.sql.go index ce7211d88a..5aea7ce64e 100644 --- a/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/truncate/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/query.sql index 0ced1754e1..47b8985c7a 100644 --- a/internal/endtoend/testdata/truncate/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE bar (id serial not null); - -- name: Truncate :exec TRUNCATE bar; diff --git a/internal/endtoend/testdata/truncate/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/truncate/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/truncate/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/query.sql.go index ce7211d88a..5aea7ce64e 100644 --- a/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/truncate/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/query.sql index 0ced1754e1..47b8985c7a 100644 --- a/internal/endtoend/testdata/truncate/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE bar (id serial not null); - -- name: Truncate :exec TRUNCATE bar; diff --git a/internal/endtoend/testdata/truncate/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/truncate/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/truncate/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/truncate/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/truncate/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/truncate/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/truncate/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/truncate/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/truncate/postgresql/stdlib/go/models.go index cad733c5a3..4f106ee2e3 100644 --- a/internal/endtoend/testdata/truncate/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/truncate/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/truncate/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/truncate/postgresql/stdlib/go/query.sql.go index 2fcc425a8e..d465593707 100644 --- a/internal/endtoend/testdata/truncate/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/truncate/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/truncate/postgresql/stdlib/query.sql b/internal/endtoend/testdata/truncate/postgresql/stdlib/query.sql index 0ced1754e1..47b8985c7a 100644 --- a/internal/endtoend/testdata/truncate/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/truncate/postgresql/stdlib/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE bar (id serial not null); - -- name: Truncate :exec TRUNCATE bar; diff --git a/internal/endtoend/testdata/truncate/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/truncate/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..638370ab15 --- /dev/null +++ b/internal/endtoend/testdata/truncate/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE bar (id serial not null); + diff --git a/internal/endtoend/testdata/truncate/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/truncate/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/truncate/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/truncate/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/models.go index f695e853a7..80f5f51c7d 100644 --- a/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/query.sql.go index 270705c890..60fa5945ab 100644 --- a/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/types_uuid/postgresql/stdlib/query.sql b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/query.sql index 74ab78a3d1..b94846fce2 100644 --- a/internal/endtoend/testdata/types_uuid/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/query.sql @@ -1,9 +1,3 @@ -CREATE TABLE foo ( - description text, - bar uuid, - baz uuid not null -); - -- name: List :many SELECT * FROM foo; diff --git a/internal/endtoend/testdata/types_uuid/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..b6ff9d1315 --- /dev/null +++ b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE foo ( + description text, + bar uuid, + baz uuid not null +); + diff --git a/internal/endtoend/testdata/types_uuid/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/types_uuid/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/unknown_func/pganalyze/exec.json b/internal/endtoend/testdata/unknown_func/pganalyze/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/pganalyze/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/unknown_func/pganalyze/query.sql b/internal/endtoend/testdata/unknown_func/pganalyze/query.sql new file mode 100644 index 0000000000..36b697c8bb --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/pganalyze/query.sql @@ -0,0 +1,2 @@ +-- name: ListFoos :one +SELECT id FROM foo WHERE id = frobnicate($1); diff --git a/internal/endtoend/testdata/unknown_func/pganalyze/schema.sql b/internal/endtoend/testdata/unknown_func/pganalyze/schema.sql new file mode 100644 index 0000000000..15fe2093e0 --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/pganalyze/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (id text not null); diff --git a/internal/endtoend/testdata/unknown_func/pganalyze/sqlc.json b/internal/endtoend/testdata/unknown_func/pganalyze/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/pganalyze/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v5", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/unknown_func/pganalyze/stderr.txt b/internal/endtoend/testdata/unknown_func/pganalyze/stderr.txt new file mode 100644 index 0000000000..8e63375c83 --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/pganalyze/stderr.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:2:31: function frobnicate(unknown) does not exist \ No newline at end of file diff --git a/internal/endtoend/testdata/unknown_func/pgx/v4/exec.json b/internal/endtoend/testdata/unknown_func/pgx/v4/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/pgx/v4/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/unknown_func/pgx/v4/go/db.go b/internal/endtoend/testdata/unknown_func/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/unknown_func/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/unknown_func/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/unknown_func/pgx/v4/go/models.go b/internal/endtoend/testdata/unknown_func/pgx/v4/go/models.go index 91961addfb..ef6e41447e 100644 --- a/internal/endtoend/testdata/unknown_func/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/unknown_func/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { ID string } diff --git a/internal/endtoend/testdata/unknown_func/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/unknown_func/pgx/v4/go/query.sql.go index a10206b354..b9b343e131 100644 --- a/internal/endtoend/testdata/unknown_func/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/unknown_func/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/unknown_func/pgx/v4/query.sql b/internal/endtoend/testdata/unknown_func/pgx/v4/query.sql index 1ef50de406..36b697c8bb 100644 --- a/internal/endtoend/testdata/unknown_func/pgx/v4/query.sql +++ b/internal/endtoend/testdata/unknown_func/pgx/v4/query.sql @@ -1,3 +1,2 @@ -CREATE TABLE foo (id text not null); -- name: ListFoos :one SELECT id FROM foo WHERE id = frobnicate($1); diff --git a/internal/endtoend/testdata/unknown_func/pgx/v4/schema.sql b/internal/endtoend/testdata/unknown_func/pgx/v4/schema.sql new file mode 100644 index 0000000000..15fe2093e0 --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/pgx/v4/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (id text not null); diff --git a/internal/endtoend/testdata/unknown_func/pgx/v4/sqlc.json b/internal/endtoend/testdata/unknown_func/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/unknown_func/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/unknown_func/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/unknown_func/pgx/v5/exec.json b/internal/endtoend/testdata/unknown_func/pgx/v5/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/pgx/v5/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/unknown_func/pgx/v5/go/db.go b/internal/endtoend/testdata/unknown_func/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/unknown_func/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/unknown_func/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/unknown_func/pgx/v5/go/models.go b/internal/endtoend/testdata/unknown_func/pgx/v5/go/models.go index 91961addfb..ef6e41447e 100644 --- a/internal/endtoend/testdata/unknown_func/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/unknown_func/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { ID string } diff --git a/internal/endtoend/testdata/unknown_func/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/unknown_func/pgx/v5/go/query.sql.go index a10206b354..b9b343e131 100644 --- a/internal/endtoend/testdata/unknown_func/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/unknown_func/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/unknown_func/pgx/v5/query.sql b/internal/endtoend/testdata/unknown_func/pgx/v5/query.sql index 1ef50de406..36b697c8bb 100644 --- a/internal/endtoend/testdata/unknown_func/pgx/v5/query.sql +++ b/internal/endtoend/testdata/unknown_func/pgx/v5/query.sql @@ -1,3 +1,2 @@ -CREATE TABLE foo (id text not null); -- name: ListFoos :one SELECT id FROM foo WHERE id = frobnicate($1); diff --git a/internal/endtoend/testdata/unknown_func/pgx/v5/schema.sql b/internal/endtoend/testdata/unknown_func/pgx/v5/schema.sql new file mode 100644 index 0000000000..15fe2093e0 --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/pgx/v5/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (id text not null); diff --git a/internal/endtoend/testdata/unknown_func/pgx/v5/sqlc.json b/internal/endtoend/testdata/unknown_func/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/unknown_func/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/unknown_func/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/unknown_func/stdlib/exec.json b/internal/endtoend/testdata/unknown_func/stdlib/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/stdlib/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/unknown_func/stdlib/go/db.go b/internal/endtoend/testdata/unknown_func/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/unknown_func/stdlib/go/db.go +++ b/internal/endtoend/testdata/unknown_func/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/unknown_func/stdlib/go/models.go b/internal/endtoend/testdata/unknown_func/stdlib/go/models.go index 91961addfb..ef6e41447e 100644 --- a/internal/endtoend/testdata/unknown_func/stdlib/go/models.go +++ b/internal/endtoend/testdata/unknown_func/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { ID string } diff --git a/internal/endtoend/testdata/unknown_func/stdlib/go/query.sql.go b/internal/endtoend/testdata/unknown_func/stdlib/go/query.sql.go index 4e1e3d7a31..d88d6d8275 100644 --- a/internal/endtoend/testdata/unknown_func/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/unknown_func/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/unknown_func/stdlib/query.sql b/internal/endtoend/testdata/unknown_func/stdlib/query.sql index 1ef50de406..36b697c8bb 100644 --- a/internal/endtoend/testdata/unknown_func/stdlib/query.sql +++ b/internal/endtoend/testdata/unknown_func/stdlib/query.sql @@ -1,3 +1,2 @@ -CREATE TABLE foo (id text not null); -- name: ListFoos :one SELECT id FROM foo WHERE id = frobnicate($1); diff --git a/internal/endtoend/testdata/unknown_func/stdlib/schema.sql b/internal/endtoend/testdata/unknown_func/stdlib/schema.sql new file mode 100644 index 0000000000..15fe2093e0 --- /dev/null +++ b/internal/endtoend/testdata/unknown_func/stdlib/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (id text not null); diff --git a/internal/endtoend/testdata/unknown_func/stdlib/sqlc.json b/internal/endtoend/testdata/unknown_func/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/unknown_func/stdlib/sqlc.json +++ b/internal/endtoend/testdata/unknown_func/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/models.go index 94225e9086..746156964b 100644 --- a/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/querier.go b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/querier.go index 00a20e6651..e461e469a0 100644 --- a/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/querier.go +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/query.sql.go index 74b828466d..072b4f06e8 100644 --- a/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/models.go index a39478b0b9..4d78ae55e9 100644 --- a/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/querier.go b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/querier.go index 0748493e6c..8f057d9828 100644 --- a/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/querier.go +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/query.sql.go index b0e40e1bc4..3e8cfe29e3 100644 --- a/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/unnest/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/unnest/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/unnest/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/unnest/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/unnest/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/unnest/postgresql/stdlib/go/models.go index 94225e9086..746156964b 100644 --- a/internal/endtoend/testdata/unnest/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/unnest/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/unnest/postgresql/stdlib/go/querier.go b/internal/endtoend/testdata/unnest/postgresql/stdlib/go/querier.go index 00a20e6651..e461e469a0 100644 --- a/internal/endtoend/testdata/unnest/postgresql/stdlib/go/querier.go +++ b/internal/endtoend/testdata/unnest/postgresql/stdlib/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/unnest/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/unnest/postgresql/stdlib/go/query.sql.go index bff552d8d7..97e187cc9a 100644 --- a/internal/endtoend/testdata/unnest/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/unnest/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/unnest_star/issue.md b/internal/endtoend/testdata/unnest_star/issue.md new file mode 100644 index 0000000000..d0aede56b3 --- /dev/null +++ b/internal/endtoend/testdata/unnest_star/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1185 \ No newline at end of file diff --git a/internal/endtoend/testdata/unnest_star/postgresql/pgx/exec.json b/internal/endtoend/testdata/unnest_star/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/unnest_star/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/db.go b/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/models.go b/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..63f98719bf --- /dev/null +++ b/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Item struct { + ItemID int64 +} + +type Plan struct { + PlanID int64 +} + +type PlanItem struct { + PlanItemID int64 + PlanID int64 + ItemID int64 +} diff --git a/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..9cfcf1b136 --- /dev/null +++ b/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/query.sql.go @@ -0,0 +1,57 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const getPlanItems = `-- name: GetPlanItems :many +SELECT p.plan_id, p.item_id +FROM (SELECT unnest FROM unnest($1::bigint[])) AS i(req_item_id), +LATERAL ( + SELECT plan_id, item_id + FROM plan_items + WHERE + item_id = i.req_item_id AND + ($2 = 0 OR plan_id < $2) + ORDER BY plan_id DESC + LIMIT $3 +) p +` + +type GetPlanItemsParams struct { + Ids []int64 + After pgtype.Int4 + LimitCount int64 +} + +type GetPlanItemsRow struct { + PlanID int64 + ItemID int64 +} + +func (q *Queries) GetPlanItems(ctx context.Context, arg GetPlanItemsParams) ([]GetPlanItemsRow, error) { + rows, err := q.db.Query(ctx, getPlanItems, arg.Ids, arg.After, arg.LimitCount) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetPlanItemsRow + for rows.Next() { + var i GetPlanItemsRow + if err := rows.Scan(&i.PlanID, &i.ItemID); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/unnest_star/postgresql/pgx/query.sql b/internal/endtoend/testdata/unnest_star/postgresql/pgx/query.sql new file mode 100644 index 0000000000..01b5c77430 --- /dev/null +++ b/internal/endtoend/testdata/unnest_star/postgresql/pgx/query.sql @@ -0,0 +1,12 @@ +-- name: GetPlanItems :many +SELECT p.plan_id, p.item_id +FROM (SELECT * FROM unnest(@ids::bigint[])) AS i(req_item_id), +LATERAL ( + SELECT plan_id, item_id + FROM plan_items + WHERE + item_id = i.req_item_id AND + (@after = 0 OR plan_id < @after) + ORDER BY plan_id DESC + LIMIT @limit_count +) p; \ No newline at end of file diff --git a/internal/endtoend/testdata/unnest_star/postgresql/pgx/schema.sql b/internal/endtoend/testdata/unnest_star/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..787caf88c7 --- /dev/null +++ b/internal/endtoend/testdata/unnest_star/postgresql/pgx/schema.sql @@ -0,0 +1,13 @@ +create table plans ( + plan_id bigint generated by default as identity primary key +); + +create table items ( + item_id bigint generated by default as identity primary key +); + +create table plan_items ( + plan_item_id bigint generated by default as identity primary key, + plan_id bigint not null REFERENCES plans, + item_id bigint not null REFERENCES items +); \ No newline at end of file diff --git a/internal/endtoend/testdata/unnest_star/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/unnest_star/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..01489e0ffc --- /dev/null +++ b/internal/endtoend/testdata/unnest_star/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" \ No newline at end of file diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/models.go index e3e3c259ab..2067e59942 100644 --- a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type ArrayValue struct { ID int64 Values []string diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/querier.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/querier.go index ea93152266..8bcd972db9 100644 --- a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/querier.go +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/query.sql.go index 0902286ab0..d1621e11fd 100644 --- a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/models.go index e3e3c259ab..2067e59942 100644 --- a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type ArrayValue struct { ID int64 Values []string diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/querier.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/querier.go index ea93152266..8bcd972db9 100644 --- a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/querier.go +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/query.sql.go index 0902286ab0..d1621e11fd 100644 --- a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/models.go index e3e3c259ab..2067e59942 100644 --- a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type ArrayValue struct { ID int64 Values []string diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/querier.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/querier.go index ea93152266..8bcd972db9 100644 --- a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/querier.go +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/query.sql.go index fd1e2c489d..2f62f8bb0d 100644 --- a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/unsigned_params/mysql/go/db.go b/internal/endtoend/testdata/unsigned_params/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/unsigned_params/mysql/go/db.go +++ b/internal/endtoend/testdata/unsigned_params/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/unsigned_params/mysql/go/models.go b/internal/endtoend/testdata/unsigned_params/mysql/go/models.go index a2799f1b8f..1ff011b819 100644 --- a/internal/endtoend/testdata/unsigned_params/mysql/go/models.go +++ b/internal/endtoend/testdata/unsigned_params/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { ID uint32 } diff --git a/internal/endtoend/testdata/unsigned_params/mysql/go/query.sql.go b/internal/endtoend/testdata/unsigned_params/mysql/go/query.sql.go index f1a77bb3ba..3654e5f7c5 100644 --- a/internal/endtoend/testdata/unsigned_params/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/unsigned_params/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/unsigned_params/mysql/query.sql b/internal/endtoend/testdata/unsigned_params/mysql/query.sql index bb2844627d..75f888cfe8 100644 --- a/internal/endtoend/testdata/unsigned_params/mysql/query.sql +++ b/internal/endtoend/testdata/unsigned_params/mysql/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (id INT UNSIGNED NOT NULL); - -- name: CreateFoo :exec INSERT INTO foo (id) VALUES (?); diff --git a/internal/endtoend/testdata/unsigned_params/mysql/schema.sql b/internal/endtoend/testdata/unsigned_params/mysql/schema.sql new file mode 100644 index 0000000000..e1d9224be8 --- /dev/null +++ b/internal/endtoend/testdata/unsigned_params/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (id INT UNSIGNED NOT NULL); + diff --git a/internal/endtoend/testdata/unsigned_params/mysql/sqlc.json b/internal/endtoend/testdata/unsigned_params/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/unsigned_params/mysql/sqlc.json +++ b/internal/endtoend/testdata/unsigned_params/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/db.go b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/db.go index 3d2b5bf3a3..cd5bbb8e08 100644 --- a/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/db.go +++ b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/models.go b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/models.go index 8ff2474e60..9f53e22d22 100644 --- a/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/models.go +++ b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db -import () - type Repro struct { ID interface{} Name interface{} diff --git a/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/query.sql.go b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/query.sql.go index 3e921027a9..c0f28e53c1 100644 --- a/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/query.sql.go +++ b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package db diff --git a/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/query.sql b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/query.sql index 2808a6aae2..b90ec62481 100644 --- a/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/query.sql +++ b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/query.sql @@ -1,5 +1,2 @@ --- original table name in sqlite schema was sqlite_sequence, rest of def is identical -create table repro(id, name, seq); - -- name: GetRepro :one select * from repro where id = ? limit 1; \ No newline at end of file diff --git a/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/schema.sql b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/schema.sql new file mode 100644 index 0000000000..5a98bb004b --- /dev/null +++ b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/schema.sql @@ -0,0 +1,3 @@ +-- original table name in sqlite schema was sqlite_sequence, rest of def is identical +create table repro(id, name, seq); + diff --git a/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/sqlc.json b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/sqlc.json index 4af3ff1ae3..58ea3c6d66 100644 --- a/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/sqlc.json +++ b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/sqlc.json @@ -3,7 +3,7 @@ "sql": [ { "engine": "sqlite", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "gen": { "go": { diff --git a/internal/endtoend/testdata/update_array_index/issue.md b/internal/endtoend/testdata/update_array_index/issue.md new file mode 100644 index 0000000000..d86fb5d2a4 --- /dev/null +++ b/internal/endtoend/testdata/update_array_index/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1532 diff --git a/internal/endtoend/testdata/update_array_index/postgresql/pgx/exec.json b/internal/endtoend/testdata/update_array_index/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/update_array_index/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/update_array_index/postgresql/pgx/go/db.go b/internal/endtoend/testdata/update_array_index/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1e00549714 --- /dev/null +++ b/internal/endtoend/testdata/update_array_index/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/update_array_index/postgresql/pgx/go/models.go b/internal/endtoend/testdata/update_array_index/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..6db1df433c --- /dev/null +++ b/internal/endtoend/testdata/update_array_index/postgresql/pgx/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +type Author struct { + ID int64 + Names []string +} diff --git a/internal/endtoend/testdata/update_array_index/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/update_array_index/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..2533a1908e --- /dev/null +++ b/internal/endtoend/testdata/update_array_index/postgresql/pgx/go/query.sql.go @@ -0,0 +1,30 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const updateAuthor = `-- name: UpdateAuthor :one +update authors +set names[$1] = $2 +where id=$3 +RETURNING id, names +` + +type UpdateAuthorParams struct { + Names int32 + Names_2 string + ID int64 +} + +func (q *Queries) UpdateAuthor(ctx context.Context, arg UpdateAuthorParams) (Author, error) { + row := q.db.QueryRow(ctx, updateAuthor, arg.Names, arg.Names_2, arg.ID) + var i Author + err := row.Scan(&i.ID, &i.Names) + return i, err +} diff --git a/internal/endtoend/testdata/update_array_index/postgresql/pgx/query.sql b/internal/endtoend/testdata/update_array_index/postgresql/pgx/query.sql new file mode 100644 index 0000000000..32b4e9c148 --- /dev/null +++ b/internal/endtoend/testdata/update_array_index/postgresql/pgx/query.sql @@ -0,0 +1,5 @@ +-- name: UpdateAuthor :one +update authors +set names[$1] = $2 +where id=$3 +RETURNING *; diff --git a/internal/endtoend/testdata/update_array_index/postgresql/pgx/schema.sql b/internal/endtoend/testdata/update_array_index/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..286ab791fa --- /dev/null +++ b/internal/endtoend/testdata/update_array_index/postgresql/pgx/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + names text[] NOT NULL +); diff --git a/internal/endtoend/testdata/update_array_index/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/update_array_index/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/update_array_index/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/update_cte/pgx/v4/go/db.go b/internal/endtoend/testdata/update_cte/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/update_cte/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/update_cte/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/update_cte/pgx/v4/go/models.go b/internal/endtoend/testdata/update_cte/pgx/v4/go/models.go index 78aa133e28..fda938bb99 100644 --- a/internal/endtoend/testdata/update_cte/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/update_cte/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/update_cte/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/update_cte/pgx/v4/go/query.sql.go index 59a0d71a6f..4a5e6b409b 100644 --- a/internal/endtoend/testdata/update_cte/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/update_cte/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -12,7 +12,6 @@ import ( ) const updateCode = `-- name: UpdateCode :one - WITH cc AS ( UPDATE td3.codes SET @@ -51,7 +50,6 @@ type UpdateCodeRow struct { CodeHash string } -// FILE: query.sql func (q *Queries) UpdateCode(ctx context.Context, arg UpdateCodeParams) (UpdateCodeRow, error) { row := q.db.QueryRow(ctx, updateCode, arg.CreatedBy, diff --git a/internal/endtoend/testdata/update_cte/pgx/v4/query.sql b/internal/endtoend/testdata/update_cte/pgx/v4/query.sql index dc53e4f427..d1f8ffac77 100644 --- a/internal/endtoend/testdata/update_cte/pgx/v4/query.sql +++ b/internal/endtoend/testdata/update_cte/pgx/v4/query.sql @@ -1,34 +1,3 @@ --- FILE: schema.sql - -DROP SCHEMA IF EXISTS td3 CASCADE; -CREATE SCHEMA td3; - -CREATE TABLE td3.codes ( - id SERIAL PRIMARY KEY, - ts_created timestamptz DEFAULT now() NOT NULL, - ts_updated timestamptz DEFAULT now() NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL, - - code text, - hash text, - is_private boolean -); - - -CREATE TABLE td3.test_codes ( - id SERIAL PRIMARY KEY, - ts_created timestamptz DEFAULT now() NOT NULL, - ts_updated timestamptz DEFAULT now() NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL, - - test_id integer NOT NULL, - code_hash text NOT NULL -); - --- FILE: query.sql - -- name: UpdateCode :one WITH cc AS ( UPDATE td3.codes diff --git a/internal/endtoend/testdata/update_cte/pgx/v4/schema.sql b/internal/endtoend/testdata/update_cte/pgx/v4/schema.sql new file mode 100644 index 0000000000..1eb3dcf4ac --- /dev/null +++ b/internal/endtoend/testdata/update_cte/pgx/v4/schema.sql @@ -0,0 +1,31 @@ +-- FILE: schema.sql + +DROP SCHEMA IF EXISTS td3 CASCADE; +CREATE SCHEMA td3; + +CREATE TABLE td3.codes ( + id SERIAL PRIMARY KEY, + ts_created timestamptz DEFAULT now() NOT NULL, + ts_updated timestamptz DEFAULT now() NOT NULL, + created_by text NOT NULL, + updated_by text NOT NULL, + + code text, + hash text, + is_private boolean +); + + +CREATE TABLE td3.test_codes ( + id SERIAL PRIMARY KEY, + ts_created timestamptz DEFAULT now() NOT NULL, + ts_updated timestamptz DEFAULT now() NOT NULL, + created_by text NOT NULL, + updated_by text NOT NULL, + + test_id integer NOT NULL, + code_hash text NOT NULL +); + +-- FILE: query.sql + diff --git a/internal/endtoend/testdata/update_cte/pgx/v4/sqlc.json b/internal/endtoend/testdata/update_cte/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/update_cte/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/update_cte/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/update_cte/pgx/v5/go/db.go b/internal/endtoend/testdata/update_cte/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/update_cte/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/update_cte/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/update_cte/pgx/v5/go/models.go b/internal/endtoend/testdata/update_cte/pgx/v5/go/models.go index b4aaf069a0..5f27f6c6bd 100644 --- a/internal/endtoend/testdata/update_cte/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/update_cte/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/update_cte/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/update_cte/pgx/v5/go/query.sql.go index feb9fd625a..90b9f28d34 100644 --- a/internal/endtoend/testdata/update_cte/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/update_cte/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -12,7 +12,6 @@ import ( ) const updateCode = `-- name: UpdateCode :one - WITH cc AS ( UPDATE td3.codes SET @@ -51,7 +50,6 @@ type UpdateCodeRow struct { CodeHash string } -// FILE: query.sql func (q *Queries) UpdateCode(ctx context.Context, arg UpdateCodeParams) (UpdateCodeRow, error) { row := q.db.QueryRow(ctx, updateCode, arg.CreatedBy, diff --git a/internal/endtoend/testdata/update_cte/pgx/v5/query.sql b/internal/endtoend/testdata/update_cte/pgx/v5/query.sql index dc53e4f427..d1f8ffac77 100644 --- a/internal/endtoend/testdata/update_cte/pgx/v5/query.sql +++ b/internal/endtoend/testdata/update_cte/pgx/v5/query.sql @@ -1,34 +1,3 @@ --- FILE: schema.sql - -DROP SCHEMA IF EXISTS td3 CASCADE; -CREATE SCHEMA td3; - -CREATE TABLE td3.codes ( - id SERIAL PRIMARY KEY, - ts_created timestamptz DEFAULT now() NOT NULL, - ts_updated timestamptz DEFAULT now() NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL, - - code text, - hash text, - is_private boolean -); - - -CREATE TABLE td3.test_codes ( - id SERIAL PRIMARY KEY, - ts_created timestamptz DEFAULT now() NOT NULL, - ts_updated timestamptz DEFAULT now() NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL, - - test_id integer NOT NULL, - code_hash text NOT NULL -); - --- FILE: query.sql - -- name: UpdateCode :one WITH cc AS ( UPDATE td3.codes diff --git a/internal/endtoend/testdata/update_cte/pgx/v5/schema.sql b/internal/endtoend/testdata/update_cte/pgx/v5/schema.sql new file mode 100644 index 0000000000..1eb3dcf4ac --- /dev/null +++ b/internal/endtoend/testdata/update_cte/pgx/v5/schema.sql @@ -0,0 +1,31 @@ +-- FILE: schema.sql + +DROP SCHEMA IF EXISTS td3 CASCADE; +CREATE SCHEMA td3; + +CREATE TABLE td3.codes ( + id SERIAL PRIMARY KEY, + ts_created timestamptz DEFAULT now() NOT NULL, + ts_updated timestamptz DEFAULT now() NOT NULL, + created_by text NOT NULL, + updated_by text NOT NULL, + + code text, + hash text, + is_private boolean +); + + +CREATE TABLE td3.test_codes ( + id SERIAL PRIMARY KEY, + ts_created timestamptz DEFAULT now() NOT NULL, + ts_updated timestamptz DEFAULT now() NOT NULL, + created_by text NOT NULL, + updated_by text NOT NULL, + + test_id integer NOT NULL, + code_hash text NOT NULL +); + +-- FILE: query.sql + diff --git a/internal/endtoend/testdata/update_cte/pgx/v5/sqlc.json b/internal/endtoend/testdata/update_cte/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/update_cte/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/update_cte/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/update_cte/stdlib/go/db.go b/internal/endtoend/testdata/update_cte/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/update_cte/stdlib/go/db.go +++ b/internal/endtoend/testdata/update_cte/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/update_cte/stdlib/go/models.go b/internal/endtoend/testdata/update_cte/stdlib/go/models.go index 78aa133e28..fda938bb99 100644 --- a/internal/endtoend/testdata/update_cte/stdlib/go/models.go +++ b/internal/endtoend/testdata/update_cte/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/update_cte/stdlib/go/query.sql.go b/internal/endtoend/testdata/update_cte/stdlib/go/query.sql.go index 8a45f0b06e..cc8ead4fe5 100644 --- a/internal/endtoend/testdata/update_cte/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/update_cte/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -12,7 +12,6 @@ import ( ) const updateCode = `-- name: UpdateCode :one - WITH cc AS ( UPDATE td3.codes SET @@ -51,7 +50,6 @@ type UpdateCodeRow struct { CodeHash string } -// FILE: query.sql func (q *Queries) UpdateCode(ctx context.Context, arg UpdateCodeParams) (UpdateCodeRow, error) { row := q.db.QueryRowContext(ctx, updateCode, arg.CreatedBy, diff --git a/internal/endtoend/testdata/update_cte/stdlib/query.sql b/internal/endtoend/testdata/update_cte/stdlib/query.sql index dc53e4f427..d1f8ffac77 100644 --- a/internal/endtoend/testdata/update_cte/stdlib/query.sql +++ b/internal/endtoend/testdata/update_cte/stdlib/query.sql @@ -1,34 +1,3 @@ --- FILE: schema.sql - -DROP SCHEMA IF EXISTS td3 CASCADE; -CREATE SCHEMA td3; - -CREATE TABLE td3.codes ( - id SERIAL PRIMARY KEY, - ts_created timestamptz DEFAULT now() NOT NULL, - ts_updated timestamptz DEFAULT now() NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL, - - code text, - hash text, - is_private boolean -); - - -CREATE TABLE td3.test_codes ( - id SERIAL PRIMARY KEY, - ts_created timestamptz DEFAULT now() NOT NULL, - ts_updated timestamptz DEFAULT now() NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL, - - test_id integer NOT NULL, - code_hash text NOT NULL -); - --- FILE: query.sql - -- name: UpdateCode :one WITH cc AS ( UPDATE td3.codes diff --git a/internal/endtoend/testdata/update_cte/stdlib/schema.sql b/internal/endtoend/testdata/update_cte/stdlib/schema.sql new file mode 100644 index 0000000000..1eb3dcf4ac --- /dev/null +++ b/internal/endtoend/testdata/update_cte/stdlib/schema.sql @@ -0,0 +1,31 @@ +-- FILE: schema.sql + +DROP SCHEMA IF EXISTS td3 CASCADE; +CREATE SCHEMA td3; + +CREATE TABLE td3.codes ( + id SERIAL PRIMARY KEY, + ts_created timestamptz DEFAULT now() NOT NULL, + ts_updated timestamptz DEFAULT now() NOT NULL, + created_by text NOT NULL, + updated_by text NOT NULL, + + code text, + hash text, + is_private boolean +); + + +CREATE TABLE td3.test_codes ( + id SERIAL PRIMARY KEY, + ts_created timestamptz DEFAULT now() NOT NULL, + ts_updated timestamptz DEFAULT now() NOT NULL, + created_by text NOT NULL, + updated_by text NOT NULL, + + test_id integer NOT NULL, + code_hash text NOT NULL +); + +-- FILE: query.sql + diff --git a/internal/endtoend/testdata/update_cte/stdlib/sqlc.json b/internal/endtoend/testdata/update_cte/stdlib/sqlc.json index ac7c2ed829..dbe55e66a6 100644 --- a/internal/endtoend/testdata/update_cte/stdlib/sqlc.json +++ b/internal/endtoend/testdata/update_cte/stdlib/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/update_inner_join/db/db.go b/internal/endtoend/testdata/update_inner_join/db/db.go index 3d2b5bf3a3..cd5bbb8e08 100644 --- a/internal/endtoend/testdata/update_inner_join/db/db.go +++ b/internal/endtoend/testdata/update_inner_join/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/update_inner_join/db/models.go b/internal/endtoend/testdata/update_inner_join/db/models.go index 8d26589029..41e5cc60de 100644 --- a/internal/endtoend/testdata/update_inner_join/db/models.go +++ b/internal/endtoend/testdata/update_inner_join/db/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/update_inner_join/db/query.sql.go b/internal/endtoend/testdata/update_inner_join/db/query.sql.go index c7067807f5..e214c2599e 100644 --- a/internal/endtoend/testdata/update_inner_join/db/query.sql.go +++ b/internal/endtoend/testdata/update_inner_join/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package db diff --git a/internal/endtoend/testdata/update_inner_join/query.sql b/internal/endtoend/testdata/update_inner_join/query.sql index 003a814986..2e88d46ca2 100644 --- a/internal/endtoend/testdata/update_inner_join/query.sql +++ b/internal/endtoend/testdata/update_inner_join/query.sql @@ -1,12 +1,2 @@ -CREATE TABLE x ( - a text, - b text -); - -CREATE TABLE y ( - a text, - b text -); - -- name: UpdateXWithY :exec UPDATE x INNER JOIN y ON y.a = x.a SET x.b = y.b; diff --git a/internal/endtoend/testdata/update_inner_join/schema.sql b/internal/endtoend/testdata/update_inner_join/schema.sql new file mode 100644 index 0000000000..d8c6d8de5e --- /dev/null +++ b/internal/endtoend/testdata/update_inner_join/schema.sql @@ -0,0 +1,10 @@ +CREATE TABLE x ( + a text, + b text +); + +CREATE TABLE y ( + a text, + b text +); + diff --git a/internal/endtoend/testdata/update_inner_join/sqlc.json b/internal/endtoend/testdata/update_inner_join/sqlc.json index 72d8821559..32a13d6fc6 100644 --- a/internal/endtoend/testdata/update_inner_join/sqlc.json +++ b/internal/endtoend/testdata/update_inner_join/sqlc.json @@ -4,7 +4,7 @@ { "path": "db", "engine": "mysql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/update_join/mysql/db/db.go b/internal/endtoend/testdata/update_join/mysql/db/db.go index 3d2b5bf3a3..cd5bbb8e08 100644 --- a/internal/endtoend/testdata/update_join/mysql/db/db.go +++ b/internal/endtoend/testdata/update_join/mysql/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/update_join/mysql/db/models.go b/internal/endtoend/testdata/update_join/mysql/db/models.go index 2e43afa8ec..ebf0df7b7b 100644 --- a/internal/endtoend/testdata/update_join/mysql/db/models.go +++ b/internal/endtoend/testdata/update_join/mysql/db/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db -import () - type JoinTable struct { ID uint64 PrimaryTableID uint64 diff --git a/internal/endtoend/testdata/update_join/mysql/db/query.sql.go b/internal/endtoend/testdata/update_join/mysql/db/query.sql.go index e0907e13c5..3d27f3eb47 100644 --- a/internal/endtoend/testdata/update_join/mysql/db/query.sql.go +++ b/internal/endtoend/testdata/update_join/mysql/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package db diff --git a/internal/endtoend/testdata/update_join/mysql/query.sql b/internal/endtoend/testdata/update_join/mysql/query.sql index 8f702fa453..cf7cf36f54 100644 --- a/internal/endtoend/testdata/update_join/mysql/query.sql +++ b/internal/endtoend/testdata/update_join/mysql/query.sql @@ -1,17 +1,3 @@ -CREATE TABLE primary_table ( - id bigint(20) unsigned NOT NULL AUTO_INCREMENT, - user_id bigint(20) unsigned NOT NULL, - PRIMARY KEY (id) -); - -CREATE TABLE join_table ( - id bigint(20) unsigned NOT NULL AUTO_INCREMENT, - primary_table_id bigint(20) unsigned NOT NULL, - other_table_id bigint(20) unsigned NOT NULL, - is_active tinyint(1) NOT NULL DEFAULT '0', - PRIMARY KEY (id) -); - -- name: UpdateJoin :exec UPDATE join_table as jt JOIN primary_table as pt diff --git a/internal/endtoend/testdata/update_join/mysql/schema.sql b/internal/endtoend/testdata/update_join/mysql/schema.sql new file mode 100644 index 0000000000..89d517e184 --- /dev/null +++ b/internal/endtoend/testdata/update_join/mysql/schema.sql @@ -0,0 +1,14 @@ +CREATE TABLE primary_table ( + id bigint(20) unsigned NOT NULL AUTO_INCREMENT, + user_id bigint(20) unsigned NOT NULL, + PRIMARY KEY (id) +); + +CREATE TABLE join_table ( + id bigint(20) unsigned NOT NULL AUTO_INCREMENT, + primary_table_id bigint(20) unsigned NOT NULL, + other_table_id bigint(20) unsigned NOT NULL, + is_active tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (id) +); + diff --git a/internal/endtoend/testdata/update_join/mysql/sqlc.json b/internal/endtoend/testdata/update_join/mysql/sqlc.json index b63437627d..421770653f 100644 --- a/internal/endtoend/testdata/update_join/mysql/sqlc.json +++ b/internal/endtoend/testdata/update_join/mysql/sqlc.json @@ -4,7 +4,7 @@ { "path": "db", "engine": "mysql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/update_join/postgresql/db/db.go b/internal/endtoend/testdata/update_join/postgresql/db/db.go index 3d2b5bf3a3..cd5bbb8e08 100644 --- a/internal/endtoend/testdata/update_join/postgresql/db/db.go +++ b/internal/endtoend/testdata/update_join/postgresql/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db diff --git a/internal/endtoend/testdata/update_join/postgresql/db/models.go b/internal/endtoend/testdata/update_join/postgresql/db/models.go index 43f32c8a13..0e93ad23ba 100644 --- a/internal/endtoend/testdata/update_join/postgresql/db/models.go +++ b/internal/endtoend/testdata/update_join/postgresql/db/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package db -import () - type JoinTable struct { ID int32 PrimaryTableID int32 diff --git a/internal/endtoend/testdata/update_join/postgresql/db/query.sql.go b/internal/endtoend/testdata/update_join/postgresql/db/query.sql.go index d8dcadfac5..f1da19118a 100644 --- a/internal/endtoend/testdata/update_join/postgresql/db/query.sql.go +++ b/internal/endtoend/testdata/update_join/postgresql/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package db diff --git a/internal/endtoend/testdata/update_join/postgresql/query.sql b/internal/endtoend/testdata/update_join/postgresql/query.sql index 875dd8e0f9..57bfb22f6f 100644 --- a/internal/endtoend/testdata/update_join/postgresql/query.sql +++ b/internal/endtoend/testdata/update_join/postgresql/query.sql @@ -1,15 +1,3 @@ -CREATE TABLE primary_table ( - id INT PRIMARY KEY, - user_id INT NOT NULL -); - -CREATE TABLE join_table ( - id INT PRIMARY KEY, - primary_table_id INT NOT NULL, - other_table_id INT NOT NULL, - is_active BOOLEAN NOT NULL -); - -- name: UpdateJoin :exec UPDATE join_table SET is_active = $1 diff --git a/internal/endtoend/testdata/update_join/postgresql/schema.sql b/internal/endtoend/testdata/update_join/postgresql/schema.sql new file mode 100644 index 0000000000..49e27f84c1 --- /dev/null +++ b/internal/endtoend/testdata/update_join/postgresql/schema.sql @@ -0,0 +1,12 @@ +CREATE TABLE primary_table ( + id INT PRIMARY KEY, + user_id INT NOT NULL +); + +CREATE TABLE join_table ( + id INT PRIMARY KEY, + primary_table_id INT NOT NULL, + other_table_id INT NOT NULL, + is_active BOOLEAN NOT NULL +); + diff --git a/internal/endtoend/testdata/update_join/postgresql/sqlc.json b/internal/endtoend/testdata/update_join/postgresql/sqlc.json index c9cb1e1fdc..ba0fc2454c 100644 --- a/internal/endtoend/testdata/update_join/postgresql/sqlc.json +++ b/internal/endtoend/testdata/update_join/postgresql/sqlc.json @@ -4,7 +4,7 @@ { "path": "db", "engine": "postgresql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/update_set/myql/go/db.go b/internal/endtoend/testdata/update_set/myql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/update_set/myql/go/db.go +++ b/internal/endtoend/testdata/update_set/myql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/update_set/myql/go/models.go b/internal/endtoend/testdata/update_set/myql/go/models.go index 5870a7e6fe..ee2c5c5577 100644 --- a/internal/endtoend/testdata/update_set/myql/go/models.go +++ b/internal/endtoend/testdata/update_set/myql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Name string Slug string diff --git a/internal/endtoend/testdata/update_set/myql/go/query.sql.go b/internal/endtoend/testdata/update_set/myql/go/query.sql.go index c70697aabd..99f8a5cbad 100644 --- a/internal/endtoend/testdata/update_set/myql/go/query.sql.go +++ b/internal/endtoend/testdata/update_set/myql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/update_set/myql/query.sql b/internal/endtoend/testdata/update_set/myql/query.sql index 5b2fb0e625..0f6603f503 100644 --- a/internal/endtoend/testdata/update_set/myql/query.sql +++ b/internal/endtoend/testdata/update_set/myql/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (name text not null, slug text not null); - /* name: UpdateSet :exec */ UPDATE foo SET name = ? WHERE slug = ?; diff --git a/internal/endtoend/testdata/update_set/myql/schema.sql b/internal/endtoend/testdata/update_set/myql/schema.sql new file mode 100644 index 0000000000..d1bc5fac60 --- /dev/null +++ b/internal/endtoend/testdata/update_set/myql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null, slug text not null); + diff --git a/internal/endtoend/testdata/update_set/myql/sqlc.json b/internal/endtoend/testdata/update_set/myql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/update_set/myql/sqlc.json +++ b/internal/endtoend/testdata/update_set/myql/sqlc.json @@ -5,7 +5,7 @@ "engine": "mysql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/models.go index 5870a7e6fe..ee2c5c5577 100644 --- a/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Name string Slug string diff --git a/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/query.sql.go index f45481b0af..a392f8a4d3 100644 --- a/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/update_set/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/query.sql index 94e2f11c1d..a41419840f 100644 --- a/internal/endtoend/testdata/update_set/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (name text not null, slug text not null); - -- name: UpdateSet :exec UPDATE foo SET name = $2 WHERE slug = $1; diff --git a/internal/endtoend/testdata/update_set/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..d1bc5fac60 --- /dev/null +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null, slug text not null); + diff --git a/internal/endtoend/testdata/update_set/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/update_set/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/models.go index 5870a7e6fe..ee2c5c5577 100644 --- a/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Name string Slug string diff --git a/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/query.sql.go index f45481b0af..a392f8a4d3 100644 --- a/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/update_set/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/update_set/postgresql/pgx/v5/query.sql index 94e2f11c1d..a41419840f 100644 --- a/internal/endtoend/testdata/update_set/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v5/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (name text not null, slug text not null); - -- name: UpdateSet :exec UPDATE foo SET name = $2 WHERE slug = $1; diff --git a/internal/endtoend/testdata/update_set/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/update_set/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..d1bc5fac60 --- /dev/null +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null, slug text not null); + diff --git a/internal/endtoend/testdata/update_set/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/update_set/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/update_set/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/update_set/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/update_set/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/update_set/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/update_set/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/update_set/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/update_set/postgresql/stdlib/go/models.go index 5870a7e6fe..ee2c5c5577 100644 --- a/internal/endtoend/testdata/update_set/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/update_set/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Name string Slug string diff --git a/internal/endtoend/testdata/update_set/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/update_set/postgresql/stdlib/go/query.sql.go index 9e85c38853..bc6bce3952 100644 --- a/internal/endtoend/testdata/update_set/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/update_set/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/update_set/postgresql/stdlib/query.sql b/internal/endtoend/testdata/update_set/postgresql/stdlib/query.sql index 94e2f11c1d..a41419840f 100644 --- a/internal/endtoend/testdata/update_set/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/update_set/postgresql/stdlib/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (name text not null, slug text not null); - -- name: UpdateSet :exec UPDATE foo SET name = $2 WHERE slug = $1; diff --git a/internal/endtoend/testdata/update_set/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/update_set/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..d1bc5fac60 --- /dev/null +++ b/internal/endtoend/testdata/update_set/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null, slug text not null); + diff --git a/internal/endtoend/testdata/update_set/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/update_set/postgresql/stdlib/sqlc.json index de427d069f..cd518671ac 100644 --- a/internal/endtoend/testdata/update_set/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/update_set/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "engine": "postgresql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/update_set/sqlite/go/db.go b/internal/endtoend/testdata/update_set/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/update_set/sqlite/go/db.go +++ b/internal/endtoend/testdata/update_set/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/update_set/sqlite/go/models.go b/internal/endtoend/testdata/update_set/sqlite/go/models.go index 5870a7e6fe..ee2c5c5577 100644 --- a/internal/endtoend/testdata/update_set/sqlite/go/models.go +++ b/internal/endtoend/testdata/update_set/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Name string Slug string diff --git a/internal/endtoend/testdata/update_set/sqlite/go/query.sql.go b/internal/endtoend/testdata/update_set/sqlite/go/query.sql.go index c70697aabd..99f8a5cbad 100644 --- a/internal/endtoend/testdata/update_set/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/update_set/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/update_set/sqlite/query.sql b/internal/endtoend/testdata/update_set/sqlite/query.sql index 5b2fb0e625..0f6603f503 100644 --- a/internal/endtoend/testdata/update_set/sqlite/query.sql +++ b/internal/endtoend/testdata/update_set/sqlite/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (name text not null, slug text not null); - /* name: UpdateSet :exec */ UPDATE foo SET name = ? WHERE slug = ?; diff --git a/internal/endtoend/testdata/update_set/sqlite/schema.sql b/internal/endtoend/testdata/update_set/sqlite/schema.sql new file mode 100644 index 0000000000..d1bc5fac60 --- /dev/null +++ b/internal/endtoend/testdata/update_set/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null, slug text not null); + diff --git a/internal/endtoend/testdata/update_set/sqlite/sqlc.json b/internal/endtoend/testdata/update_set/sqlite/sqlc.json index 13e65f3ffd..f8e8051087 100644 --- a/internal/endtoend/testdata/update_set/sqlite/sqlc.json +++ b/internal/endtoend/testdata/update_set/sqlite/sqlc.json @@ -5,7 +5,7 @@ "engine": "sqlite", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/update_set_multiple/mysql/go/db.go b/internal/endtoend/testdata/update_set_multiple/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/update_set_multiple/mysql/go/db.go +++ b/internal/endtoend/testdata/update_set_multiple/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/update_set_multiple/mysql/go/models.go b/internal/endtoend/testdata/update_set_multiple/mysql/go/models.go index 5870a7e6fe..ee2c5c5577 100644 --- a/internal/endtoend/testdata/update_set_multiple/mysql/go/models.go +++ b/internal/endtoend/testdata/update_set_multiple/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Name string Slug string diff --git a/internal/endtoend/testdata/update_set_multiple/mysql/go/query.sql.go b/internal/endtoend/testdata/update_set_multiple/mysql/go/query.sql.go index 2ebe8db8ff..7337a63ee1 100644 --- a/internal/endtoend/testdata/update_set_multiple/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/update_set_multiple/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/update_set_multiple/mysql/query.sql b/internal/endtoend/testdata/update_set_multiple/mysql/query.sql index a049f90c05..4ea1be4cfc 100644 --- a/internal/endtoend/testdata/update_set_multiple/mysql/query.sql +++ b/internal/endtoend/testdata/update_set_multiple/mysql/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (name text not null, slug text not null); - -- name: UpdateSetMultiple :exec UPDATE foo SET name = ?, slug = ?; diff --git a/internal/endtoend/testdata/update_set_multiple/mysql/schema.sql b/internal/endtoend/testdata/update_set_multiple/mysql/schema.sql new file mode 100644 index 0000000000..d1bc5fac60 --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/mysql/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null, slug text not null); + diff --git a/internal/endtoend/testdata/update_set_multiple/mysql/sqlc.json b/internal/endtoend/testdata/update_set_multiple/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/update_set_multiple/mysql/sqlc.json +++ b/internal/endtoend/testdata/update_set_multiple/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/db.go index 312ca8c296..3895084dc3 100644 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/models.go index 5870a7e6fe..ee2c5c5577 100644 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Name string Slug string diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/query.sql.go index 07d19d3bb6..80f80a3d4d 100644 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/query.sql index fcb6b24415..c5e471fd1b 100644 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (name text not null, slug text not null); - -- name: UpdateSetMultiple :exec UPDATE foo SET (name, slug) = ($2, $1); diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..d1bc5fac60 --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null, slug text not null); + diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/sqlc.json index 9403bd0279..d1244c9e7a 100644 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/db.go index 8a010ccc48..1e00549714 100644 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/models.go index 5870a7e6fe..ee2c5c5577 100644 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Name string Slug string diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/query.sql.go index 07d19d3bb6..80f80a3d4d 100644 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/query.sql index fcb6b24415..c5e471fd1b 100644 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (name text not null, slug text not null); - -- name: UpdateSetMultiple :exec UPDATE foo SET (name, slug) = ($2, $1); diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..d1bc5fac60 --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null, slug text not null); + diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/sqlc.json index 6645ccbd1b..32ede07158 100644 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/sqlc.json @@ -6,7 +6,7 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/models.go index 5870a7e6fe..ee2c5c5577 100644 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Name string Slug string diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/query.sql.go index 5e841d2062..10dc784a4c 100644 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/query.sql b/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/query.sql index fcb6b24415..c5e471fd1b 100644 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (name text not null, slug text not null); - -- name: UpdateSetMultiple :exec UPDATE foo SET (name, slug) = ($2, $1); diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..d1bc5fac60 --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null, slug text not null); + diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/sqlc.json index c72b6132d5..f717ca2e66 100644 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/update_set_multiple/sqlite/go/db.go b/internal/endtoend/testdata/update_set_multiple/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/update_set_multiple/sqlite/go/db.go +++ b/internal/endtoend/testdata/update_set_multiple/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/update_set_multiple/sqlite/go/models.go b/internal/endtoend/testdata/update_set_multiple/sqlite/go/models.go index 5870a7e6fe..ee2c5c5577 100644 --- a/internal/endtoend/testdata/update_set_multiple/sqlite/go/models.go +++ b/internal/endtoend/testdata/update_set_multiple/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Foo struct { Name string Slug string diff --git a/internal/endtoend/testdata/update_set_multiple/sqlite/go/query.sql.go b/internal/endtoend/testdata/update_set_multiple/sqlite/go/query.sql.go index 2ebe8db8ff..7337a63ee1 100644 --- a/internal/endtoend/testdata/update_set_multiple/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/update_set_multiple/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/update_set_multiple/sqlite/query.sql b/internal/endtoend/testdata/update_set_multiple/sqlite/query.sql index a049f90c05..4ea1be4cfc 100644 --- a/internal/endtoend/testdata/update_set_multiple/sqlite/query.sql +++ b/internal/endtoend/testdata/update_set_multiple/sqlite/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE foo (name text not null, slug text not null); - -- name: UpdateSetMultiple :exec UPDATE foo SET name = ?, slug = ?; diff --git a/internal/endtoend/testdata/update_set_multiple/sqlite/schema.sql b/internal/endtoend/testdata/update_set_multiple/sqlite/schema.sql new file mode 100644 index 0000000000..d1bc5fac60 --- /dev/null +++ b/internal/endtoend/testdata/update_set_multiple/sqlite/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (name text not null, slug text not null); + diff --git a/internal/endtoend/testdata/update_set_multiple/sqlite/sqlc.json b/internal/endtoend/testdata/update_set_multiple/sqlite/sqlc.json index fcb288cb35..d4963e751f 100644 --- a/internal/endtoend/testdata/update_set_multiple/sqlite/sqlc.json +++ b/internal/endtoend/testdata/update_set_multiple/sqlite/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "sqlite", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/update_set_on_conflict/issue.md b/internal/endtoend/testdata/update_set_on_conflict/issue.md new file mode 100644 index 0000000000..27f06c09ab --- /dev/null +++ b/internal/endtoend/testdata/update_set_on_conflict/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1128 \ No newline at end of file diff --git a/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/exec.json b/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/query.sql b/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/query.sql new file mode 100644 index 0000000000..3f9e9d9b86 --- /dev/null +++ b/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/query.sql @@ -0,0 +1,4 @@ +-- name: UpsertServer :exec +INSERT INTO servers(code, name) VALUES ($1, $2) +ON CONFLICT (code) +DO UPDATE SET name_typo = 1111; \ No newline at end of file diff --git a/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/schema.sql b/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..3ff1ccd6b3 --- /dev/null +++ b/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE servers ( + code varchar PRIMARY KEY, + name text NOT NULL +); \ No newline at end of file diff --git a/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..01489e0ffc --- /dev/null +++ b/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" \ No newline at end of file diff --git a/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/stderr.txt b/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/stderr.txt new file mode 100644 index 0000000000..adbb13a418 --- /dev/null +++ b/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/stderr.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:4:15: column "name_typo" of relation "servers" does not exist \ No newline at end of file diff --git a/internal/endtoend/testdata/update_two_table/mysql/go/db.go b/internal/endtoend/testdata/update_two_table/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/update_two_table/mysql/go/db.go +++ b/internal/endtoend/testdata/update_two_table/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/update_two_table/mysql/go/models.go b/internal/endtoend/testdata/update_two_table/mysql/go/models.go index 95c9c412cb..9caf3b15cb 100644 --- a/internal/endtoend/testdata/update_two_table/mysql/go/models.go +++ b/internal/endtoend/testdata/update_two_table/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/update_two_table/mysql/go/query.sql.go b/internal/endtoend/testdata/update_two_table/mysql/go/query.sql.go index 41b2aba1c2..2415782612 100644 --- a/internal/endtoend/testdata/update_two_table/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/update_two_table/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/update_two_table/mysql/query.sql b/internal/endtoend/testdata/update_two_table/mysql/query.sql index c67aa1fd3b..3f5c5de63a 100644 --- a/internal/endtoend/testdata/update_two_table/mysql/query.sql +++ b/internal/endtoend/testdata/update_two_table/mysql/query.sql @@ -1,18 +1,3 @@ --- https://github.com/sqlc-dev/sqlc/issues/1590 -CREATE TABLE authors ( - name text NOT NULL, - deleted_at datetime NOT NULL, - created_at datetime NOT NULL, - updated_at datetime NOT NULL -); - -CREATE TABLE books ( - is_amazing tinyint(1) NOT NULL, - deleted_at datetime NOT NULL, - created_at datetime NOT NULL, - updated_at datetime NOT NULL -); - -- name: DeleteAuthor :exec UPDATE authors, diff --git a/internal/endtoend/testdata/update_two_table/mysql/schema.sql b/internal/endtoend/testdata/update_two_table/mysql/schema.sql new file mode 100644 index 0000000000..ae7e76111c --- /dev/null +++ b/internal/endtoend/testdata/update_two_table/mysql/schema.sql @@ -0,0 +1,15 @@ +-- https://github.com/sqlc-dev/sqlc/issues/1590 +CREATE TABLE authors ( + name text NOT NULL, + deleted_at datetime NOT NULL, + created_at datetime NOT NULL, + updated_at datetime NOT NULL +); + +CREATE TABLE books ( + is_amazing tinyint(1) NOT NULL, + deleted_at datetime NOT NULL, + created_at datetime NOT NULL, + updated_at datetime NOT NULL +); + diff --git a/internal/endtoend/testdata/update_two_table/mysql/sqlc.json b/internal/endtoend/testdata/update_two_table/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/update_two_table/mysql/sqlc.json +++ b/internal/endtoend/testdata/update_two_table/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/upsert/sqlite/go/db.go b/internal/endtoend/testdata/upsert/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/upsert/sqlite/go/db.go +++ b/internal/endtoend/testdata/upsert/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/upsert/sqlite/go/models.go b/internal/endtoend/testdata/upsert/sqlite/go/models.go index 7b5405f24d..87f7059062 100644 --- a/internal/endtoend/testdata/upsert/sqlite/go/models.go +++ b/internal/endtoend/testdata/upsert/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Location struct { ID int64 Name string diff --git a/internal/endtoend/testdata/upsert/sqlite/go/query.sql.go b/internal/endtoend/testdata/upsert/sqlite/go/query.sql.go index 3b24b641c3..36115f665b 100644 --- a/internal/endtoend/testdata/upsert/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/upsert/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/upsert/sqlite/query.sql b/internal/endtoend/testdata/upsert/sqlite/query.sql index 6c9380341f..c34d70b407 100644 --- a/internal/endtoend/testdata/upsert/sqlite/query.sql +++ b/internal/endtoend/testdata/upsert/sqlite/query.sql @@ -1,15 +1,3 @@ --- https://github.com/sqlc-dev/sqlc/issues/1728 - -CREATE TABLE IF NOT EXISTS locations ( - id INTEGER PRIMARY KEY, - name TEXT NOT NULL, - address TEXT NOT NULL, - zip_code INT NOT NULL, - latitude REAL NOT NULL, - longitude REAL NOT NULL, - UNIQUE(name) -); - /* name: UpsertLocation :exec */ INSERT INTO locations ( name, diff --git a/internal/endtoend/testdata/upsert/sqlite/schema.sql b/internal/endtoend/testdata/upsert/sqlite/schema.sql new file mode 100644 index 0000000000..0ed6d048e5 --- /dev/null +++ b/internal/endtoend/testdata/upsert/sqlite/schema.sql @@ -0,0 +1,12 @@ +-- https://github.com/sqlc-dev/sqlc/issues/1728 + +CREATE TABLE IF NOT EXISTS locations ( + id INTEGER PRIMARY KEY, + name TEXT NOT NULL, + address TEXT NOT NULL, + zip_code INT NOT NULL, + latitude REAL NOT NULL, + longitude REAL NOT NULL, + UNIQUE(name) +); + diff --git a/internal/endtoend/testdata/upsert/sqlite/sqlc.json b/internal/endtoend/testdata/upsert/sqlite/sqlc.json index 13e65f3ffd..f8e8051087 100644 --- a/internal/endtoend/testdata/upsert/sqlite/sqlc.json +++ b/internal/endtoend/testdata/upsert/sqlite/sqlc.json @@ -5,7 +5,7 @@ "engine": "sqlite", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/valid_group_by_reference/mysql/go/db.go b/internal/endtoend/testdata/valid_group_by_reference/mysql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/valid_group_by_reference/mysql/go/db.go +++ b/internal/endtoend/testdata/valid_group_by_reference/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/valid_group_by_reference/mysql/go/models.go b/internal/endtoend/testdata/valid_group_by_reference/mysql/go/models.go index ff5f263f68..55aeb10d28 100644 --- a/internal/endtoend/testdata/valid_group_by_reference/mysql/go/models.go +++ b/internal/endtoend/testdata/valid_group_by_reference/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/valid_group_by_reference/mysql/go/query.sql.go b/internal/endtoend/testdata/valid_group_by_reference/mysql/go/query.sql.go index 4f8bd6bd41..4c1efd763e 100644 --- a/internal/endtoend/testdata/valid_group_by_reference/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/valid_group_by_reference/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/valid_group_by_reference/mysql/query.sql b/internal/endtoend/testdata/valid_group_by_reference/mysql/query.sql index e6d2530f49..9776cb058b 100644 --- a/internal/endtoend/testdata/valid_group_by_reference/mysql/query.sql +++ b/internal/endtoend/testdata/valid_group_by_reference/mysql/query.sql @@ -1,10 +1,3 @@ -CREATE TABLE authors ( - id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, - name text NOT NULL, - bio text, - UNIQUE(name) -); - -- name: ListAuthors :many SELECT id, name as full_name, bio FROM authors @@ -15,30 +8,6 @@ SELECT id, name as name, bio FROM authors GROUP BY name; - --- https://github.com/sqlc-dev/sqlc/issues/1315 - -CREATE TABLE IF NOT EXISTS weather_metrics -( - time TIMESTAMP NOT NULL, - timezone_shift INT NULL, - city_name TEXT NULL, - temp_c FLOAT NULL, - feels_like_c FLOAT NULL, - temp_min_c FLOAT NULL, - temp_max_c FLOAT NULL, - pressure_hpa FLOAT NULL, - humidity_percent FLOAT NULL, - wind_speed_ms FLOAT NULL, - wind_deg INT NULL, - rain_1h_mm FLOAT NULL, - rain_3h_mm FLOAT NULL, - snow_1h_mm FLOAT NULL, - snow_3h_mm FLOAT NULL, - clouds_percent INT NULL, - weather_type_id INT NULL -); - -- name: ListMetrics :many SELECT time_bucket('15 days', time) AS bucket, city_name, AVG(temp_c) FROM weather_metrics diff --git a/internal/endtoend/testdata/valid_group_by_reference/mysql/schema.sql b/internal/endtoend/testdata/valid_group_by_reference/mysql/schema.sql new file mode 100644 index 0000000000..db03e0d24a --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/mysql/schema.sql @@ -0,0 +1,26 @@ +CREATE TABLE authors ( + id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(10) NOT NULL, + bio text +); + +CREATE TABLE IF NOT EXISTS weather_metrics +( + time TIMESTAMP NOT NULL, + timezone_shift INT NULL, + city_name TEXT NULL, + temp_c FLOAT NULL, + feels_like_c FLOAT NULL, + temp_min_c FLOAT NULL, + temp_max_c FLOAT NULL, + pressure_hpa FLOAT NULL, + humidity_percent FLOAT NULL, + wind_speed_ms FLOAT NULL, + wind_deg INT NULL, + rain_1h_mm FLOAT NULL, + rain_3h_mm FLOAT NULL, + snow_1h_mm FLOAT NULL, + snow_3h_mm FLOAT NULL, + clouds_percent INT NULL, + weather_type_id INT NULL +); diff --git a/internal/endtoend/testdata/valid_group_by_reference/mysql/sqlc.json b/internal/endtoend/testdata/valid_group_by_reference/mysql/sqlc.json index 534b7e24e9..0390f67889 100644 --- a/internal/endtoend/testdata/valid_group_by_reference/mysql/sqlc.json +++ b/internal/endtoend/testdata/valid_group_by_reference/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/exec.json b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/go/db.go b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/go/db.go new file mode 100644 index 0000000000..3b320aa168 --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/go/models.go b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/go/models.go new file mode 100644 index 0000000000..55aeb10d28 --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/go/models.go @@ -0,0 +1,36 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package querytest + +import ( + "database/sql" + "time" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} + +type WeatherMetric struct { + Time time.Time + TimezoneShift sql.NullInt32 + CityName sql.NullString + TempC sql.NullFloat64 + FeelsLikeC sql.NullFloat64 + TempMinC sql.NullFloat64 + TempMaxC sql.NullFloat64 + PressureHpa sql.NullFloat64 + HumidityPercent sql.NullFloat64 + WindSpeedMs sql.NullFloat64 + WindDeg sql.NullInt32 + Rain1hMm sql.NullFloat64 + Rain3hMm sql.NullFloat64 + Snow1hMm sql.NullFloat64 + Snow3hMm sql.NullFloat64 + CloudsPercent sql.NullInt32 + WeatherTypeID sql.NullInt32 +} diff --git a/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/go/query.sql.go b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/go/query.sql.go new file mode 100644 index 0000000000..def227c020 --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/go/query.sql.go @@ -0,0 +1,105 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" + "time" +) + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name as name, bio +FROM authors +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan(&i.ID, &i.Name, &i.Bio); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listAuthorsIdenticalAlias = `-- name: ListAuthorsIdenticalAlias :many +SELECT id, name as name, bio +FROM authors +` + +func (q *Queries) ListAuthorsIdenticalAlias(ctx context.Context) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthorsIdenticalAlias) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan(&i.ID, &i.Name, &i.Bio); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listMetrics = `-- name: ListMetrics :many +SELECT date_trunc('day', time) AS bucket, city_name, AVG(temp_c) +FROM weather_metrics +WHERE time > NOW() - (6 * INTERVAL '1 month') +GROUP BY bucket, city_name +ORDER BY bucket DESC +` + +type ListMetricsRow struct { + Bucket time.Time + CityName sql.NullString + Avg float64 +} + +func (q *Queries) ListMetrics(ctx context.Context) ([]ListMetricsRow, error) { + rows, err := q.db.QueryContext(ctx, listMetrics) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListMetricsRow + for rows.Next() { + var i ListMetricsRow + if err := rows.Scan(&i.Bucket, &i.CityName, &i.Avg); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/query.sql b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/query.sql new file mode 100644 index 0000000000..839f5414c9 --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/query.sql @@ -0,0 +1,14 @@ +-- name: ListAuthors :many +SELECT id, name as name, bio +FROM authors; + +-- name: ListAuthorsIdenticalAlias :many +SELECT id, name as name, bio +FROM authors; + +-- name: ListMetrics :many +SELECT date_trunc('day', time) AS bucket, city_name, AVG(temp_c) +FROM weather_metrics +WHERE time > NOW() - (6 * INTERVAL '1 month') +GROUP BY bucket, city_name +ORDER BY bucket DESC; diff --git a/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/schema.sql b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/schema.sql new file mode 100644 index 0000000000..910e1da151 --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/schema.sql @@ -0,0 +1,26 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + +CREATE TABLE IF NOT EXISTS weather_metrics +( + time TIMESTAMP WITHOUT TIME ZONE NOT NULL, + timezone_shift INT NULL, + city_name TEXT NULL, + temp_c DOUBLE PRECISION NULL, + feels_like_c DOUBLE PRECISION NULL, + temp_min_c DOUBLE PRECISION NULL, + temp_max_c DOUBLE PRECISION NULL, + pressure_hpa DOUBLE PRECISION NULL, + humidity_percent DOUBLE PRECISION NULL, + wind_speed_ms DOUBLE PRECISION NULL, + wind_deg INT NULL, + rain_1h_mm DOUBLE PRECISION NULL, + rain_3h_mm DOUBLE PRECISION NULL, + snow_1h_mm DOUBLE PRECISION NULL, + snow_3h_mm DOUBLE PRECISION NULL, + clouds_percent INT NULL, + weather_type_id INT NULL +); diff --git a/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/sqlc.json b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/sqlc.json new file mode 100644 index 0000000000..a590361309 --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/valid_group_by_reference/postgresql/exec.json b/internal/endtoend/testdata/valid_group_by_reference/postgresql/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/postgresql/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/db.go b/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/db.go +++ b/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/models.go b/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/models.go index ff5f263f68..55aeb10d28 100644 --- a/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/models.go +++ b/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/query.sql.go b/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/query.sql.go index e6af3b89fb..07e773a507 100644 --- a/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest @@ -13,7 +13,6 @@ import ( const listAuthors = `-- name: ListAuthors :many SELECT id, name as name, bio FROM authors -GROUP BY name ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { @@ -42,7 +41,6 @@ func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { const listAuthorsIdenticalAlias = `-- name: ListAuthorsIdenticalAlias :many SELECT id, name as name, bio FROM authors -GROUP BY name ` func (q *Queries) ListAuthorsIdenticalAlias(ctx context.Context) ([]Author, error) { @@ -69,7 +67,7 @@ func (q *Queries) ListAuthorsIdenticalAlias(ctx context.Context) ([]Author, erro } const listMetrics = `-- name: ListMetrics :many -SELECT time_bucket('15 days', time) AS bucket, city_name, AVG(temp_c) +SELECT date_trunc('day', time) AS bucket, city_name, AVG(temp_c) FROM weather_metrics WHERE time > NOW() - (6 * INTERVAL '1 month') GROUP BY bucket, city_name @@ -77,7 +75,7 @@ ORDER BY bucket DESC ` type ListMetricsRow struct { - Bucket interface{} + Bucket int64 CityName sql.NullString Avg float64 } diff --git a/internal/endtoend/testdata/valid_group_by_reference/postgresql/query.sql b/internal/endtoend/testdata/valid_group_by_reference/postgresql/query.sql index 602295499e..839f5414c9 100644 --- a/internal/endtoend/testdata/valid_group_by_reference/postgresql/query.sql +++ b/internal/endtoend/testdata/valid_group_by_reference/postgresql/query.sql @@ -1,45 +1,13 @@ -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - name text NOT NULL, - bio text -); - -- name: ListAuthors :many SELECT id, name as name, bio -FROM authors -GROUP BY name; +FROM authors; -- name: ListAuthorsIdenticalAlias :many SELECT id, name as name, bio -FROM authors -GROUP BY name; - - --- https://github.com/sqlc-dev/sqlc/issues/1315 - -CREATE TABLE IF NOT EXISTS weather_metrics -( - time TIMESTAMP WITHOUT TIME ZONE NOT NULL, - timezone_shift INT NULL, - city_name TEXT NULL, - temp_c DOUBLE PRECISION NULL, - feels_like_c DOUBLE PRECISION NULL, - temp_min_c DOUBLE PRECISION NULL, - temp_max_c DOUBLE PRECISION NULL, - pressure_hpa DOUBLE PRECISION NULL, - humidity_percent DOUBLE PRECISION NULL, - wind_speed_ms DOUBLE PRECISION NULL, - wind_deg INT NULL, - rain_1h_mm DOUBLE PRECISION NULL, - rain_3h_mm DOUBLE PRECISION NULL, - snow_1h_mm DOUBLE PRECISION NULL, - snow_3h_mm DOUBLE PRECISION NULL, - clouds_percent INT NULL, - weather_type_id INT NULL -); +FROM authors; -- name: ListMetrics :many -SELECT time_bucket('15 days', time) AS bucket, city_name, AVG(temp_c) +SELECT date_trunc('day', time) AS bucket, city_name, AVG(temp_c) FROM weather_metrics WHERE time > NOW() - (6 * INTERVAL '1 month') GROUP BY bucket, city_name diff --git a/internal/endtoend/testdata/valid_group_by_reference/postgresql/schema.sql b/internal/endtoend/testdata/valid_group_by_reference/postgresql/schema.sql new file mode 100644 index 0000000000..910e1da151 --- /dev/null +++ b/internal/endtoend/testdata/valid_group_by_reference/postgresql/schema.sql @@ -0,0 +1,26 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + +CREATE TABLE IF NOT EXISTS weather_metrics +( + time TIMESTAMP WITHOUT TIME ZONE NOT NULL, + timezone_shift INT NULL, + city_name TEXT NULL, + temp_c DOUBLE PRECISION NULL, + feels_like_c DOUBLE PRECISION NULL, + temp_min_c DOUBLE PRECISION NULL, + temp_max_c DOUBLE PRECISION NULL, + pressure_hpa DOUBLE PRECISION NULL, + humidity_percent DOUBLE PRECISION NULL, + wind_speed_ms DOUBLE PRECISION NULL, + wind_deg INT NULL, + rain_1h_mm DOUBLE PRECISION NULL, + rain_3h_mm DOUBLE PRECISION NULL, + snow_1h_mm DOUBLE PRECISION NULL, + snow_3h_mm DOUBLE PRECISION NULL, + clouds_percent INT NULL, + weather_type_id INT NULL +); diff --git a/internal/endtoend/testdata/valid_group_by_reference/postgresql/sqlc.json b/internal/endtoend/testdata/valid_group_by_reference/postgresql/sqlc.json index af57681f66..a590361309 100644 --- a/internal/endtoend/testdata/valid_group_by_reference/postgresql/sqlc.json +++ b/internal/endtoend/testdata/valid_group_by_reference/postgresql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/vet_disable/query.sql b/internal/endtoend/testdata/vet_disable/query.sql index c1eb8d2219..50052de26b 100644 --- a/internal/endtoend/testdata/vet_disable/query.sql +++ b/internal/endtoend/testdata/vet_disable/query.sql @@ -1,6 +1,29 @@ --- name: SkipVet :exec +-- name: RunVetAll :exec +SELECT true; + +-- name: SkipVetAll :exec -- @sqlc-vet-disable SELECT true; --- name: RunVet :exec +-- name: SkipVetSingleLine :exec +-- @sqlc-vet-disable always-fail no-exec +SELECT true; + +-- name: SkipVetMultiLine :exec +-- @sqlc-vet-disable always-fail +-- @sqlc-vet-disable no-exec +SELECT true; + +-- name: SkipVet_always_fail :exec +-- @sqlc-vet-disable always-fail +SELECT true; + +-- name: SkipVet_no_exec :exec +-- @sqlc-vet-disable no-exec +SELECT true; + +-- name: SkipVetInvalidRule :exec +-- @sqlc-vet-disable always-fail +-- @sqlc-vet-disable block-delete +-- @sqlc-vet-disable no-exec SELECT true; \ No newline at end of file diff --git a/internal/endtoend/testdata/vet_disable/sqlc.yaml b/internal/endtoend/testdata/vet_disable/sqlc.yaml index ff7c1b5200..1e53bd7f2f 100644 --- a/internal/endtoend/testdata/vet_disable/sqlc.yaml +++ b/internal/endtoend/testdata/vet_disable/sqlc.yaml @@ -9,7 +9,13 @@ sql: out: "db" rules: - always-fail + - no-exec rules: - name: always-fail message: "Fail" rule: "true" + + - name: no-exec + message: "don't use exec" + rule: | + query.cmd == "exec" diff --git a/internal/endtoend/testdata/vet_disable/stderr.txt b/internal/endtoend/testdata/vet_disable/stderr.txt index 9acbb8b34b..3d9a6169f8 100644 --- a/internal/endtoend/testdata/vet_disable/stderr.txt +++ b/internal/endtoend/testdata/vet_disable/stderr.txt @@ -1 +1,5 @@ -query.sql: RunVet: always-fail: Fail +query.sql: RunVetAll: always-fail: Fail +query.sql: RunVetAll: no-exec: don't use exec +query.sql: SkipVet_always_fail: no-exec: don't use exec +query.sql: SkipVet_no_exec: always-fail: Fail +query.sql: SkipVetInvalidRule: rule-check error: rule "block-delete" does not exist in the config file \ No newline at end of file diff --git a/internal/endtoend/testdata/vet_explain/mysql/db/db.go b/internal/endtoend/testdata/vet_explain/mysql/db/db.go index c63a85a448..f2c0982087 100644 --- a/internal/endtoend/testdata/vet_explain/mysql/db/db.go +++ b/internal/endtoend/testdata/vet_explain/mysql/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package test diff --git a/internal/endtoend/testdata/vet_explain/mysql/db/models.go b/internal/endtoend/testdata/vet_explain/mysql/db/models.go index 31980e18a7..09b57f3649 100644 --- a/internal/endtoend/testdata/vet_explain/mysql/db/models.go +++ b/internal/endtoend/testdata/vet_explain/mysql/db/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package test @@ -99,7 +99,7 @@ func (ns NullDebugCset) Value() (driver.Value, error) { type Debug struct { ID int64 - Csmallint int32 + Csmallint int16 Cint int32 Cinteger int32 Cdecimal string @@ -110,7 +110,7 @@ type Debug struct { Cdouble float64 Cdec string Cfixed string - Ctinyint int32 + Ctinyint int8 Cbool bool Cmediumint int32 Cbit interface{} @@ -118,7 +118,7 @@ type Debug struct { Cdatetime time.Time Ctimestamp time.Time Ctime time.Time - Cyear int32 + Cyear int16 Cchar string Cvarchar string Cbinary []byte diff --git a/internal/endtoend/testdata/vet_explain/mysql/db/query.sql.go b/internal/endtoend/testdata/vet_explain/mysql/db/query.sql.go index 2b9c98158a..cef6fbff90 100644 --- a/internal/endtoend/testdata/vet_explain/mysql/db/query.sql.go +++ b/internal/endtoend/testdata/vet_explain/mysql/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package test @@ -316,7 +316,7 @@ SELECT id FROM debug WHERE Csmallint = ? LIMIT 1 ` -func (q *Queries) SelectByCsmallint(ctx context.Context, csmallint int32) (int64, error) { +func (q *Queries) SelectByCsmallint(ctx context.Context, csmallint int16) (int64, error) { row := q.db.QueryRowContext(ctx, selectByCsmallint, csmallint) var id int64 err := row.Scan(&id) @@ -376,7 +376,7 @@ SELECT id FROM debug WHERE Ctinyint = ? LIMIT 1 ` -func (q *Queries) SelectByCtinyint(ctx context.Context, ctinyint int32) (int64, error) { +func (q *Queries) SelectByCtinyint(ctx context.Context, ctinyint int8) (int64, error) { row := q.db.QueryRowContext(ctx, selectByCtinyint, ctinyint) var id int64 err := row.Scan(&id) @@ -424,7 +424,7 @@ SELECT id FROM debug WHERE Cyear = ? LIMIT 1 ` -func (q *Queries) SelectByCyear(ctx context.Context, cyear int32) (int64, error) { +func (q *Queries) SelectByCyear(ctx context.Context, cyear int16) (int64, error) { row := q.db.QueryRowContext(ctx, selectByCyear, cyear) var id int64 err := row.Scan(&id) diff --git a/internal/endtoend/testdata/vet_failures/query.sql b/internal/endtoend/testdata/vet_failures/query.sql index 718f3395c0..75e38b2caf 100644 --- a/internal/endtoend/testdata/vet_failures/query.sql +++ b/internal/endtoend/testdata/vet_failures/query.sql @@ -1,9 +1,3 @@ -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - name text NOT NULL, - bio text -); - -- name: GetAuthor :one SELECT * FROM authors WHERE id = $1 LIMIT 1; diff --git a/internal/endtoend/testdata/vet_failures/sqlc.yaml b/internal/endtoend/testdata/vet_failures/sqlc.yaml index 10d5246f8b..b1cff78c30 100644 --- a/internal/endtoend/testdata/vet_failures/sqlc.yaml +++ b/internal/endtoend/testdata/vet_failures/sqlc.yaml @@ -1,6 +1,6 @@ version: 2 sql: - - schema: "query.sql" + - schema: "schema.sql" queries: "query.sql" engine: "postgresql" gen: diff --git a/internal/endtoend/testdata/virtual_table/sqlite/go/db.go b/internal/endtoend/testdata/virtual_table/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/virtual_table/sqlite/go/db.go +++ b/internal/endtoend/testdata/virtual_table/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/virtual_table/sqlite/go/models.go b/internal/endtoend/testdata/virtual_table/sqlite/go/models.go index 4e29cf5582..c2d2118717 100644 --- a/internal/endtoend/testdata/virtual_table/sqlite/go/models.go +++ b/internal/endtoend/testdata/virtual_table/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/virtual_table/sqlite/go/query.sql.go b/internal/endtoend/testdata/virtual_table/sqlite/go/query.sql.go index ed1718f1ff..dab27d29cf 100644 --- a/internal/endtoend/testdata/virtual_table/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/virtual_table/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/wasm_plugin_sqlc_gen_test/gen/env.json b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_test/gen/env.json index e58a1fbef1..fa4beb305c 100644 --- a/internal/endtoend/testdata/wasm_plugin_sqlc_gen_test/gen/env.json +++ b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_test/gen/env.json @@ -1,6 +1,6 @@ { "env": [ - "SQLC_VERSION=v1.22.0", + "SQLC_VERSION=v1.30.0", "SQLC_DUMMY_VALUE=true" ] } diff --git a/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/query.sql b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/query.sql new file mode 100644 index 0000000000..75e38b2caf --- /dev/null +++ b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/query.sql @@ -0,0 +1,19 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = $1 LIMIT 1; + +-- name: ListAuthors :many +SELECT * FROM authors +ORDER BY name; + +-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +RETURNING *; + +-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = $1; diff --git a/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/schema.sql b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/schema.sql new file mode 100644 index 0000000000..b4fad78497 --- /dev/null +++ b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/sqlc.json b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/sqlc.json new file mode 100644 index 0000000000..bb84bddebf --- /dev/null +++ b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/sqlc.json @@ -0,0 +1,25 @@ +{ + "version": "2", + "sql": [ + { + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "codegen": [ + { + "out": "gen", + "plugin": "test" + } + ] + } + ], + "plugins": [ + { + "name": "test", + "wasm": { + "url": "https://github.com/sqlc-dev/sqlc-gen-unsafe-paths/releases/download/v0.1.1/sqlc-gen-unsafe-paths.wasm", + "sha256": "e53ac951dd41b1e4c365e757d9735886f7c8e92f2056ce0be9a5cfcf677c45d9" + } + } + ] +} diff --git a/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/stderr.txt b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/stderr.txt new file mode 100644 index 0000000000..8d664b0612 --- /dev/null +++ b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/stderr.txt @@ -0,0 +1,2 @@ +# package test +error generating code: invalid file output path: /tmp/unsafe.txt diff --git a/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/stderr_windows.txt b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/stderr_windows.txt new file mode 100644 index 0000000000..33d32af53a --- /dev/null +++ b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/stderr_windows.txt @@ -0,0 +1,2 @@ +# package test +error generating code: invalid file output path: D:/tmp/unsafe.txt diff --git a/internal/endtoend/testdata/where_collate/sqlite/go/db.go b/internal/endtoend/testdata/where_collate/sqlite/go/db.go index a457fb76b2..3b320aa168 100644 --- a/internal/endtoend/testdata/where_collate/sqlite/go/db.go +++ b/internal/endtoend/testdata/where_collate/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest diff --git a/internal/endtoend/testdata/where_collate/sqlite/go/models.go b/internal/endtoend/testdata/where_collate/sqlite/go/models.go index 18db6be849..33d29619ca 100644 --- a/internal/endtoend/testdata/where_collate/sqlite/go/models.go +++ b/internal/endtoend/testdata/where_collate/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package querytest -import () - type Account struct { ID string Name string diff --git a/internal/endtoend/testdata/where_collate/sqlite/go/query.sql.go b/internal/endtoend/testdata/where_collate/sqlite/go/query.sql.go index beb5919ab4..52633252b3 100644 --- a/internal/endtoend/testdata/where_collate/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/where_collate/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/where_collate/sqlite/query.sql b/internal/endtoend/testdata/where_collate/sqlite/query.sql index 6cc53a36a1..647c3ebc07 100644 --- a/internal/endtoend/testdata/where_collate/sqlite/query.sql +++ b/internal/endtoend/testdata/where_collate/sqlite/query.sql @@ -1,10 +1,3 @@ -CREATE TABLE accounts ( - id TEXT NOT NULL PRIMARY KEY, - name TEXT NOT NULL UNIQUE, - - UNIQUE (name COLLATE NOCASE) -); - -- name: GetAccountByName :one SELECT * FROM accounts WHERE name = ? COLLATE NOCASE diff --git a/internal/endtoend/testdata/where_collate/sqlite/schema.sql b/internal/endtoend/testdata/where_collate/sqlite/schema.sql new file mode 100644 index 0000000000..00a9defc2c --- /dev/null +++ b/internal/endtoend/testdata/where_collate/sqlite/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE accounts ( + id TEXT NOT NULL PRIMARY KEY, + name TEXT NOT NULL UNIQUE, + + UNIQUE (name COLLATE NOCASE) +); + diff --git a/internal/endtoend/testdata/where_collate/sqlite/sqlc.json b/internal/endtoend/testdata/where_collate/sqlite/sqlc.json index 3ed5eea856..ea4a23425f 100644 --- a/internal/endtoend/testdata/where_collate/sqlite/sqlc.json +++ b/internal/endtoend/testdata/where_collate/sqlite/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "engine": "sqlite", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "name": "querytest" } diff --git a/internal/endtoend/testdata/wrap_errors/mysql/db/db.go b/internal/endtoend/testdata/wrap_errors/mysql/db/db.go new file mode 100644 index 0000000000..fc409f7e3f --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/mysql/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package authors + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/wrap_errors/mysql/db/models.go b/internal/endtoend/testdata/wrap_errors/mysql/db/models.go new file mode 100644 index 0000000000..24e47df1ef --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/mysql/db/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package authors + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/wrap_errors/mysql/db/query.sql.go b/internal/endtoend/testdata/wrap_errors/mysql/db/query.sql.go new file mode 100644 index 0000000000..1cf96f1534 --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/mysql/db/query.sql.go @@ -0,0 +1,123 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package authors + +import ( + "context" + "database/sql" + "fmt" +) + +const createAuthor = `-- name: CreateAuthor :execlastid +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +` + +func (q *Queries) CreateAuthor(ctx context.Context) (int64, error) { + result, err := q.db.ExecContext(ctx, createAuthor) + if err != nil { + return 0, fmt.Errorf("query CreateAuthor: %w", err) + } + return result.LastInsertId() +} + +const deleteAuthorExec = `-- name: DeleteAuthorExec :exec +DELETE FROM authors +WHERE id = $1 +` + +func (q *Queries) DeleteAuthorExec(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, deleteAuthorExec) + if err != nil { + err = fmt.Errorf("query DeleteAuthorExec: %w", err) + } + return err +} + +const deleteAuthorExecLastID = `-- name: DeleteAuthorExecLastID :execlastid +DELETE FROM authors +WHERE id = $1 +` + +func (q *Queries) DeleteAuthorExecLastID(ctx context.Context) (int64, error) { + result, err := q.db.ExecContext(ctx, deleteAuthorExecLastID) + if err != nil { + return 0, fmt.Errorf("query DeleteAuthorExecLastID: %w", err) + } + return result.LastInsertId() +} + +const deleteAuthorExecResult = `-- name: DeleteAuthorExecResult :execresult +DELETE FROM authors +WHERE id = $1 +` + +func (q *Queries) DeleteAuthorExecResult(ctx context.Context) (sql.Result, error) { + result, err := q.db.ExecContext(ctx, deleteAuthorExecResult) + if err != nil { + err = fmt.Errorf("query DeleteAuthorExecResult: %w", err) + } + return result, err +} + +const deleteAuthorExecRows = `-- name: DeleteAuthorExecRows :execrows +DELETE FROM authors +WHERE id = $1 +` + +func (q *Queries) DeleteAuthorExecRows(ctx context.Context) (int64, error) { + result, err := q.db.ExecContext(ctx, deleteAuthorExecRows) + if err != nil { + return 0, fmt.Errorf("query DeleteAuthorExecRows: %w", err) + } + return result.RowsAffected() +} + +const getAuthor = `-- name: GetAuthor :one +SELECT id, name, bio FROM authors +WHERE id = $1 LIMIT 1 +` + +func (q *Queries) GetAuthor(ctx context.Context) (Author, error) { + row := q.db.QueryRowContext(ctx, getAuthor) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + if err != nil { + err = fmt.Errorf("query GetAuthor: %w", err) + } + return i, err +} + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name, bio FROM authors +ORDER BY name +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthors) + if err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan(&i.ID, &i.Name, &i.Bio); err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + if err := rows.Err(); err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + return items, nil +} diff --git a/internal/endtoend/testdata/wrap_errors/mysql/query.sql b/internal/endtoend/testdata/wrap_errors/mysql/query.sql new file mode 100644 index 0000000000..3f9971d942 --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/mysql/query.sql @@ -0,0 +1,30 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = $1 LIMIT 1; + +-- name: ListAuthors :many +SELECT * FROM authors +ORDER BY name; + +-- name: CreateAuthor :execlastid +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +); + +-- name: DeleteAuthorExec :exec +DELETE FROM authors +WHERE id = $1; + +-- name: DeleteAuthorExecRows :execrows +DELETE FROM authors +WHERE id = $1; + +-- name: DeleteAuthorExecLastID :execlastid +DELETE FROM authors +WHERE id = $1; + +-- name: DeleteAuthorExecResult :execresult +DELETE FROM authors +WHERE id = $1; diff --git a/internal/endtoend/testdata/wrap_errors/mysql/schema.sql b/internal/endtoend/testdata/wrap_errors/mysql/schema.sql new file mode 100644 index 0000000000..8d65cdb7b5 --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/mysql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGINT PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/wrap_errors/mysql/sqlc.yaml b/internal/endtoend/testdata/wrap_errors/mysql/sqlc.yaml new file mode 100644 index 0000000000..5b3b1ddc10 --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/mysql/sqlc.yaml @@ -0,0 +1,10 @@ +version: 2 +sql: + - schema: "schema.sql" + queries: "query.sql" + engine: "mysql" + gen: + go: + package: "authors" + out: "db" + wrap_errors: true diff --git a/internal/endtoend/testdata/wrap_errors/postgresql/pgx/db/db.go b/internal/endtoend/testdata/wrap_errors/postgresql/pgx/db/db.go new file mode 100644 index 0000000000..e1f93c6f1d --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/postgresql/pgx/db/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package authors + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/wrap_errors/postgresql/pgx/db/models.go b/internal/endtoend/testdata/wrap_errors/postgresql/pgx/db/models.go new file mode 100644 index 0000000000..7845b91a3d --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/postgresql/pgx/db/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package authors + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Author struct { + ID int64 + Name string + Bio pgtype.Text +} diff --git a/internal/endtoend/testdata/wrap_errors/postgresql/pgx/db/query.sql.go b/internal/endtoend/testdata/wrap_errors/postgresql/pgx/db/query.sql.go new file mode 100644 index 0000000000..82fee58e9c --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/postgresql/pgx/db/query.sql.go @@ -0,0 +1,122 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package authors + +import ( + "context" + "fmt" + + "github.com/jackc/pgx/v5/pgconn" + "github.com/jackc/pgx/v5/pgtype" +) + +const createAuthor = `-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +RETURNING id, name, bio +` + +type CreateAuthorParams struct { + Name string + Bio pgtype.Text +} + +func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { + row := q.db.QueryRow(ctx, createAuthor, arg.Name, arg.Bio) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + if err != nil { + err = fmt.Errorf("query CreateAuthor: %w", err) + } + return i, err +} + +const deleteAuthorExec = `-- name: DeleteAuthorExec :exec +DELETE FROM authors +WHERE id = $1 +` + +func (q *Queries) DeleteAuthorExec(ctx context.Context, id int64) error { + _, err := q.db.Exec(ctx, deleteAuthorExec, id) + if err != nil { + return fmt.Errorf("query DeleteAuthorExec: %w", err) + } + return nil +} + +const deleteAuthorExecLastID = `-- name: DeleteAuthorExecLastID :execlastid +DELETE FROM authors +WHERE id = $1 +` + +const deleteAuthorExecResult = `-- name: DeleteAuthorExecResult :execresult +DELETE FROM authors +WHERE id = $1 +` + +func (q *Queries) DeleteAuthorExecResult(ctx context.Context, id int64) (pgconn.CommandTag, error) { + result, err := q.db.Exec(ctx, deleteAuthorExecResult, id) + if err != nil { + err = fmt.Errorf("query DeleteAuthorExecResult: %w", err) + } + return result, err +} + +const deleteAuthorExecRows = `-- name: DeleteAuthorExecRows :execrows +DELETE FROM authors +WHERE id = $1 +` + +func (q *Queries) DeleteAuthorExecRows(ctx context.Context, id int64) (int64, error) { + result, err := q.db.Exec(ctx, deleteAuthorExecRows, id) + if err != nil { + return 0, fmt.Errorf("query DeleteAuthorExecRows: %w", err) + } + return result.RowsAffected(), nil +} + +const getAuthor = `-- name: GetAuthor :one +SELECT id, name, bio FROM authors +WHERE id = $1 LIMIT 1 +` + +func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { + row := q.db.QueryRow(ctx, getAuthor, id) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + if err != nil { + err = fmt.Errorf("query GetAuthor: %w", err) + } + return i, err +} + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name, bio FROM authors +ORDER BY name +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { + rows, err := q.db.Query(ctx, listAuthors) + if err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan(&i.ID, &i.Name, &i.Bio); err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + return items, nil +} diff --git a/internal/endtoend/testdata/wrap_errors/postgresql/pgx/query.sql b/internal/endtoend/testdata/wrap_errors/postgresql/pgx/query.sql new file mode 100644 index 0000000000..e0310a2257 --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/postgresql/pgx/query.sql @@ -0,0 +1,31 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = $1 LIMIT 1; + +-- name: ListAuthors :many +SELECT * FROM authors +ORDER BY name; + +-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +RETURNING *; + +-- name: DeleteAuthorExec :exec +DELETE FROM authors +WHERE id = $1; + +-- name: DeleteAuthorExecRows :execrows +DELETE FROM authors +WHERE id = $1; + +-- name: DeleteAuthorExecLastID :execlastid +DELETE FROM authors +WHERE id = $1; + +-- name: DeleteAuthorExecResult :execresult +DELETE FROM authors +WHERE id = $1; diff --git a/internal/endtoend/testdata/wrap_errors/postgresql/pgx/schema.sql b/internal/endtoend/testdata/wrap_errors/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..b4fad78497 --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/postgresql/pgx/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/wrap_errors/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/wrap_errors/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5a2adcda8e --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/postgresql/pgx/sqlc.yaml @@ -0,0 +1,11 @@ +version: 2 +sql: + - schema: "schema.sql" + queries: "query.sql" + engine: "postgresql" + gen: + go: + package: "authors" + sql_package: "pgx/v5" + out: "db" + wrap_errors: true diff --git a/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/db/db.go b/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/db/db.go new file mode 100644 index 0000000000..fc409f7e3f --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package authors + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/db/models.go b/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/db/models.go new file mode 100644 index 0000000000..24e47df1ef --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/db/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package authors + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/db/query.sql.go b/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/db/query.sql.go new file mode 100644 index 0000000000..e7026afd76 --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/db/query.sql.go @@ -0,0 +1,131 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package authors + +import ( + "context" + "database/sql" + "fmt" +) + +const createAuthor = `-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +RETURNING id, name, bio +` + +type CreateAuthorParams struct { + Name string + Bio sql.NullString +} + +func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { + row := q.db.QueryRowContext(ctx, createAuthor, arg.Name, arg.Bio) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + if err != nil { + err = fmt.Errorf("query CreateAuthor: %w", err) + } + return i, err +} + +const deleteAuthorExec = `-- name: DeleteAuthorExec :exec +DELETE FROM authors +WHERE id = $1 +` + +func (q *Queries) DeleteAuthorExec(ctx context.Context, id int64) error { + _, err := q.db.ExecContext(ctx, deleteAuthorExec, id) + if err != nil { + err = fmt.Errorf("query DeleteAuthorExec: %w", err) + } + return err +} + +const deleteAuthorExecLastID = `-- name: DeleteAuthorExecLastID :execlastid +DELETE FROM authors +WHERE id = $1 +` + +func (q *Queries) DeleteAuthorExecLastID(ctx context.Context, id int64) (int64, error) { + result, err := q.db.ExecContext(ctx, deleteAuthorExecLastID, id) + if err != nil { + return 0, fmt.Errorf("query DeleteAuthorExecLastID: %w", err) + } + return result.LastInsertId() +} + +const deleteAuthorExecResult = `-- name: DeleteAuthorExecResult :execresult +DELETE FROM authors +WHERE id = $1 +` + +func (q *Queries) DeleteAuthorExecResult(ctx context.Context, id int64) (sql.Result, error) { + result, err := q.db.ExecContext(ctx, deleteAuthorExecResult, id) + if err != nil { + err = fmt.Errorf("query DeleteAuthorExecResult: %w", err) + } + return result, err +} + +const deleteAuthorExecRows = `-- name: DeleteAuthorExecRows :execrows +DELETE FROM authors +WHERE id = $1 +` + +func (q *Queries) DeleteAuthorExecRows(ctx context.Context, id int64) (int64, error) { + result, err := q.db.ExecContext(ctx, deleteAuthorExecRows, id) + if err != nil { + return 0, fmt.Errorf("query DeleteAuthorExecRows: %w", err) + } + return result.RowsAffected() +} + +const getAuthor = `-- name: GetAuthor :one +SELECT id, name, bio FROM authors +WHERE id = $1 LIMIT 1 +` + +func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { + row := q.db.QueryRowContext(ctx, getAuthor, id) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + if err != nil { + err = fmt.Errorf("query GetAuthor: %w", err) + } + return i, err +} + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name, bio FROM authors +ORDER BY name +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthors) + if err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan(&i.ID, &i.Name, &i.Bio); err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + if err := rows.Err(); err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + return items, nil +} diff --git a/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/query.sql b/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..e0310a2257 --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/query.sql @@ -0,0 +1,31 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = $1 LIMIT 1; + +-- name: ListAuthors :many +SELECT * FROM authors +ORDER BY name; + +-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +RETURNING *; + +-- name: DeleteAuthorExec :exec +DELETE FROM authors +WHERE id = $1; + +-- name: DeleteAuthorExecRows :execrows +DELETE FROM authors +WHERE id = $1; + +-- name: DeleteAuthorExecLastID :execlastid +DELETE FROM authors +WHERE id = $1; + +-- name: DeleteAuthorExecResult :execresult +DELETE FROM authors +WHERE id = $1; diff --git a/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..b4fad78497 --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/sqlc.yaml b/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/sqlc.yaml new file mode 100644 index 0000000000..6827bf778a --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/sqlc.yaml @@ -0,0 +1,10 @@ +version: 2 +sql: + - schema: "schema.sql" + queries: "query.sql" + engine: "postgresql" + gen: + go: + package: "authors" + out: "db" + wrap_errors: true diff --git a/internal/endtoend/testdata/wrap_errors/sqlite/db/db.go b/internal/endtoend/testdata/wrap_errors/sqlite/db/db.go new file mode 100644 index 0000000000..fc409f7e3f --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/sqlite/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package authors + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/wrap_errors/sqlite/db/models.go b/internal/endtoend/testdata/wrap_errors/sqlite/db/models.go new file mode 100644 index 0000000000..24e47df1ef --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/sqlite/db/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 + +package authors + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/wrap_errors/sqlite/db/query.sql.go b/internal/endtoend/testdata/wrap_errors/sqlite/db/query.sql.go new file mode 100644 index 0000000000..766671117c --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/sqlite/db/query.sql.go @@ -0,0 +1,128 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package authors + +import ( + "context" + "database/sql" + "fmt" +) + +const createAuthor = `-- name: CreateAuthor :execlastid +INSERT INTO authors ( + name, bio +) VALUES ( + ?1, ?2 +) +` + +type CreateAuthorParams struct { + Name string + Bio sql.NullString +} + +func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (int64, error) { + result, err := q.db.ExecContext(ctx, createAuthor, arg.Name, arg.Bio) + if err != nil { + return 0, fmt.Errorf("query CreateAuthor: %w", err) + } + return result.LastInsertId() +} + +const deleteAuthorExec = `-- name: DeleteAuthorExec :exec +DELETE FROM authors +WHERE id = ?1 +` + +func (q *Queries) DeleteAuthorExec(ctx context.Context, id int64) error { + _, err := q.db.ExecContext(ctx, deleteAuthorExec, id) + if err != nil { + err = fmt.Errorf("query DeleteAuthorExec: %w", err) + } + return err +} + +const deleteAuthorExecLastID = `-- name: DeleteAuthorExecLastID :execlastid +DELETE FROM authors +WHERE id = ?1 +` + +func (q *Queries) DeleteAuthorExecLastID(ctx context.Context, id int64) (int64, error) { + result, err := q.db.ExecContext(ctx, deleteAuthorExecLastID, id) + if err != nil { + return 0, fmt.Errorf("query DeleteAuthorExecLastID: %w", err) + } + return result.LastInsertId() +} + +const deleteAuthorExecResult = `-- name: DeleteAuthorExecResult :execresult +DELETE FROM authors +WHERE id = ?1 +` + +func (q *Queries) DeleteAuthorExecResult(ctx context.Context, id int64) (sql.Result, error) { + result, err := q.db.ExecContext(ctx, deleteAuthorExecResult, id) + if err != nil { + err = fmt.Errorf("query DeleteAuthorExecResult: %w", err) + } + return result, err +} + +const deleteAuthorExecRows = `-- name: DeleteAuthorExecRows :execrows +DELETE FROM authors +WHERE id = ?1 +` + +func (q *Queries) DeleteAuthorExecRows(ctx context.Context, id int64) (int64, error) { + result, err := q.db.ExecContext(ctx, deleteAuthorExecRows, id) + if err != nil { + return 0, fmt.Errorf("query DeleteAuthorExecRows: %w", err) + } + return result.RowsAffected() +} + +const getAuthor = `-- name: GetAuthor :one +SELECT id, name, bio FROM authors +WHERE id = ?1 LIMIT 1 +` + +func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { + row := q.db.QueryRowContext(ctx, getAuthor, id) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + if err != nil { + err = fmt.Errorf("query GetAuthor: %w", err) + } + return i, err +} + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name, bio FROM authors +ORDER BY name +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthors) + if err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan(&i.ID, &i.Name, &i.Bio); err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + if err := rows.Err(); err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + return items, nil +} diff --git a/internal/endtoend/testdata/wrap_errors/sqlite/query.sql b/internal/endtoend/testdata/wrap_errors/sqlite/query.sql new file mode 100644 index 0000000000..2db6403c8b --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/sqlite/query.sql @@ -0,0 +1,30 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = ?1 LIMIT 1; + +-- name: ListAuthors :many +SELECT * FROM authors +ORDER BY name; + +-- name: CreateAuthor :execlastid +INSERT INTO authors ( + name, bio +) VALUES ( + ?1, ?2 +); + +-- name: DeleteAuthorExec :exec +DELETE FROM authors +WHERE id = ?1; + +-- name: DeleteAuthorExecRows :execrows +DELETE FROM authors +WHERE id = ?1; + +-- name: DeleteAuthorExecLastID :execlastid +DELETE FROM authors +WHERE id = ?1; + +-- name: DeleteAuthorExecResult :execresult +DELETE FROM authors +WHERE id = ?1; diff --git a/internal/endtoend/testdata/wrap_errors/sqlite/schema.sql b/internal/endtoend/testdata/wrap_errors/sqlite/schema.sql new file mode 100644 index 0000000000..8d65cdb7b5 --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/sqlite/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGINT PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/wrap_errors/sqlite/sqlc.yaml b/internal/endtoend/testdata/wrap_errors/sqlite/sqlc.yaml new file mode 100644 index 0000000000..de726297c7 --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/sqlite/sqlc.yaml @@ -0,0 +1,10 @@ +version: 2 +sql: + - schema: "schema.sql" + queries: "query.sql" + engine: "sqlite" + gen: + go: + package: "authors" + out: "db" + wrap_errors: true diff --git a/internal/endtoend/testdata/yaml_overrides/go/db.go b/internal/endtoend/testdata/yaml_overrides/go/db.go index d0eacb407b..9c19dd4a09 100644 --- a/internal/endtoend/testdata/yaml_overrides/go/db.go +++ b/internal/endtoend/testdata/yaml_overrides/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/yaml_overrides/go/models.go b/internal/endtoend/testdata/yaml_overrides/go/models.go index fa5a1ad177..051e7672e0 100644 --- a/internal/endtoend/testdata/yaml_overrides/go/models.go +++ b/internal/endtoend/testdata/yaml_overrides/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.30.0 package override diff --git a/internal/endtoend/testdata/yaml_overrides/go/query.sql.go b/internal/endtoend/testdata/yaml_overrides/go/query.sql.go new file mode 100644 index 0000000000..0faba2cde4 --- /dev/null +++ b/internal/endtoend/testdata/yaml_overrides/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: query.sql + +package override + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/yaml_overrides/sql/query.sql b/internal/endtoend/testdata/yaml_overrides/sql/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/yaml_overrides/sql/query.sql +++ b/internal/endtoend/testdata/yaml_overrides/sql/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/vet_test.go b/internal/endtoend/vet_test.go index f5fc47ac92..011c032c2e 100644 --- a/internal/endtoend/vet_test.go +++ b/internal/endtoend/vet_test.go @@ -1,5 +1,4 @@ //go:build examples -// +build examples package main @@ -9,10 +8,12 @@ import ( "fmt" "os" "path/filepath" + "strings" "testing" "github.com/sqlc-dev/sqlc/internal/cmd" "github.com/sqlc-dev/sqlc/internal/sqltest" + "github.com/sqlc-dev/sqlc/internal/sqltest/local" ) func findSchema(t *testing.T, path string) (string, bool) { @@ -31,11 +32,6 @@ func TestExamplesVet(t *testing.T) { t.Parallel() ctx := context.Background() - authToken := os.Getenv("SQLC_AUTH_TOKEN") - if authToken == "" { - t.Skip("missing auth token") - } - examples, err := filepath.Abs(filepath.Join("..", "..", "examples")) if err != nil { t.Fatal(err) @@ -56,21 +52,28 @@ func TestExamplesVet(t *testing.T) { path := filepath.Join(examples, tc) if tc != "kotlin" && tc != "python" { - if s, found := findSchema(t, filepath.Join(path, "mysql")); found { - db, cleanup := sqltest.CreateMySQLDatabase(t, tc, []string{s}) - defer db.Close() - defer cleanup() - } if s, found := findSchema(t, filepath.Join(path, "sqlite")); found { dsn := fmt.Sprintf("file:%s?mode=memory&cache=shared", tc) db, cleanup := sqltest.CreateSQLiteDatabase(t, dsn, []string{s}) defer db.Close() defer cleanup() } + if s, found := findSchema(t, filepath.Join(path, "mysql")); found { + uri := local.MySQL(t, []string{s}) + os.Setenv(fmt.Sprintf("VET_TEST_EXAMPLES_MYSQL_%s", strings.ToUpper(tc)), uri) + } + if s, found := findSchema(t, filepath.Join(path, "postgresql")); found { + uri := local.PostgreSQL(t, []string{s}) + os.Setenv(fmt.Sprintf("VET_TEST_EXAMPLES_POSTGRES_%s", strings.ToUpper(tc)), uri) + } } var stderr bytes.Buffer - err := cmd.Vet(ctx, cmd.Env{}, path, "", &stderr) + opts := &cmd.Options{ + Stderr: &stderr, + Env: cmd.Env{}, + } + err := cmd.Vet(ctx, path, "", opts) if err != nil { t.Fatalf("sqlc vet failed: %s %s", err, stderr.String()) } diff --git a/internal/engine/dolphin/convert.go b/internal/engine/dolphin/convert.go index 5cca536976..33b89ae8f4 100644 --- a/internal/engine/dolphin/convert.go +++ b/internal/engine/dolphin/convert.go @@ -4,11 +4,11 @@ import ( "log" "strings" - pcast "github.com/pingcap/tidb/parser/ast" - "github.com/pingcap/tidb/parser/mysql" - "github.com/pingcap/tidb/parser/opcode" - driver "github.com/pingcap/tidb/parser/test_driver" - "github.com/pingcap/tidb/parser/types" + pcast "github.com/pingcap/tidb/pkg/parser/ast" + "github.com/pingcap/tidb/pkg/parser/mysql" + "github.com/pingcap/tidb/pkg/parser/opcode" + driver "github.com/pingcap/tidb/pkg/parser/test_driver" + "github.com/pingcap/tidb/pkg/parser/types" "github.com/sqlc-dev/sqlc/internal/debug" "github.com/sqlc-dev/sqlc/internal/sql/ast" @@ -43,20 +43,10 @@ func (c *cc) convertAlterTableStmt(n *pcast.AlterTableStmt) ast.Node { case pcast.AlterTableAddColumns: for _, def := range spec.NewColumns { name := def.Name.String() - columnDef := ast.ColumnDef{ - Colname: def.Name.String(), - TypeName: &ast.TypeName{Name: types.TypeToStr(def.Tp.GetType(), def.Tp.GetCharset())}, - IsNotNull: isNotNull(def), - IsUnsigned: isUnsigned(def), - } - if def.Tp.GetFlen() >= 0 { - length := def.Tp.GetFlen() - columnDef.Length = &length - } alt.Cmds.Items = append(alt.Cmds.Items, &ast.AlterTableCmd{ Name: &name, Subtype: ast.AT_AddColumn, - Def: &columnDef, + Def: convertColumnDef(def), }) } @@ -77,36 +67,16 @@ func (c *cc) convertAlterTableStmt(n *pcast.AlterTableStmt) ast.Node { for _, def := range spec.NewColumns { name := def.Name.String() - columnDef := ast.ColumnDef{ - Colname: def.Name.String(), - TypeName: &ast.TypeName{Name: types.TypeToStr(def.Tp.GetType(), def.Tp.GetCharset())}, - IsNotNull: isNotNull(def), - IsUnsigned: isUnsigned(def), - } - if def.Tp.GetFlen() >= 0 { - length := def.Tp.GetFlen() - columnDef.Length = &length - } alt.Cmds.Items = append(alt.Cmds.Items, &ast.AlterTableCmd{ Name: &name, Subtype: ast.AT_AddColumn, - Def: &columnDef, + Def: convertColumnDef(def), }) } case pcast.AlterTableModifyColumn: for _, def := range spec.NewColumns { name := def.Name.String() - columnDef := ast.ColumnDef{ - Colname: def.Name.String(), - TypeName: &ast.TypeName{Name: types.TypeToStr(def.Tp.GetType(), def.Tp.GetCharset())}, - IsNotNull: isNotNull(def), - IsUnsigned: isUnsigned(def), - } - if def.Tp.GetFlen() >= 0 { - length := def.Tp.GetFlen() - columnDef.Length = &length - } alt.Cmds.Items = append(alt.Cmds.Items, &ast.AlterTableCmd{ Name: &name, Subtype: ast.AT_DropColumn, @@ -114,7 +84,7 @@ func (c *cc) convertAlterTableStmt(n *pcast.AlterTableStmt) ast.Node { alt.Cmds.Items = append(alt.Cmds.Items, &ast.AlterTableCmd{ Name: &name, Subtype: ast.AT_AddColumn, - Def: &columnDef, + Def: convertColumnDef(def), }) } @@ -249,37 +219,7 @@ func (c *cc) convertCreateTableStmt(n *pcast.CreateTableStmt) ast.Node { create.ReferTable = parseTableName(n.ReferTable) } for _, def := range n.Cols { - var vals *ast.List - if len(def.Tp.GetElems()) > 0 { - vals = &ast.List{} - for i := range def.Tp.GetElems() { - vals.Items = append(vals.Items, &ast.String{ - Str: def.Tp.GetElems()[i], - }) - } - } - comment := "" - for _, opt := range def.Options { - switch opt.Tp { - case pcast.ColumnOptionComment: - if value, ok := opt.Expr.(*driver.ValueExpr); ok { - comment = value.GetString() - } - } - } - columnDef := ast.ColumnDef{ - Colname: def.Name.String(), - TypeName: &ast.TypeName{Name: types.TypeToStr(def.Tp.GetType(), def.Tp.GetCharset())}, - IsNotNull: isNotNull(def), - IsUnsigned: isUnsigned(def), - Comment: comment, - Vals: vals, - } - if def.Tp.GetFlen() >= 0 { - length := def.Tp.GetFlen() - columnDef.Length = &length - } - create.Cols = append(create.Cols, &columnDef) + create.Cols = append(create.Cols, convertColumnDef(def)) } for _, opt := range n.Options { switch opt.Tp { @@ -290,6 +230,41 @@ func (c *cc) convertCreateTableStmt(n *pcast.CreateTableStmt) ast.Node { return create } +func convertColumnDef(def *pcast.ColumnDef) *ast.ColumnDef { + var vals *ast.List + if len(def.Tp.GetElems()) > 0 { + vals = &ast.List{} + for i := range def.Tp.GetElems() { + vals.Items = append(vals.Items, &ast.String{ + Str: def.Tp.GetElems()[i], + }) + } + } + comment := "" + for _, opt := range def.Options { + switch opt.Tp { + case pcast.ColumnOptionComment: + if value, ok := opt.Expr.(*driver.ValueExpr); ok { + comment = value.GetString() + } + } + } + columnDef := ast.ColumnDef{ + Colname: def.Name.String(), + TypeName: &ast.TypeName{Name: types.TypeToStr(def.Tp.GetType(), def.Tp.GetCharset())}, + IsNotNull: isNotNull(def), + IsUnsigned: isUnsigned(def), + Comment: comment, + Vals: vals, + } + if def.Tp.GetFlen() >= 0 { + length := def.Tp.GetFlen() + columnDef.Length = &length + } + + return &columnDef +} + func (c *cc) convertColumnNameExpr(n *pcast.ColumnNameExpr) *ast.ColumnRef { var items []ast.Node if schema := n.Name.Schema.String(); schema != "" { @@ -419,7 +394,6 @@ func (c *cc) convertInsertStmt(n *pcast.InsertStmt) *ast.InsertStmt { panic("expected range var") } - // debug.Dump(n) insert := &ast.InsertStmt{ Relation: rangeVar, Cols: c.convertColumnNames(n.Columns), @@ -746,16 +720,13 @@ func (c *cc) convertCaseExpr(n *pcast.CaseExpr) ast.Node { list.Items = append(list.Items, c.convertWhenClause(n)) } return &ast.CaseExpr{ + Arg: c.convert(n.Value), Args: list, Defresult: c.convert(n.ElseClause), Location: n.OriginTextPosition(), } } -func (c *cc) convertChangeStmt(n *pcast.ChangeStmt) ast.Node { - return todo(n) -} - func (c *cc) convertCleanupTableLockStmt(n *pcast.CleanupTableLockStmt) ast.Node { return todo(n) } @@ -940,10 +911,6 @@ func (c *cc) convertHavingClause(n *pcast.HavingClause) ast.Node { return c.convert(n.Expr) } -func (c *cc) convertIndexAdviseStmt(n *pcast.IndexAdviseStmt) ast.Node { - return todo(n) -} - func (c *cc) convertIndexLockAndAlgorithm(n *pcast.IndexLockAndAlgorithm) ast.Node { return todo(n) } @@ -1022,7 +989,30 @@ func (c *cc) convertLockTablesStmt(n *pcast.LockTablesStmt) ast.Node { } func (c *cc) convertMatchAgainst(n *pcast.MatchAgainst) ast.Node { - return todo(n) + searchTerm := c.convert(n.Against) + + stringSearchTerm := &ast.TypeCast{ + Arg: searchTerm, + TypeName: &ast.TypeName{ + Name: "text", // Use 'text' type which maps to string in Go + }, + Location: n.OriginTextPosition(), + } + + matchOperation := &ast.A_Const{ + Val: &ast.String{Str: "MATCH_AGAINST"}, + } + + return &ast.A_Expr{ + Name: &ast.List{ + Items: []ast.Node{ + &ast.String{Str: "AGAINST"}, + }, + }, + Lexpr: matchOperation, + Rexpr: stringSearchTerm, + Location: n.OriginTextPosition(), + } } func (c *cc) convertMaxValueExpr(n *pcast.MaxValueExpr) ast.Node { @@ -1050,18 +1040,7 @@ func (c *cc) convertOrderByClause(n *pcast.OrderByClause) ast.Node { } list := &ast.List{Items: []ast.Node{}} for _, item := range n.Items { - switch item.Expr.(type) { - case *pcast.CaseExpr: - list.Items = append(list.Items, &ast.CaseWhen{ - Expr: c.convert(item.Expr), - Location: item.Expr.OriginTextPosition(), - }) - case *pcast.ColumnNameExpr: - list.Items = append(list.Items, &ast.CaseExpr{ - Xpr: c.convert(item.Expr), - Location: item.Expr.OriginTextPosition(), - }) - } + list.Items = append(list.Items, c.convert(item.Expr)) } return list } @@ -1222,7 +1201,12 @@ func (c *cc) convertSetOprType(n *pcast.SetOprType) (op ast.SetOperation, all bo func (c *cc) convertSetOprSelectList(n *pcast.SetOprSelectList) ast.Node { selectStmts := make([]*ast.SelectStmt, len(n.Selects)) for i, node := range n.Selects { - selectStmts[i] = c.convertSelectStmt(node.(*pcast.SelectStmt)) + switch node := node.(type) { + case *pcast.SelectStmt: + selectStmts[i] = c.convertSelectStmt(node) + case *pcast.SetOprSelectList: + selectStmts[i] = c.convertSetOprSelectList(node).(*ast.SelectStmt) + } } op, all := c.convertSetOprType(n.AfterSetOperator) @@ -1348,7 +1332,7 @@ func (c *cc) convertTableSource(node *pcast.TableSource) ast.Node { alias := node.AsName.String() switch n := node.Source.(type) { - case *pcast.SelectStmt: + case *pcast.SelectStmt, *pcast.SetOprStmt: rs := &ast.RangeSubselect{ Subquery: c.convert(n), } @@ -1536,9 +1520,6 @@ func (c *cc) convert(node pcast.Node) ast.Node { case *pcast.CaseExpr: return c.convertCaseExpr(n) - case *pcast.ChangeStmt: - return c.convertChangeStmt(n) - case *pcast.CleanupTableLockStmt: return c.convertCleanupTableLockStmt(n) @@ -1674,9 +1655,6 @@ func (c *cc) convert(node pcast.Node) ast.Node { case *pcast.HavingClause: return c.convertHavingClause(n) - case *pcast.IndexAdviseStmt: - return c.convertIndexAdviseStmt(n) - case *pcast.IndexLockAndAlgorithm: return c.convertIndexLockAndAlgorithm(n) diff --git a/internal/engine/dolphin/parse.go b/internal/engine/dolphin/parse.go index 676362c448..537f7ad64f 100644 --- a/internal/engine/dolphin/parse.go +++ b/internal/engine/dolphin/parse.go @@ -7,10 +7,10 @@ import ( "strconv" "strings" - "github.com/pingcap/tidb/parser" - _ "github.com/pingcap/tidb/parser/test_driver" + "github.com/pingcap/tidb/pkg/parser" + _ "github.com/pingcap/tidb/pkg/parser/test_driver" - "github.com/sqlc-dev/sqlc/internal/metadata" + "github.com/sqlc-dev/sqlc/internal/source" "github.com/sqlc-dev/sqlc/internal/sql/ast" "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" ) @@ -86,8 +86,8 @@ func (p *Parser) Parse(r io.Reader) ([]ast.Statement, error) { } // https://dev.mysql.com/doc/refman/8.0/en/comments.html -func (p *Parser) CommentSyntax() metadata.CommentSyntax { - return metadata.CommentSyntax{ +func (p *Parser) CommentSyntax() source.CommentSyntax { + return source.CommentSyntax{ Dash: true, SlashStar: true, Hash: true, diff --git a/internal/engine/dolphin/stdlib.go b/internal/engine/dolphin/stdlib.go index 37de5d7cb6..41469ca49d 100644 --- a/internal/engine/dolphin/stdlib.go +++ b/internal/engine/dolphin/stdlib.go @@ -2388,6 +2388,15 @@ func defaultSchema(name string) *catalog.Schema { Args: []*catalog.Argument{}, ReturnType: &ast.TypeName{Name: "datetime"}, }, + { + Name: "NEXTVAL", + Args: []*catalog.Argument{ + { + Type: &ast.TypeName{Name: "any"}, + }, + }, + ReturnType: &ast.TypeName{Name: "int"}, + }, { Name: "NOW", Args: []*catalog.Argument{ diff --git a/internal/engine/dolphin/utils.go b/internal/engine/dolphin/utils.go index dd3b8f58d8..e920489e6a 100644 --- a/internal/engine/dolphin/utils.go +++ b/internal/engine/dolphin/utils.go @@ -1,8 +1,8 @@ package dolphin import ( - pcast "github.com/pingcap/tidb/parser/ast" - "github.com/pingcap/tidb/parser/mysql" + pcast "github.com/pingcap/tidb/pkg/parser/ast" + "github.com/pingcap/tidb/pkg/parser/mysql" "github.com/sqlc-dev/sqlc/internal/sql/ast" ) @@ -52,6 +52,9 @@ func convertToRangeVarList(list *ast.List, result *ast.List) { if !ok { if list, check := rel.Larg.(*ast.List); check { convertToRangeVarList(list, result) + } else if subselect, check := rel.Larg.(*ast.RangeSubselect); check { + // Handle subqueries in JOIN clauses + result.Items = append(result.Items, subselect) } else { panic("expected range var") } @@ -64,6 +67,9 @@ func convertToRangeVarList(list *ast.List, result *ast.List) { if !ok { if list, check := rel.Rarg.(*ast.List); check { convertToRangeVarList(list, result) + } else if subselect, check := rel.Rarg.(*ast.RangeSubselect); check { + // Handle subqueries in JOIN clauses + result.Items = append(result.Items, subselect) } else { panic("expected range var") } @@ -75,6 +81,9 @@ func convertToRangeVarList(list *ast.List, result *ast.List) { case *ast.RangeVar: result.Items = append(result.Items, rel) + case *ast.RangeSubselect: + result.Items = append(result.Items, rel) + default: panic("expected range var") } diff --git a/internal/engine/postgresql/analyzer/analyze.go b/internal/engine/postgresql/analyzer/analyze.go new file mode 100644 index 0000000000..5a08fa98ec --- /dev/null +++ b/internal/engine/postgresql/analyzer/analyze.go @@ -0,0 +1,322 @@ +package analyzer + +import ( + "context" + "errors" + "fmt" + "strings" + "sync" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" + "github.com/jackc/pgx/v5/pgxpool" + + core "github.com/sqlc-dev/sqlc/internal/analysis" + "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/dbmanager" + "github.com/sqlc-dev/sqlc/internal/opts" + "github.com/sqlc-dev/sqlc/internal/shfmt" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/named" + "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" +) + +type Analyzer struct { + db config.Database + client dbmanager.Client + pool *pgxpool.Pool + dbg opts.Debug + replacer *shfmt.Replacer + formats sync.Map + columns sync.Map + tables sync.Map +} + +func New(client dbmanager.Client, db config.Database) *Analyzer { + return &Analyzer{ + db: db, + dbg: opts.DebugFromEnv(), + client: client, + replacer: shfmt.NewReplacer(nil), + } +} + +const columnQuery = ` +SELECT + pg_catalog.format_type(pg_attribute.atttypid, pg_attribute.atttypmod) AS data_type, + pg_attribute.attnotnull as not_null, + pg_attribute.attndims as array_dims +FROM + pg_catalog.pg_attribute +WHERE + attrelid = $1 + AND attnum = $2; +` + +const tableQuery = ` +SELECT + pg_class.relname as table_name, + pg_namespace.nspname as schema_name +FROM + pg_catalog.pg_class +JOIN + pg_catalog.pg_namespace ON pg_namespace.oid = pg_class.relnamespace +WHERE + pg_class.oid = $1; +` + +type pgTable struct { + TableName string `db:"table_name"` + SchemaName string `db:"schema_name"` +} + +// Cache these types in memory +func (a *Analyzer) tableInfo(ctx context.Context, oid uint32) (*pgTable, error) { + ctbl, ok := a.tables.Load(oid) + if ok { + return ctbl.(*pgTable), nil + } + rows, err := a.pool.Query(ctx, tableQuery, oid) + if err != nil { + return nil, err + } + tbl, err := pgx.CollectOneRow(rows, pgx.RowToStructByName[pgTable]) + if err != nil { + return nil, err + } + a.tables.Store(oid, &tbl) + return &tbl, nil +} + +type pgColumn struct { + DataType string `db:"data_type"` + NotNull bool `db:"not_null"` + ArrayDims int `db:"array_dims"` +} + +type columnKey struct { + OID uint32 + Attr uint16 +} + +// Cache these types in memory +func (a *Analyzer) columnInfo(ctx context.Context, field pgconn.FieldDescription) (*pgColumn, error) { + key := columnKey{field.TableOID, field.TableAttributeNumber} + cinfo, ok := a.columns.Load(key) + if ok { + return cinfo.(*pgColumn), nil + } + rows, err := a.pool.Query(ctx, columnQuery, field.TableOID, int16(field.TableAttributeNumber)) + if err != nil { + return nil, err + } + col, err := pgx.CollectOneRow(rows, pgx.RowToStructByName[pgColumn]) + if err != nil { + return nil, err + } + a.columns.Store(key, &col) + return &col, nil +} + +type formatKey struct { + OID uint32 + Modified int32 +} + +// TODO: Use PGX to do the lookup for basic OID types +func (a *Analyzer) formatType(ctx context.Context, oid uint32, modifier int32) (string, error) { + key := formatKey{oid, modifier} + ftyp, ok := a.formats.Load(key) + if ok { + return ftyp.(string), nil + } + rows, err := a.pool.Query(ctx, `SELECT format_type($1, $2)`, oid, modifier) + if err != nil { + return "", err + } + dt, err := pgx.CollectOneRow(rows, pgx.RowTo[string]) + if err != nil { + return "", err + } + a.formats.Store(key, dt) + return dt, err +} + +// TODO: This is bad +func rewriteType(dt string) string { + switch { + case strings.HasPrefix(dt, "character("): + return "pg_catalog.bpchar" + case strings.HasPrefix(dt, "character varying"): + return "pg_catalog.varchar" + case strings.HasPrefix(dt, "bit varying"): + return "pg_catalog.varbit" + case strings.HasPrefix(dt, "bit("): + return "pg_catalog.bit" + } + switch dt { + case "bpchar": + return "pg_catalog.bpchar" + case "timestamp without time zone": + return "pg_catalog.timestamp" + case "timestamp with time zone": + return "pg_catalog.timestamptz" + case "time without time zone": + return "pg_catalog.time" + case "time with time zone": + return "pg_catalog.timetz" + } + return dt +} + +func parseType(dt string) (string, bool, int) { + size := 0 + for { + trimmed := strings.TrimSuffix(dt, "[]") + if trimmed == dt { + return rewriteType(dt), size > 0, size + } + size += 1 + dt = trimmed + } +} + +// Don't create a database per query +func (a *Analyzer) Analyze(ctx context.Context, n ast.Node, query string, migrations []string, ps *named.ParamSet) (*core.Analysis, error) { + extractSqlErr := func(e error) error { + var pgErr *pgconn.PgError + if errors.As(e, &pgErr) { + return &sqlerr.Error{ + Code: pgErr.Code, + Message: pgErr.Message, + Location: max(n.Pos()+int(pgErr.Position)-1, 0), + } + } + return e + } + + if a.pool == nil { + var uri string + if a.db.Managed { + if a.client == nil { + return nil, fmt.Errorf("client is nil") + } + edb, err := a.client.CreateDatabase(ctx, &dbmanager.CreateDatabaseRequest{ + Engine: "postgresql", + Migrations: migrations, + }) + if err != nil { + return nil, err + } + uri = edb.Uri + } else if a.dbg.OnlyManagedDatabases { + return nil, fmt.Errorf("database: connections disabled via SQLCDEBUG=databases=managed") + } else { + uri = a.replacer.Replace(a.db.URI) + } + conf, err := pgxpool.ParseConfig(uri) + if err != nil { + return nil, err + } + pool, err := pgxpool.NewWithConfig(ctx, conf) + if err != nil { + return nil, err + } + a.pool = pool + } + + c, err := a.pool.Acquire(ctx) + if err != nil { + return nil, err + } + defer c.Release() + + // TODO: Pick a random name + desc, err := c.Conn().Prepare(ctx, "foo", query) + if err != nil { + return nil, extractSqlErr(err) + } + + if err := c.Conn().Deallocate(ctx, "foo"); err != nil { + return nil, err + } + + var result core.Analysis + for _, field := range desc.Fields { + if field.TableOID > 0 { + col, err := a.columnInfo(ctx, field) + if err != nil { + return nil, err + } + // debug.Dump(i, field, col) + tbl, err := a.tableInfo(ctx, field.TableOID) + if err != nil { + return nil, err + } + dt, isArray, dims := parseType(col.DataType) + notNull := col.NotNull + name := field.Name + result.Columns = append(result.Columns, &core.Column{ + Name: name, + OriginalName: field.Name, + DataType: dt, + NotNull: notNull, + IsArray: isArray, + ArrayDims: int32(max(col.ArrayDims, dims)), + Table: &core.Identifier{ + Schema: tbl.SchemaName, + Name: tbl.TableName, + }, + }) + } else { + dataType, err := a.formatType(ctx, field.DataTypeOID, field.TypeModifier) + if err != nil { + return nil, err + } + // debug.Dump(i, field, dataType) + notNull := false + name := field.Name + dt, isArray, dims := parseType(dataType) + result.Columns = append(result.Columns, &core.Column{ + Name: name, + OriginalName: field.Name, + DataType: dt, + NotNull: notNull, + IsArray: isArray, + ArrayDims: int32(dims), + }) + } + } + + for i, oid := range desc.ParamOIDs { + dataType, err := a.formatType(ctx, oid, -1) + if err != nil { + return nil, err + } + notNull := false + dt, isArray, dims := parseType(dataType) + name := "" + if ps != nil { + name, _ = ps.NameFor(i + 1) + } + result.Params = append(result.Params, &core.Parameter{ + Number: int32(i + 1), + Column: &core.Column{ + Name: name, + DataType: dt, + IsArray: isArray, + ArrayDims: int32(dims), + NotNull: notNull, + }, + }) + } + + return &result, nil +} + +func (a *Analyzer) Close(_ context.Context) error { + if a.pool != nil { + a.pool.Close() + } + return nil +} diff --git a/internal/engine/postgresql/convert.go b/internal/engine/postgresql/convert.go index 38a5e62a26..f56a572c16 100644 --- a/internal/engine/postgresql/convert.go +++ b/internal/engine/postgresql/convert.go @@ -1,12 +1,9 @@ -//go:build !windows && cgo -// +build !windows,cgo - package postgresql import ( "fmt" - pg "github.com/pganalyze/pg_query_go/v4" + pg "github.com/pganalyze/pg_query_go/v6" "github.com/sqlc-dev/sqlc/internal/sql/ast" ) @@ -186,7 +183,6 @@ func convertAggref(n *pg.Aggref) *ast.Aggref { Aggtype: ast.Oid(n.Aggtype), Aggcollid: ast.Oid(n.Aggcollid), Inputcollid: ast.Oid(n.Inputcollid), - Aggtranstype: ast.Oid(n.Aggtranstype), Aggargtypes: convertSlice(n.Aggargtypes), Aggdirectargs: convertSlice(n.Aggdirectargs), Args: convertSlice(n.Args), @@ -1666,7 +1662,6 @@ func convertGrantRoleStmt(n *pg.GrantRoleStmt) *ast.GrantRoleStmt { GrantedRoles: convertSlice(n.GrantedRoles), GranteeRoles: convertSlice(n.GranteeRoles), IsGrant: n.IsGrant, - AdminOpt: n.AdminOpt, Grantor: convertRoleSpec(n.Grantor), Behavior: ast.DropBehavior(n.Behavior), } @@ -1696,7 +1691,6 @@ func convertGroupingFunc(n *pg.GroupingFunc) *ast.GroupingFunc { Xpr: convertNode(n.Xpr), Args: convertSlice(n.Args), Refs: convertSlice(n.Refs), - Cols: convertSlice(n.Cols), Agglevelsup: ast.Index(n.Agglevelsup), Location: int(n.Location), } @@ -1757,7 +1751,6 @@ func convertIndexStmt(n *pg.IndexStmt) *ast.IndexStmt { ExcludeOpNames: convertSlice(n.ExcludeOpNames), Idxcomment: makeString(n.Idxcomment), IndexOid: ast.Oid(n.IndexOid), - OldNode: ast.Oid(n.OldNode), Unique: n.Unique, Primary: n.Primary, Isconstraint: n.Isconstraint, @@ -2019,7 +2012,6 @@ func convertOpExpr(n *pg.OpExpr) *ast.OpExpr { return &ast.OpExpr{ Xpr: convertNode(n.Xpr), Opno: ast.Oid(n.Opno), - Opfuncid: ast.Oid(n.Opfuncid), Opresulttype: ast.Oid(n.Opresulttype), Opretset: n.Opretset, Opcollid: ast.Oid(n.Opcollid), @@ -2111,7 +2103,7 @@ func convertPartitionSpec(n *pg.PartitionSpec) *ast.PartitionSpec { return nil } return &ast.PartitionSpec{ - Strategy: makeString(n.Strategy), + Strategy: makeString(n.Strategy.String()), PartParams: convertSlice(n.PartParams), Location: int(n.Location), } @@ -2269,11 +2261,6 @@ func convertRangeTblEntry(n *pg.RangeTblEntry) *ast.RangeTblEntry { Lateral: n.Lateral, Inh: n.Inh, InFromCl: n.InFromCl, - RequiredPerms: ast.AclMode(n.RequiredPerms), - CheckAsUser: ast.Oid(n.CheckAsUser), - SelectedCols: makeUint32Slice(n.SelectedCols), - InsertedCols: makeUint32Slice(n.InsertedCols), - UpdatedCols: makeUint32Slice(n.UpdatedCols), SecurityQuals: convertSlice(n.SecurityQuals), } } @@ -2501,7 +2488,6 @@ func convertScalarArrayOpExpr(n *pg.ScalarArrayOpExpr) *ast.ScalarArrayOpExpr { return &ast.ScalarArrayOpExpr{ Xpr: convertNode(n.Xpr), Opno: ast.Oid(n.Opno), - Opfuncid: ast.Oid(n.Opfuncid), UseOr: n.UseOr, Inputcollid: ast.Oid(n.Inputcollid), Args: convertSlice(n.Args), diff --git a/internal/engine/postgresql/parse.go b/internal/engine/postgresql/parse.go index 75ae3ca344..40af125962 100644 --- a/internal/engine/postgresql/parse.go +++ b/internal/engine/postgresql/parse.go @@ -1,6 +1,3 @@ -//go:build !windows && cgo -// +build !windows,cgo - package postgresql import ( @@ -9,10 +6,10 @@ import ( "io" "strings" - nodes "github.com/pganalyze/pg_query_go/v4" - "github.com/pganalyze/pg_query_go/v4/parser" + nodes "github.com/pganalyze/pg_query_go/v6" - "github.com/sqlc-dev/sqlc/internal/metadata" + "github.com/sqlc-dev/sqlc/internal/engine/postgresql/parser" + "github.com/sqlc-dev/sqlc/internal/source" "github.com/sqlc-dev/sqlc/internal/sql/ast" "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" ) @@ -154,7 +151,7 @@ func (p *Parser) Parse(r io.Reader) ([]ast.Statement, error) { if err != nil { return nil, err } - tree, err := nodes.Parse(string(contents)) + tree, err := Parse(string(contents)) if err != nil { pErr := normalizeErr(err) return nil, pErr @@ -199,8 +196,8 @@ func normalizeErr(err error) error { } // https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-COMMENTS -func (p *Parser) CommentSyntax() metadata.CommentSyntax { - return metadata.CommentSyntax{ +func (p *Parser) CommentSyntax() source.CommentSyntax { + return source.CommentSyntax{ Dash: true, SlashStar: true, } @@ -236,7 +233,7 @@ func translate(node *nodes.Node) (ast.Node, error) { n := inner.AlterObjectSchemaStmt switch n.ObjectType { - case nodes.ObjectType_OBJECT_TABLE: + case nodes.ObjectType_OBJECT_TABLE, nodes.ObjectType_OBJECT_VIEW, nodes.ObjectType_OBJECT_MATVIEW: rel := parseRelationFromRangeVar(n.Relation) return &ast.AlterTableSetSchemaStmt{ Table: rel.TableName(), @@ -274,7 +271,7 @@ func translate(node *nodes.Node) (ast.Node, error) { case nodes.AlterTableType_AT_AddColumn: d, ok := altercmd.Def.Node.(*nodes.Node_ColumnDef) if !ok { - return nil, fmt.Errorf("expected alter table defintion to be a ColumnDef") + return nil, fmt.Errorf("expected alter table definition to be a ColumnDef") } rel, err := parseRelationFromNodes(d.ColumnDef.TypeName.Names) @@ -293,7 +290,7 @@ func translate(node *nodes.Node) (ast.Node, error) { case nodes.AlterTableType_AT_AlterColumnType: d, ok := altercmd.Def.Node.(*nodes.Node_ColumnDef) if !ok { - return nil, fmt.Errorf("expected alter table defintion to be a ColumnDef") + return nil, fmt.Errorf("expected alter table definition to be a ColumnDef") } col := "" if altercmd.Name != "" { @@ -438,12 +435,21 @@ func translate(node *nodes.Node) (ast.Node, error) { if err != nil { return nil, err } + + primary := false + for _, con := range item.ColumnDef.Constraints { + if constraint, ok := con.Node.(*nodes.Node_Constraint); ok { + primary = constraint.Constraint.Contype == nodes.ConstrType_CONSTR_PRIMARY + } + } + create.Cols = append(create.Cols, &ast.ColumnDef{ - Colname: item.ColumnDef.Colname, - TypeName: rel.TypeName(), - IsNotNull: isNotNull(item.ColumnDef) || primaryKey[item.ColumnDef.Colname], - IsArray: isArray(item.ColumnDef.TypeName), - ArrayDims: len(item.ColumnDef.TypeName.ArrayBounds), + Colname: item.ColumnDef.Colname, + TypeName: rel.TypeName(), + IsNotNull: isNotNull(item.ColumnDef) || primaryKey[item.ColumnDef.Colname], + IsArray: isArray(item.ColumnDef.TypeName), + ArrayDims: len(item.ColumnDef.TypeName.ArrayBounds), + PrimaryKey: primary, }) } } @@ -611,7 +617,7 @@ func translate(node *nodes.Node) (ast.Node, error) { MissingOk: n.MissingOk, }, nil - case nodes.ObjectType_OBJECT_TABLE: + case nodes.ObjectType_OBJECT_TABLE, nodes.ObjectType_OBJECT_MATVIEW, nodes.ObjectType_OBJECT_VIEW: rel := parseRelationFromRangeVar(n.Relation) return &ast.RenameTableStmt{ Table: rel.TableName(), diff --git a/internal/engine/postgresql/parse_default.go b/internal/engine/postgresql/parse_default.go new file mode 100644 index 0000000000..272f189649 --- /dev/null +++ b/internal/engine/postgresql/parse_default.go @@ -0,0 +1,10 @@ +//go:build !windows && cgo + +package postgresql + +import ( + nodes "github.com/pganalyze/pg_query_go/v6" +) + +var Parse = nodes.Parse +var Fingerprint = nodes.Fingerprint diff --git a/internal/engine/postgresql/parse_disabled.go b/internal/engine/postgresql/parse_disabled.go deleted file mode 100644 index ecc5158d43..0000000000 --- a/internal/engine/postgresql/parse_disabled.go +++ /dev/null @@ -1,35 +0,0 @@ -//go:build windows || !cgo -// +build windows !cgo - -package postgresql - -import ( - "errors" - "io" - "runtime" - - "github.com/sqlc-dev/sqlc/internal/metadata" - "github.com/sqlc-dev/sqlc/internal/sql/ast" -) - -func NewParser() *Parser { - return &Parser{} -} - -type Parser struct { -} - -func (p *Parser) Parse(r io.Reader) ([]ast.Statement, error) { - if runtime.GOOS == "windows" { - return nil, errors.New("the PostgreSQL engine does not support Windows.") - } - return nil, errors.New("the PostgreSQL engine requires cgo. Please set CGO_ENABLED=1.") -} - -// https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-COMMENTS -func (p *Parser) CommentSyntax() metadata.CommentSyntax { - return metadata.CommentSyntax{ - Dash: true, - SlashStar: true, - } -} diff --git a/internal/engine/postgresql/parse_wasi.go b/internal/engine/postgresql/parse_wasi.go new file mode 100644 index 0000000000..377b812cdb --- /dev/null +++ b/internal/engine/postgresql/parse_wasi.go @@ -0,0 +1,10 @@ +//go:build windows || !cgo + +package postgresql + +import ( + nodes "github.com/wasilibs/go-pgquery" +) + +var Parse = nodes.Parse +var Fingerprint = nodes.Fingerprint diff --git a/internal/engine/postgresql/parser/parser_default.go b/internal/engine/postgresql/parser/parser_default.go new file mode 100644 index 0000000000..706c3bb097 --- /dev/null +++ b/internal/engine/postgresql/parser/parser_default.go @@ -0,0 +1,7 @@ +//go:build !windows && cgo + +package parser + +import "github.com/pganalyze/pg_query_go/v6/parser" + +type Error = parser.Error diff --git a/internal/engine/postgresql/parser/parser_wasi.go b/internal/engine/postgresql/parser/parser_wasi.go new file mode 100644 index 0000000000..e172d36c72 --- /dev/null +++ b/internal/engine/postgresql/parser/parser_wasi.go @@ -0,0 +1,7 @@ +//go:build windows || !cgo + +package parser + +import "github.com/wasilibs/go-pgquery/parser" + +type Error = parser.Error diff --git a/internal/engine/postgresql/utils.go b/internal/engine/postgresql/utils.go index d0ddc392a1..b8d49b1a97 100644 --- a/internal/engine/postgresql/utils.go +++ b/internal/engine/postgresql/utils.go @@ -1,10 +1,7 @@ -//go:build !windows && cgo -// +build !windows,cgo - package postgresql import ( - nodes "github.com/pganalyze/pg_query_go/v4" + nodes "github.com/pganalyze/pg_query_go/v6" ) func isArray(n *nodes.TypeName) bool { diff --git a/internal/engine/sqlite/catalog_test.go b/internal/engine/sqlite/catalog_test.go index 3c3028fcc4..bf6dcd8316 100644 --- a/internal/engine/sqlite/catalog_test.go +++ b/internal/engine/sqlite/catalog_test.go @@ -260,7 +260,7 @@ func TestUpdate(t *testing.T) { } } - if diff := cmp.Diff(e, c, cmpopts.EquateEmpty()); diff != "" { + if diff := cmp.Diff(e, c, cmpopts.EquateEmpty(), cmpopts.IgnoreUnexported(catalog.Column{})); diff != "" { t.Log(test.stmt) t.Errorf("catalog mismatch:\n%s", diff) } diff --git a/internal/engine/sqlite/convert.go b/internal/engine/sqlite/convert.go index e941bb9121..658a9d7f33 100644 --- a/internal/engine/sqlite/convert.go +++ b/internal/engine/sqlite/convert.go @@ -6,8 +6,7 @@ import ( "strconv" "strings" - "github.com/antlr/antlr4/runtime/Go/antlr/v4" - + "github.com/antlr4-go/antlr/v4" "github.com/sqlc-dev/sqlc/internal/debug" "github.com/sqlc-dev/sqlc/internal/engine/sqlite/parser" "github.com/sqlc-dev/sqlc/internal/sql/ast" @@ -43,7 +42,7 @@ func NewIdentifier(t string) *ast.String { func (c *cc) convertAlter_table_stmtContext(n *parser.Alter_table_stmtContext) ast.Node { if n.RENAME_() != nil { if newTable, ok := n.New_table_name().(*parser.New_table_nameContext); ok { - name := newTable.Any_name().GetText() + name := identifier(newTable.Any_name().GetText()) return &ast.RenameTableStmt{ Table: parseTableName(n), NewName: &name, @@ -51,11 +50,11 @@ func (c *cc) convertAlter_table_stmtContext(n *parser.Alter_table_stmtContext) a } if newCol, ok := n.GetNew_column_name().(*parser.Column_nameContext); ok { - name := newCol.Any_name().GetText() + name := identifier(newCol.Any_name().GetText()) return &ast.RenameColumnStmt{ Table: parseTableName(n), Col: &ast.ColumnRef{ - Name: n.GetOld_column_name().GetText(), + Name: identifier(n.GetOld_column_name().GetText()), }, NewName: &name, } @@ -204,7 +203,7 @@ type Delete_stmt interface { func (c *cc) convertDelete_stmtContext(n Delete_stmt) ast.Node { if qualifiedName, ok := n.Qualified_table_name().(*parser.Qualified_table_nameContext); ok { - tableName := qualifiedName.Table_name().GetText() + tableName := identifier(qualifiedName.Table_name().GetText()) relation := &ast.RangeVar{ Relname: &tableName, } @@ -255,7 +254,7 @@ func (c *cc) convertDelete_stmtContext(n Delete_stmt) ast.Node { func (c *cc) convertDrop_stmtContext(n *parser.Drop_stmtContext) ast.Node { if n.TABLE_() != nil || n.VIEW_() != nil { name := ast.TableName{ - Name: n.Any_name().GetText(), + Name: identifier(n.Any_name().GetText()), } if n.Schema_name() != nil { name.Schema = n.Schema_name().GetText() @@ -764,11 +763,11 @@ func (c *cc) convertLiteral(n *parser.Expr_literalContext) ast.Node { return todo("convertLiteral", n) } -func (c *cc) convertMathOperationNode(n *parser.Expr_math_opContext) ast.Node { +func (c *cc) convertBinaryNode(n *parser.Expr_binaryContext) ast.Node { return &ast.A_Expr{ Name: &ast.List{ Items: []ast.Node{ - &ast.String{Str: "+"}, // todo: Convert operation types + &ast.String{Str: n.GetChild(1).(antlr.TerminalNode).GetText()}, }, }, Lexpr: c.convert(n.Expr(0)), @@ -776,7 +775,7 @@ func (c *cc) convertMathOperationNode(n *parser.Expr_math_opContext) ast.Node { } } -func (c *cc) convertBinaryNode(n *parser.Expr_binaryContext) ast.Node { +func (c *cc) convertBoolNode(n *parser.Expr_boolContext) ast.Node { return &ast.BoolExpr{ // TODO: Set op Args: &ast.List{ @@ -855,7 +854,7 @@ func (c *cc) convertReturning_caluseContext(n parser.IReturning_clauseContext) * } func (c *cc) convertInsert_stmtContext(n *parser.Insert_stmtContext) ast.Node { - tableName := n.Table_name().GetText() + tableName := identifier(n.Table_name().GetText()) rel := &ast.RangeVar{ Relname: &tableName, } @@ -876,7 +875,25 @@ func (c *cc) convertInsert_stmtContext(n *parser.Insert_stmtContext) ast.Node { ReturningList: c.convertReturning_caluseContext(n.Returning_clause()), } - if n.Select_stmt() != nil { + // Check if this is a DEFAULT VALUES insert + hasDefaultValues := false + for _, child := range n.GetChildren() { + if term, ok := child.(antlr.TerminalNode); ok { + if term.GetSymbol().GetTokenType() == parser.SQLiteParserDEFAULT_ { + hasDefaultValues = true + break + } + } + } + + if hasDefaultValues { + // For DEFAULT VALUES, create an empty select statement + insert.SelectStmt = &ast.SelectStmt{ + FromClause: &ast.List{}, + TargetList: &ast.List{}, + ValuesLists: &ast.List{Items: []ast.Node{&ast.List{}}}, // Single empty values list + } + } else if n.Select_stmt() != nil { if ss, ok := c.convert(n.Select_stmt()).(*ast.SelectStmt); ok { ss.ValuesLists = &ast.List{} insert.SelectStmt = ss @@ -937,7 +954,7 @@ func (c *cc) convertTablesOrSubquery(n []parser.ITable_or_subqueryContext) []ast } if from.Table_name() != nil { - rel := from.Table_name().GetText() + rel := identifier(from.Table_name().GetText()) rv := &ast.RangeVar{ Relname: &rel, Location: from.GetStart().GetStart(), @@ -1018,7 +1035,7 @@ func (c *cc) convertUpdate_stmtContext(n Update_stmt) ast.Node { } relations := &ast.List{} - tableName := n.Qualified_table_name().GetText() + tableName := identifier(n.Qualified_table_name().GetText()) rel := ast.RangeVar{ Relname: &tableName, Location: n.GetStart().GetStart(), @@ -1096,6 +1113,28 @@ func (c *cc) convertCollateExpr(n *parser.Expr_collateContext) ast.Node { } } +func (c *cc) convertCase(n *parser.Expr_caseContext) ast.Node { + e := &ast.CaseExpr{ + Args: &ast.List{}, + } + es := n.AllExpr() + if n.ELSE_() != nil { + e.Defresult = c.convert(es[len(es)-1]) + es = es[:len(es)-1] + } + if len(es)%2 == 1 { + e.Arg = c.convert(es[0]) + es = es[1:] + } + for i := 0; i < len(es); i += 2 { + e.Args.Items = append(e.Args.Items, &ast.CaseWhen{ + Expr: c.convert(es[i+0]), + Result: c.convert(es[i+1]), + }) + } + return e +} + func (c *cc) convert(node node) ast.Node { switch n := node.(type) { @@ -1141,14 +1180,14 @@ func (c *cc) convert(node node) ast.Node { case *parser.Expr_literalContext: return c.convertLiteral(n) - case *parser.Expr_binaryContext: - return c.convertBinaryNode(n) + case *parser.Expr_boolContext: + return c.convertBoolNode(n) case *parser.Expr_listContext: return c.convertExprListContext(n) - case *parser.Expr_math_opContext: - return c.convertMathOperationNode(n) + case *parser.Expr_binaryContext: + return c.convertBinaryNode(n) case *parser.Expr_in_selectContext: return c.convertInSelectNode(n) @@ -1184,6 +1223,9 @@ func (c *cc) convert(node node) ast.Node { case *parser.Expr_castContext: return c.convertCastExpr(n) + case *parser.Expr_caseContext: + return c.convertCase(n) + default: return todo("convert(case=default)", n) } diff --git a/internal/engine/sqlite/parse.go b/internal/engine/sqlite/parse.go index bf0bacad9f..13425b156e 100644 --- a/internal/engine/sqlite/parse.go +++ b/internal/engine/sqlite/parse.go @@ -5,10 +5,9 @@ import ( "fmt" "io" - "github.com/antlr/antlr4/runtime/Go/antlr/v4" - + "github.com/antlr4-go/antlr/v4" "github.com/sqlc-dev/sqlc/internal/engine/sqlite/parser" - "github.com/sqlc-dev/sqlc/internal/metadata" + "github.com/sqlc-dev/sqlc/internal/source" "github.com/sqlc-dev/sqlc/internal/sql/ast" ) @@ -70,6 +69,7 @@ func (p *Parser) Parse(r io.Reader) ([]ast.Statement, error) { converter := &cc{} out := converter.convert(stmt) if _, ok := out.(*ast.TODO); ok { + loc = stmt.GetStop().GetStop() + 2 continue } len := (stmt.GetStop().GetStop() + 1) - loc @@ -86,8 +86,8 @@ func (p *Parser) Parse(r io.Reader) ([]ast.Statement, error) { return stmts, nil } -func (p *Parser) CommentSyntax() metadata.CommentSyntax { - return metadata.CommentSyntax{ +func (p *Parser) CommentSyntax() source.CommentSyntax { + return source.CommentSyntax{ Dash: true, Hash: false, SlashStar: true, diff --git a/internal/engine/sqlite/parser/Makefile b/internal/engine/sqlite/parser/Makefile index b925a1f6c1..bacae8a36b 100644 --- a/internal/engine/sqlite/parser/Makefile +++ b/internal/engine/sqlite/parser/Makefile @@ -1,7 +1,7 @@ -sqlite_parser.go: SQLiteLexer.g4 SQLiteParser.g4 antlr-4.12.0-complete.jar - java -jar antlr-4.12.0-complete.jar -Dlanguage=Go SQLiteLexer.g4 SQLiteParser.g4 +sqlite_parser.go: SQLiteLexer.g4 SQLiteParser.g4 antlr-4.13.1-complete.jar + java -jar antlr-4.13.1-complete.jar -Dlanguage=Go SQLiteLexer.g4 SQLiteParser.g4 -antlr-4.12.0-complete.jar: - curl -O https://www.antlr.org/download/antlr-4.12.0-complete.jar +antlr-4.13.1-complete.jar: + curl -O https://www.antlr.org/download/antlr-4.13.1-complete.jar diff --git a/internal/engine/sqlite/parser/SQLiteLexer.g4 b/internal/engine/sqlite/parser/SQLiteLexer.g4 index d7f7c97197..5110ed44c7 100644 --- a/internal/engine/sqlite/parser/SQLiteLexer.g4 +++ b/internal/engine/sqlite/parser/SQLiteLexer.g4 @@ -35,6 +35,8 @@ COMMA: ','; ASSIGN: '='; STAR: '*'; PLUS: '+'; +PTR2: '->>'; +PTR: '->'; MINUS: '-'; TILDE: '~'; PIPE2: '||'; diff --git a/internal/engine/sqlite/parser/SQLiteLexer.interp b/internal/engine/sqlite/parser/SQLiteLexer.interp index 9b6f7ec3e8..329996c296 100644 --- a/internal/engine/sqlite/parser/SQLiteLexer.interp +++ b/internal/engine/sqlite/parser/SQLiteLexer.interp @@ -8,6 +8,8 @@ null '=' '*' '+' +'->>' +'->' '-' '~' '||' @@ -206,6 +208,8 @@ COMMA ASSIGN STAR PLUS +PTR2 +PTR MINUS TILDE PIPE2 @@ -403,6 +407,8 @@ COMMA ASSIGN STAR PLUS +PTR2 +PTR MINUS TILDE PIPE2 @@ -627,4 +633,4 @@ mode names: DEFAULT_MODE atn: -[4, 0, 195, 1818, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, 7, 83, 2, 84, 7, 84, 2, 85, 7, 85, 2, 86, 7, 86, 2, 87, 7, 87, 2, 88, 7, 88, 2, 89, 7, 89, 2, 90, 7, 90, 2, 91, 7, 91, 2, 92, 7, 92, 2, 93, 7, 93, 2, 94, 7, 94, 2, 95, 7, 95, 2, 96, 7, 96, 2, 97, 7, 97, 2, 98, 7, 98, 2, 99, 7, 99, 2, 100, 7, 100, 2, 101, 7, 101, 2, 102, 7, 102, 2, 103, 7, 103, 2, 104, 7, 104, 2, 105, 7, 105, 2, 106, 7, 106, 2, 107, 7, 107, 2, 108, 7, 108, 2, 109, 7, 109, 2, 110, 7, 110, 2, 111, 7, 111, 2, 112, 7, 112, 2, 113, 7, 113, 2, 114, 7, 114, 2, 115, 7, 115, 2, 116, 7, 116, 2, 117, 7, 117, 2, 118, 7, 118, 2, 119, 7, 119, 2, 120, 7, 120, 2, 121, 7, 121, 2, 122, 7, 122, 2, 123, 7, 123, 2, 124, 7, 124, 2, 125, 7, 125, 2, 126, 7, 126, 2, 127, 7, 127, 2, 128, 7, 128, 2, 129, 7, 129, 2, 130, 7, 130, 2, 131, 7, 131, 2, 132, 7, 132, 2, 133, 7, 133, 2, 134, 7, 134, 2, 135, 7, 135, 2, 136, 7, 136, 2, 137, 7, 137, 2, 138, 7, 138, 2, 139, 7, 139, 2, 140, 7, 140, 2, 141, 7, 141, 2, 142, 7, 142, 2, 143, 7, 143, 2, 144, 7, 144, 2, 145, 7, 145, 2, 146, 7, 146, 2, 147, 7, 147, 2, 148, 7, 148, 2, 149, 7, 149, 2, 150, 7, 150, 2, 151, 7, 151, 2, 152, 7, 152, 2, 153, 7, 153, 2, 154, 7, 154, 2, 155, 7, 155, 2, 156, 7, 156, 2, 157, 7, 157, 2, 158, 7, 158, 2, 159, 7, 159, 2, 160, 7, 160, 2, 161, 7, 161, 2, 162, 7, 162, 2, 163, 7, 163, 2, 164, 7, 164, 2, 165, 7, 165, 2, 166, 7, 166, 2, 167, 7, 167, 2, 168, 7, 168, 2, 169, 7, 169, 2, 170, 7, 170, 2, 171, 7, 171, 2, 172, 7, 172, 2, 173, 7, 173, 2, 174, 7, 174, 2, 175, 7, 175, 2, 176, 7, 176, 2, 177, 7, 177, 2, 178, 7, 178, 2, 179, 7, 179, 2, 180, 7, 180, 2, 181, 7, 181, 2, 182, 7, 182, 2, 183, 7, 183, 2, 184, 7, 184, 2, 185, 7, 185, 2, 186, 7, 186, 2, 187, 7, 187, 2, 188, 7, 188, 2, 189, 7, 189, 2, 190, 7, 190, 2, 191, 7, 191, 2, 192, 7, 192, 2, 193, 7, 193, 2, 194, 7, 194, 2, 195, 7, 195, 2, 196, 7, 196, 2, 197, 7, 197, 2, 198, 7, 198, 2, 199, 7, 199, 2, 200, 7, 200, 2, 201, 7, 201, 2, 202, 7, 202, 2, 203, 7, 203, 2, 204, 7, 204, 2, 205, 7, 205, 2, 206, 7, 206, 2, 207, 7, 207, 2, 208, 7, 208, 2, 209, 7, 209, 2, 210, 7, 210, 2, 211, 7, 211, 2, 212, 7, 212, 2, 213, 7, 213, 2, 214, 7, 214, 2, 215, 7, 215, 2, 216, 7, 216, 2, 217, 7, 217, 2, 218, 7, 218, 2, 219, 7, 219, 2, 220, 7, 220, 2, 221, 7, 221, 2, 222, 7, 222, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, 28, 1, 28, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 31, 1, 31, 1, 31, 1, 31, 1, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 39, 1, 39, 1, 39, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 65, 1, 65, 1, 65, 1, 65, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 72, 1, 72, 1, 72, 1, 72, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 79, 1, 79, 1, 79, 1, 80, 1, 80, 1, 80, 1, 80, 1, 80, 1, 80, 1, 80, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 82, 1, 82, 1, 82, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 91, 1, 91, 1, 91, 1, 92, 1, 92, 1, 92, 1, 92, 1, 92, 1, 92, 1, 92, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 94, 1, 94, 1, 94, 1, 94, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 96, 1, 96, 1, 96, 1, 96, 1, 96, 1, 97, 1, 97, 1, 97, 1, 97, 1, 97, 1, 97, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 100, 1, 100, 1, 100, 1, 101, 1, 101, 1, 101, 1, 101, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 104, 1, 104, 1, 104, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 106, 1, 106, 1, 106, 1, 107, 1, 107, 1, 107, 1, 108, 1, 108, 1, 108, 1, 108, 1, 108, 1, 108, 1, 109, 1, 109, 1, 109, 1, 109, 1, 109, 1, 109, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 113, 1, 113, 1, 113, 1, 113, 1, 113, 1, 113, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 117, 1, 117, 1, 117, 1, 117, 1, 117, 1, 117, 1, 117, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 121, 1, 121, 1, 121, 1, 121, 1, 121, 1, 121, 1, 121, 1, 121, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 126, 1, 126, 1, 126, 1, 126, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 130, 1, 130, 1, 130, 1, 130, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 132, 1, 132, 1, 132, 1, 132, 1, 132, 1, 132, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 136, 1, 136, 1, 136, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 140, 1, 140, 1, 140, 1, 140, 1, 140, 1, 140, 1, 140, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 1, 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 144, 1, 144, 1, 144, 1, 144, 1, 144, 1, 144, 1, 144, 1, 145, 1, 145, 1, 145, 1, 145, 1, 145, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 147, 1, 147, 1, 147, 1, 147, 1, 147, 1, 148, 1, 148, 1, 148, 1, 148, 1, 148, 1, 148, 1, 149, 1, 149, 1, 149, 1, 149, 1, 149, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 152, 1, 152, 1, 152, 1, 152, 1, 152, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 156, 1, 156, 1, 156, 1, 156, 1, 156, 1, 156, 1, 156, 1, 156, 1, 156, 1, 156, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 161, 1, 161, 1, 161, 1, 161, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 163, 1, 163, 1, 163, 1, 163, 1, 163, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 1, 174, 1, 174, 1, 174, 1, 174, 1, 174, 1, 174, 1, 174, 1, 175, 1, 175, 1, 175, 1, 175, 1, 175, 1, 175, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 177, 1, 177, 1, 177, 1, 177, 1, 177, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 181, 1, 181, 1, 181, 1, 181, 1, 181, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 183, 1, 183, 1, 183, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 185, 1, 185, 1, 185, 1, 185, 5, 185, 1625, 8, 185, 10, 185, 12, 185, 1628, 9, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 5, 185, 1635, 8, 185, 10, 185, 12, 185, 1638, 9, 185, 1, 185, 1, 185, 1, 185, 5, 185, 1643, 8, 185, 10, 185, 12, 185, 1646, 9, 185, 1, 185, 1, 185, 1, 185, 5, 185, 1651, 8, 185, 10, 185, 12, 185, 1654, 9, 185, 3, 185, 1656, 8, 185, 1, 186, 4, 186, 1659, 8, 186, 11, 186, 12, 186, 1660, 1, 186, 1, 186, 5, 186, 1665, 8, 186, 10, 186, 12, 186, 1668, 9, 186, 3, 186, 1670, 8, 186, 1, 186, 1, 186, 4, 186, 1674, 8, 186, 11, 186, 12, 186, 1675, 3, 186, 1678, 8, 186, 1, 186, 1, 186, 3, 186, 1682, 8, 186, 1, 186, 4, 186, 1685, 8, 186, 11, 186, 12, 186, 1686, 3, 186, 1689, 8, 186, 1, 186, 1, 186, 1, 186, 1, 186, 4, 186, 1695, 8, 186, 11, 186, 12, 186, 1696, 3, 186, 1699, 8, 186, 1, 187, 1, 187, 5, 187, 1703, 8, 187, 10, 187, 12, 187, 1706, 9, 187, 1, 188, 1, 188, 1, 188, 1, 189, 1, 189, 1, 189, 1, 189, 5, 189, 1715, 8, 189, 10, 189, 12, 189, 1718, 9, 189, 1, 189, 1, 189, 1, 190, 1, 190, 1, 190, 1, 191, 1, 191, 1, 191, 1, 191, 5, 191, 1729, 8, 191, 10, 191, 12, 191, 1732, 9, 191, 1, 191, 3, 191, 1735, 8, 191, 1, 191, 1, 191, 3, 191, 1739, 8, 191, 1, 191, 1, 191, 1, 192, 1, 192, 1, 192, 1, 192, 5, 192, 1747, 8, 192, 10, 192, 12, 192, 1750, 9, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 193, 1, 193, 1, 193, 1, 193, 1, 194, 1, 194, 1, 195, 1, 195, 1, 196, 1, 196, 1, 197, 1, 197, 1, 198, 1, 198, 1, 199, 1, 199, 1, 200, 1, 200, 1, 201, 1, 201, 1, 202, 1, 202, 1, 203, 1, 203, 1, 204, 1, 204, 1, 205, 1, 205, 1, 206, 1, 206, 1, 207, 1, 207, 1, 208, 1, 208, 1, 209, 1, 209, 1, 210, 1, 210, 1, 211, 1, 211, 1, 212, 1, 212, 1, 213, 1, 213, 1, 214, 1, 214, 1, 215, 1, 215, 1, 216, 1, 216, 1, 217, 1, 217, 1, 218, 1, 218, 1, 219, 1, 219, 1, 220, 1, 220, 1, 221, 1, 221, 1, 222, 1, 222, 1, 1748, 0, 223, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 20, 41, 21, 43, 22, 45, 23, 47, 24, 49, 25, 51, 26, 53, 27, 55, 28, 57, 29, 59, 30, 61, 31, 63, 32, 65, 33, 67, 34, 69, 35, 71, 36, 73, 37, 75, 38, 77, 39, 79, 40, 81, 41, 83, 42, 85, 43, 87, 44, 89, 45, 91, 46, 93, 47, 95, 48, 97, 49, 99, 50, 101, 51, 103, 52, 105, 53, 107, 54, 109, 55, 111, 56, 113, 57, 115, 58, 117, 59, 119, 60, 121, 61, 123, 62, 125, 63, 127, 64, 129, 65, 131, 66, 133, 67, 135, 68, 137, 69, 139, 70, 141, 71, 143, 72, 145, 73, 147, 74, 149, 75, 151, 76, 153, 77, 155, 78, 157, 79, 159, 80, 161, 81, 163, 82, 165, 83, 167, 84, 169, 85, 171, 86, 173, 87, 175, 88, 177, 89, 179, 90, 181, 91, 183, 92, 185, 93, 187, 94, 189, 95, 191, 96, 193, 97, 195, 98, 197, 99, 199, 100, 201, 101, 203, 102, 205, 103, 207, 104, 209, 105, 211, 106, 213, 107, 215, 108, 217, 109, 219, 110, 221, 111, 223, 112, 225, 113, 227, 114, 229, 115, 231, 116, 233, 117, 235, 118, 237, 119, 239, 120, 241, 121, 243, 122, 245, 123, 247, 124, 249, 125, 251, 126, 253, 127, 255, 128, 257, 129, 259, 130, 261, 131, 263, 132, 265, 133, 267, 134, 269, 135, 271, 136, 273, 137, 275, 138, 277, 139, 279, 140, 281, 141, 283, 142, 285, 143, 287, 144, 289, 145, 291, 146, 293, 147, 295, 148, 297, 149, 299, 150, 301, 151, 303, 152, 305, 153, 307, 154, 309, 155, 311, 156, 313, 157, 315, 158, 317, 159, 319, 160, 321, 161, 323, 162, 325, 163, 327, 164, 329, 165, 331, 166, 333, 167, 335, 168, 337, 169, 339, 170, 341, 171, 343, 172, 345, 173, 347, 174, 349, 175, 351, 176, 353, 177, 355, 178, 357, 179, 359, 180, 361, 181, 363, 182, 365, 183, 367, 184, 369, 185, 371, 186, 373, 187, 375, 188, 377, 189, 379, 190, 381, 191, 383, 192, 385, 193, 387, 194, 389, 195, 391, 0, 393, 0, 395, 0, 397, 0, 399, 0, 401, 0, 403, 0, 405, 0, 407, 0, 409, 0, 411, 0, 413, 0, 415, 0, 417, 0, 419, 0, 421, 0, 423, 0, 425, 0, 427, 0, 429, 0, 431, 0, 433, 0, 435, 0, 437, 0, 439, 0, 441, 0, 443, 0, 445, 0, 1, 0, 38, 1, 0, 34, 34, 1, 0, 96, 96, 1, 0, 93, 93, 3, 0, 65, 90, 95, 95, 97, 122, 4, 0, 48, 57, 65, 90, 95, 95, 97, 122, 2, 0, 43, 43, 45, 45, 3, 0, 36, 36, 58, 58, 64, 64, 1, 0, 39, 39, 2, 0, 10, 10, 13, 13, 3, 0, 9, 11, 13, 13, 32, 32, 3, 0, 48, 57, 65, 70, 97, 102, 1, 0, 48, 57, 2, 0, 65, 65, 97, 97, 2, 0, 66, 66, 98, 98, 2, 0, 67, 67, 99, 99, 2, 0, 68, 68, 100, 100, 2, 0, 69, 69, 101, 101, 2, 0, 70, 70, 102, 102, 2, 0, 71, 71, 103, 103, 2, 0, 72, 72, 104, 104, 2, 0, 73, 73, 105, 105, 2, 0, 74, 74, 106, 106, 2, 0, 75, 75, 107, 107, 2, 0, 76, 76, 108, 108, 2, 0, 77, 77, 109, 109, 2, 0, 78, 78, 110, 110, 2, 0, 79, 79, 111, 111, 2, 0, 80, 80, 112, 112, 2, 0, 81, 81, 113, 113, 2, 0, 82, 82, 114, 114, 2, 0, 83, 83, 115, 115, 2, 0, 84, 84, 116, 116, 2, 0, 85, 85, 117, 117, 2, 0, 86, 86, 118, 118, 2, 0, 87, 87, 119, 119, 2, 0, 88, 88, 120, 120, 2, 0, 89, 89, 121, 121, 2, 0, 90, 90, 122, 122, 1815, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 0, 61, 1, 0, 0, 0, 0, 63, 1, 0, 0, 0, 0, 65, 1, 0, 0, 0, 0, 67, 1, 0, 0, 0, 0, 69, 1, 0, 0, 0, 0, 71, 1, 0, 0, 0, 0, 73, 1, 0, 0, 0, 0, 75, 1, 0, 0, 0, 0, 77, 1, 0, 0, 0, 0, 79, 1, 0, 0, 0, 0, 81, 1, 0, 0, 0, 0, 83, 1, 0, 0, 0, 0, 85, 1, 0, 0, 0, 0, 87, 1, 0, 0, 0, 0, 89, 1, 0, 0, 0, 0, 91, 1, 0, 0, 0, 0, 93, 1, 0, 0, 0, 0, 95, 1, 0, 0, 0, 0, 97, 1, 0, 0, 0, 0, 99, 1, 0, 0, 0, 0, 101, 1, 0, 0, 0, 0, 103, 1, 0, 0, 0, 0, 105, 1, 0, 0, 0, 0, 107, 1, 0, 0, 0, 0, 109, 1, 0, 0, 0, 0, 111, 1, 0, 0, 0, 0, 113, 1, 0, 0, 0, 0, 115, 1, 0, 0, 0, 0, 117, 1, 0, 0, 0, 0, 119, 1, 0, 0, 0, 0, 121, 1, 0, 0, 0, 0, 123, 1, 0, 0, 0, 0, 125, 1, 0, 0, 0, 0, 127, 1, 0, 0, 0, 0, 129, 1, 0, 0, 0, 0, 131, 1, 0, 0, 0, 0, 133, 1, 0, 0, 0, 0, 135, 1, 0, 0, 0, 0, 137, 1, 0, 0, 0, 0, 139, 1, 0, 0, 0, 0, 141, 1, 0, 0, 0, 0, 143, 1, 0, 0, 0, 0, 145, 1, 0, 0, 0, 0, 147, 1, 0, 0, 0, 0, 149, 1, 0, 0, 0, 0, 151, 1, 0, 0, 0, 0, 153, 1, 0, 0, 0, 0, 155, 1, 0, 0, 0, 0, 157, 1, 0, 0, 0, 0, 159, 1, 0, 0, 0, 0, 161, 1, 0, 0, 0, 0, 163, 1, 0, 0, 0, 0, 165, 1, 0, 0, 0, 0, 167, 1, 0, 0, 0, 0, 169, 1, 0, 0, 0, 0, 171, 1, 0, 0, 0, 0, 173, 1, 0, 0, 0, 0, 175, 1, 0, 0, 0, 0, 177, 1, 0, 0, 0, 0, 179, 1, 0, 0, 0, 0, 181, 1, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 185, 1, 0, 0, 0, 0, 187, 1, 0, 0, 0, 0, 189, 1, 0, 0, 0, 0, 191, 1, 0, 0, 0, 0, 193, 1, 0, 0, 0, 0, 195, 1, 0, 0, 0, 0, 197, 1, 0, 0, 0, 0, 199, 1, 0, 0, 0, 0, 201, 1, 0, 0, 0, 0, 203, 1, 0, 0, 0, 0, 205, 1, 0, 0, 0, 0, 207, 1, 0, 0, 0, 0, 209, 1, 0, 0, 0, 0, 211, 1, 0, 0, 0, 0, 213, 1, 0, 0, 0, 0, 215, 1, 0, 0, 0, 0, 217, 1, 0, 0, 0, 0, 219, 1, 0, 0, 0, 0, 221, 1, 0, 0, 0, 0, 223, 1, 0, 0, 0, 0, 225, 1, 0, 0, 0, 0, 227, 1, 0, 0, 0, 0, 229, 1, 0, 0, 0, 0, 231, 1, 0, 0, 0, 0, 233, 1, 0, 0, 0, 0, 235, 1, 0, 0, 0, 0, 237, 1, 0, 0, 0, 0, 239, 1, 0, 0, 0, 0, 241, 1, 0, 0, 0, 0, 243, 1, 0, 0, 0, 0, 245, 1, 0, 0, 0, 0, 247, 1, 0, 0, 0, 0, 249, 1, 0, 0, 0, 0, 251, 1, 0, 0, 0, 0, 253, 1, 0, 0, 0, 0, 255, 1, 0, 0, 0, 0, 257, 1, 0, 0, 0, 0, 259, 1, 0, 0, 0, 0, 261, 1, 0, 0, 0, 0, 263, 1, 0, 0, 0, 0, 265, 1, 0, 0, 0, 0, 267, 1, 0, 0, 0, 0, 269, 1, 0, 0, 0, 0, 271, 1, 0, 0, 0, 0, 273, 1, 0, 0, 0, 0, 275, 1, 0, 0, 0, 0, 277, 1, 0, 0, 0, 0, 279, 1, 0, 0, 0, 0, 281, 1, 0, 0, 0, 0, 283, 1, 0, 0, 0, 0, 285, 1, 0, 0, 0, 0, 287, 1, 0, 0, 0, 0, 289, 1, 0, 0, 0, 0, 291, 1, 0, 0, 0, 0, 293, 1, 0, 0, 0, 0, 295, 1, 0, 0, 0, 0, 297, 1, 0, 0, 0, 0, 299, 1, 0, 0, 0, 0, 301, 1, 0, 0, 0, 0, 303, 1, 0, 0, 0, 0, 305, 1, 0, 0, 0, 0, 307, 1, 0, 0, 0, 0, 309, 1, 0, 0, 0, 0, 311, 1, 0, 0, 0, 0, 313, 1, 0, 0, 0, 0, 315, 1, 0, 0, 0, 0, 317, 1, 0, 0, 0, 0, 319, 1, 0, 0, 0, 0, 321, 1, 0, 0, 0, 0, 323, 1, 0, 0, 0, 0, 325, 1, 0, 0, 0, 0, 327, 1, 0, 0, 0, 0, 329, 1, 0, 0, 0, 0, 331, 1, 0, 0, 0, 0, 333, 1, 0, 0, 0, 0, 335, 1, 0, 0, 0, 0, 337, 1, 0, 0, 0, 0, 339, 1, 0, 0, 0, 0, 341, 1, 0, 0, 0, 0, 343, 1, 0, 0, 0, 0, 345, 1, 0, 0, 0, 0, 347, 1, 0, 0, 0, 0, 349, 1, 0, 0, 0, 0, 351, 1, 0, 0, 0, 0, 353, 1, 0, 0, 0, 0, 355, 1, 0, 0, 0, 0, 357, 1, 0, 0, 0, 0, 359, 1, 0, 0, 0, 0, 361, 1, 0, 0, 0, 0, 363, 1, 0, 0, 0, 0, 365, 1, 0, 0, 0, 0, 367, 1, 0, 0, 0, 0, 369, 1, 0, 0, 0, 0, 371, 1, 0, 0, 0, 0, 373, 1, 0, 0, 0, 0, 375, 1, 0, 0, 0, 0, 377, 1, 0, 0, 0, 0, 379, 1, 0, 0, 0, 0, 381, 1, 0, 0, 0, 0, 383, 1, 0, 0, 0, 0, 385, 1, 0, 0, 0, 0, 387, 1, 0, 0, 0, 0, 389, 1, 0, 0, 0, 1, 447, 1, 0, 0, 0, 3, 449, 1, 0, 0, 0, 5, 451, 1, 0, 0, 0, 7, 453, 1, 0, 0, 0, 9, 455, 1, 0, 0, 0, 11, 457, 1, 0, 0, 0, 13, 459, 1, 0, 0, 0, 15, 461, 1, 0, 0, 0, 17, 463, 1, 0, 0, 0, 19, 465, 1, 0, 0, 0, 21, 467, 1, 0, 0, 0, 23, 470, 1, 0, 0, 0, 25, 472, 1, 0, 0, 0, 27, 474, 1, 0, 0, 0, 29, 477, 1, 0, 0, 0, 31, 480, 1, 0, 0, 0, 33, 482, 1, 0, 0, 0, 35, 484, 1, 0, 0, 0, 37, 486, 1, 0, 0, 0, 39, 489, 1, 0, 0, 0, 41, 491, 1, 0, 0, 0, 43, 494, 1, 0, 0, 0, 45, 497, 1, 0, 0, 0, 47, 500, 1, 0, 0, 0, 49, 503, 1, 0, 0, 0, 51, 509, 1, 0, 0, 0, 53, 516, 1, 0, 0, 0, 55, 520, 1, 0, 0, 0, 57, 526, 1, 0, 0, 0, 59, 530, 1, 0, 0, 0, 61, 536, 1, 0, 0, 0, 63, 544, 1, 0, 0, 0, 65, 548, 1, 0, 0, 0, 67, 551, 1, 0, 0, 0, 69, 555, 1, 0, 0, 0, 71, 562, 1, 0, 0, 0, 73, 576, 1, 0, 0, 0, 75, 583, 1, 0, 0, 0, 77, 589, 1, 0, 0, 0, 79, 597, 1, 0, 0, 0, 81, 600, 1, 0, 0, 0, 83, 608, 1, 0, 0, 0, 85, 613, 1, 0, 0, 0, 87, 618, 1, 0, 0, 0, 89, 624, 1, 0, 0, 0, 91, 632, 1, 0, 0, 0, 93, 639, 1, 0, 0, 0, 95, 646, 1, 0, 0, 0, 97, 655, 1, 0, 0, 0, 99, 666, 1, 0, 0, 0, 101, 673, 1, 0, 0, 0, 103, 679, 1, 0, 0, 0, 105, 692, 1, 0, 0, 0, 107, 705, 1, 0, 0, 0, 109, 723, 1, 0, 0, 0, 111, 732, 1, 0, 0, 0, 113, 740, 1, 0, 0, 0, 115, 751, 1, 0, 0, 0, 117, 760, 1, 0, 0, 0, 119, 767, 1, 0, 0, 0, 121, 772, 1, 0, 0, 0, 123, 779, 1, 0, 0, 0, 125, 788, 1, 0, 0, 0, 127, 793, 1, 0, 0, 0, 129, 798, 1, 0, 0, 0, 131, 803, 1, 0, 0, 0, 133, 807, 1, 0, 0, 0, 135, 814, 1, 0, 0, 0, 137, 821, 1, 0, 0, 0, 139, 831, 1, 0, 0, 0, 141, 838, 1, 0, 0, 0, 143, 846, 1, 0, 0, 0, 145, 851, 1, 0, 0, 0, 147, 855, 1, 0, 0, 0, 149, 863, 1, 0, 0, 0, 151, 868, 1, 0, 0, 0, 153, 873, 1, 0, 0, 0, 155, 878, 1, 0, 0, 0, 157, 884, 1, 0, 0, 0, 159, 891, 1, 0, 0, 0, 161, 894, 1, 0, 0, 0, 163, 901, 1, 0, 0, 0, 165, 911, 1, 0, 0, 0, 167, 914, 1, 0, 0, 0, 169, 920, 1, 0, 0, 0, 171, 928, 1, 0, 0, 0, 173, 938, 1, 0, 0, 0, 175, 944, 1, 0, 0, 0, 177, 951, 1, 0, 0, 0, 179, 959, 1, 0, 0, 0, 181, 969, 1, 0, 0, 0, 183, 974, 1, 0, 0, 0, 185, 977, 1, 0, 0, 0, 187, 984, 1, 0, 0, 0, 189, 989, 1, 0, 0, 0, 191, 993, 1, 0, 0, 0, 193, 998, 1, 0, 0, 0, 195, 1003, 1, 0, 0, 0, 197, 1009, 1, 0, 0, 0, 199, 1015, 1, 0, 0, 0, 201, 1023, 1, 0, 0, 0, 203, 1026, 1, 0, 0, 0, 205, 1030, 1, 0, 0, 0, 207, 1038, 1, 0, 0, 0, 209, 1043, 1, 0, 0, 0, 211, 1046, 1, 0, 0, 0, 213, 1053, 1, 0, 0, 0, 215, 1056, 1, 0, 0, 0, 217, 1059, 1, 0, 0, 0, 219, 1065, 1, 0, 0, 0, 221, 1071, 1, 0, 0, 0, 223, 1076, 1, 0, 0, 0, 225, 1083, 1, 0, 0, 0, 227, 1091, 1, 0, 0, 0, 229, 1097, 1, 0, 0, 0, 231, 1103, 1, 0, 0, 0, 233, 1113, 1, 0, 0, 0, 235, 1124, 1, 0, 0, 0, 237, 1131, 1, 0, 0, 0, 239, 1139, 1, 0, 0, 0, 241, 1147, 1, 0, 0, 0, 243, 1154, 1, 0, 0, 0, 245, 1162, 1, 0, 0, 0, 247, 1171, 1, 0, 0, 0, 249, 1181, 1, 0, 0, 0, 251, 1187, 1, 0, 0, 0, 253, 1196, 1, 0, 0, 0, 255, 1200, 1, 0, 0, 0, 257, 1205, 1, 0, 0, 0, 259, 1215, 1, 0, 0, 0, 261, 1222, 1, 0, 0, 0, 263, 1226, 1, 0, 0, 0, 265, 1233, 1, 0, 0, 0, 267, 1239, 1, 0, 0, 0, 269, 1244, 1, 0, 0, 0, 271, 1254, 1, 0, 0, 0, 273, 1259, 1, 0, 0, 0, 275, 1262, 1, 0, 0, 0, 277, 1274, 1, 0, 0, 0, 279, 1282, 1, 0, 0, 0, 281, 1288, 1, 0, 0, 0, 283, 1295, 1, 0, 0, 0, 285, 1302, 1, 0, 0, 0, 287, 1308, 1, 0, 0, 0, 289, 1315, 1, 0, 0, 0, 291, 1322, 1, 0, 0, 0, 293, 1327, 1, 0, 0, 0, 295, 1335, 1, 0, 0, 0, 297, 1340, 1, 0, 0, 0, 299, 1346, 1, 0, 0, 0, 301, 1351, 1, 0, 0, 0, 303, 1359, 1, 0, 0, 0, 305, 1371, 1, 0, 0, 0, 307, 1376, 1, 0, 0, 0, 309, 1386, 1, 0, 0, 0, 311, 1392, 1, 0, 0, 0, 313, 1402, 1, 0, 0, 0, 315, 1412, 1, 0, 0, 0, 317, 1420, 1, 0, 0, 0, 319, 1430, 1, 0, 0, 0, 321, 1440, 1, 0, 0, 0, 323, 1451, 1, 0, 0, 0, 325, 1455, 1, 0, 0, 0, 327, 1466, 1, 0, 0, 0, 329, 1471, 1, 0, 0, 0, 331, 1481, 1, 0, 0, 0, 333, 1487, 1, 0, 0, 0, 335, 1500, 1, 0, 0, 0, 337, 1505, 1, 0, 0, 0, 339, 1516, 1, 0, 0, 0, 341, 1526, 1, 0, 0, 0, 343, 1533, 1, 0, 0, 0, 345, 1540, 1, 0, 0, 0, 347, 1545, 1, 0, 0, 0, 349, 1551, 1, 0, 0, 0, 351, 1558, 1, 0, 0, 0, 353, 1564, 1, 0, 0, 0, 355, 1570, 1, 0, 0, 0, 357, 1575, 1, 0, 0, 0, 359, 1582, 1, 0, 0, 0, 361, 1589, 1, 0, 0, 0, 363, 1597, 1, 0, 0, 0, 365, 1602, 1, 0, 0, 0, 367, 1609, 1, 0, 0, 0, 369, 1612, 1, 0, 0, 0, 371, 1655, 1, 0, 0, 0, 373, 1698, 1, 0, 0, 0, 375, 1700, 1, 0, 0, 0, 377, 1707, 1, 0, 0, 0, 379, 1710, 1, 0, 0, 0, 381, 1721, 1, 0, 0, 0, 383, 1724, 1, 0, 0, 0, 385, 1742, 1, 0, 0, 0, 387, 1756, 1, 0, 0, 0, 389, 1760, 1, 0, 0, 0, 391, 1762, 1, 0, 0, 0, 393, 1764, 1, 0, 0, 0, 395, 1766, 1, 0, 0, 0, 397, 1768, 1, 0, 0, 0, 399, 1770, 1, 0, 0, 0, 401, 1772, 1, 0, 0, 0, 403, 1774, 1, 0, 0, 0, 405, 1776, 1, 0, 0, 0, 407, 1778, 1, 0, 0, 0, 409, 1780, 1, 0, 0, 0, 411, 1782, 1, 0, 0, 0, 413, 1784, 1, 0, 0, 0, 415, 1786, 1, 0, 0, 0, 417, 1788, 1, 0, 0, 0, 419, 1790, 1, 0, 0, 0, 421, 1792, 1, 0, 0, 0, 423, 1794, 1, 0, 0, 0, 425, 1796, 1, 0, 0, 0, 427, 1798, 1, 0, 0, 0, 429, 1800, 1, 0, 0, 0, 431, 1802, 1, 0, 0, 0, 433, 1804, 1, 0, 0, 0, 435, 1806, 1, 0, 0, 0, 437, 1808, 1, 0, 0, 0, 439, 1810, 1, 0, 0, 0, 441, 1812, 1, 0, 0, 0, 443, 1814, 1, 0, 0, 0, 445, 1816, 1, 0, 0, 0, 447, 448, 5, 59, 0, 0, 448, 2, 1, 0, 0, 0, 449, 450, 5, 46, 0, 0, 450, 4, 1, 0, 0, 0, 451, 452, 5, 40, 0, 0, 452, 6, 1, 0, 0, 0, 453, 454, 5, 41, 0, 0, 454, 8, 1, 0, 0, 0, 455, 456, 5, 44, 0, 0, 456, 10, 1, 0, 0, 0, 457, 458, 5, 61, 0, 0, 458, 12, 1, 0, 0, 0, 459, 460, 5, 42, 0, 0, 460, 14, 1, 0, 0, 0, 461, 462, 5, 43, 0, 0, 462, 16, 1, 0, 0, 0, 463, 464, 5, 45, 0, 0, 464, 18, 1, 0, 0, 0, 465, 466, 5, 126, 0, 0, 466, 20, 1, 0, 0, 0, 467, 468, 5, 124, 0, 0, 468, 469, 5, 124, 0, 0, 469, 22, 1, 0, 0, 0, 470, 471, 5, 47, 0, 0, 471, 24, 1, 0, 0, 0, 472, 473, 5, 37, 0, 0, 473, 26, 1, 0, 0, 0, 474, 475, 5, 60, 0, 0, 475, 476, 5, 60, 0, 0, 476, 28, 1, 0, 0, 0, 477, 478, 5, 62, 0, 0, 478, 479, 5, 62, 0, 0, 479, 30, 1, 0, 0, 0, 480, 481, 5, 38, 0, 0, 481, 32, 1, 0, 0, 0, 482, 483, 5, 124, 0, 0, 483, 34, 1, 0, 0, 0, 484, 485, 5, 60, 0, 0, 485, 36, 1, 0, 0, 0, 486, 487, 5, 60, 0, 0, 487, 488, 5, 61, 0, 0, 488, 38, 1, 0, 0, 0, 489, 490, 5, 62, 0, 0, 490, 40, 1, 0, 0, 0, 491, 492, 5, 62, 0, 0, 492, 493, 5, 61, 0, 0, 493, 42, 1, 0, 0, 0, 494, 495, 5, 61, 0, 0, 495, 496, 5, 61, 0, 0, 496, 44, 1, 0, 0, 0, 497, 498, 5, 33, 0, 0, 498, 499, 5, 61, 0, 0, 499, 46, 1, 0, 0, 0, 500, 501, 5, 60, 0, 0, 501, 502, 5, 62, 0, 0, 502, 48, 1, 0, 0, 0, 503, 504, 3, 395, 197, 0, 504, 505, 3, 397, 198, 0, 505, 506, 3, 423, 211, 0, 506, 507, 3, 429, 214, 0, 507, 508, 3, 433, 216, 0, 508, 50, 1, 0, 0, 0, 509, 510, 3, 395, 197, 0, 510, 511, 3, 399, 199, 0, 511, 512, 3, 433, 216, 0, 512, 513, 3, 411, 205, 0, 513, 514, 3, 423, 211, 0, 514, 515, 3, 421, 210, 0, 515, 52, 1, 0, 0, 0, 516, 517, 3, 395, 197, 0, 517, 518, 3, 401, 200, 0, 518, 519, 3, 401, 200, 0, 519, 54, 1, 0, 0, 0, 520, 521, 3, 395, 197, 0, 521, 522, 3, 405, 202, 0, 522, 523, 3, 433, 216, 0, 523, 524, 3, 403, 201, 0, 524, 525, 3, 429, 214, 0, 525, 56, 1, 0, 0, 0, 526, 527, 3, 395, 197, 0, 527, 528, 3, 417, 208, 0, 528, 529, 3, 417, 208, 0, 529, 58, 1, 0, 0, 0, 530, 531, 3, 395, 197, 0, 531, 532, 3, 417, 208, 0, 532, 533, 3, 433, 216, 0, 533, 534, 3, 403, 201, 0, 534, 535, 3, 429, 214, 0, 535, 60, 1, 0, 0, 0, 536, 537, 3, 395, 197, 0, 537, 538, 3, 421, 210, 0, 538, 539, 3, 395, 197, 0, 539, 540, 3, 417, 208, 0, 540, 541, 3, 443, 221, 0, 541, 542, 3, 445, 222, 0, 542, 543, 3, 403, 201, 0, 543, 62, 1, 0, 0, 0, 544, 545, 3, 395, 197, 0, 545, 546, 3, 421, 210, 0, 546, 547, 3, 401, 200, 0, 547, 64, 1, 0, 0, 0, 548, 549, 3, 395, 197, 0, 549, 550, 3, 431, 215, 0, 550, 66, 1, 0, 0, 0, 551, 552, 3, 395, 197, 0, 552, 553, 3, 431, 215, 0, 553, 554, 3, 399, 199, 0, 554, 68, 1, 0, 0, 0, 555, 556, 3, 395, 197, 0, 556, 557, 3, 433, 216, 0, 557, 558, 3, 433, 216, 0, 558, 559, 3, 395, 197, 0, 559, 560, 3, 399, 199, 0, 560, 561, 3, 409, 204, 0, 561, 70, 1, 0, 0, 0, 562, 563, 3, 395, 197, 0, 563, 564, 3, 435, 217, 0, 564, 565, 3, 433, 216, 0, 565, 566, 3, 423, 211, 0, 566, 567, 3, 411, 205, 0, 567, 568, 3, 421, 210, 0, 568, 569, 3, 399, 199, 0, 569, 570, 3, 429, 214, 0, 570, 571, 3, 403, 201, 0, 571, 572, 3, 419, 209, 0, 572, 573, 3, 403, 201, 0, 573, 574, 3, 421, 210, 0, 574, 575, 3, 433, 216, 0, 575, 72, 1, 0, 0, 0, 576, 577, 3, 397, 198, 0, 577, 578, 3, 403, 201, 0, 578, 579, 3, 405, 202, 0, 579, 580, 3, 423, 211, 0, 580, 581, 3, 429, 214, 0, 581, 582, 3, 403, 201, 0, 582, 74, 1, 0, 0, 0, 583, 584, 3, 397, 198, 0, 584, 585, 3, 403, 201, 0, 585, 586, 3, 407, 203, 0, 586, 587, 3, 411, 205, 0, 587, 588, 3, 421, 210, 0, 588, 76, 1, 0, 0, 0, 589, 590, 3, 397, 198, 0, 590, 591, 3, 403, 201, 0, 591, 592, 3, 433, 216, 0, 592, 593, 3, 439, 219, 0, 593, 594, 3, 403, 201, 0, 594, 595, 3, 403, 201, 0, 595, 596, 3, 421, 210, 0, 596, 78, 1, 0, 0, 0, 597, 598, 3, 397, 198, 0, 598, 599, 3, 443, 221, 0, 599, 80, 1, 0, 0, 0, 600, 601, 3, 399, 199, 0, 601, 602, 3, 395, 197, 0, 602, 603, 3, 431, 215, 0, 603, 604, 3, 399, 199, 0, 604, 605, 3, 395, 197, 0, 605, 606, 3, 401, 200, 0, 606, 607, 3, 403, 201, 0, 607, 82, 1, 0, 0, 0, 608, 609, 3, 399, 199, 0, 609, 610, 3, 395, 197, 0, 610, 611, 3, 431, 215, 0, 611, 612, 3, 403, 201, 0, 612, 84, 1, 0, 0, 0, 613, 614, 3, 399, 199, 0, 614, 615, 3, 395, 197, 0, 615, 616, 3, 431, 215, 0, 616, 617, 3, 433, 216, 0, 617, 86, 1, 0, 0, 0, 618, 619, 3, 399, 199, 0, 619, 620, 3, 409, 204, 0, 620, 621, 3, 403, 201, 0, 621, 622, 3, 399, 199, 0, 622, 623, 3, 415, 207, 0, 623, 88, 1, 0, 0, 0, 624, 625, 3, 399, 199, 0, 625, 626, 3, 423, 211, 0, 626, 627, 3, 417, 208, 0, 627, 628, 3, 417, 208, 0, 628, 629, 3, 395, 197, 0, 629, 630, 3, 433, 216, 0, 630, 631, 3, 403, 201, 0, 631, 90, 1, 0, 0, 0, 632, 633, 3, 399, 199, 0, 633, 634, 3, 423, 211, 0, 634, 635, 3, 417, 208, 0, 635, 636, 3, 435, 217, 0, 636, 637, 3, 419, 209, 0, 637, 638, 3, 421, 210, 0, 638, 92, 1, 0, 0, 0, 639, 640, 3, 399, 199, 0, 640, 641, 3, 423, 211, 0, 641, 642, 3, 419, 209, 0, 642, 643, 3, 419, 209, 0, 643, 644, 3, 411, 205, 0, 644, 645, 3, 433, 216, 0, 645, 94, 1, 0, 0, 0, 646, 647, 3, 399, 199, 0, 647, 648, 3, 423, 211, 0, 648, 649, 3, 421, 210, 0, 649, 650, 3, 405, 202, 0, 650, 651, 3, 417, 208, 0, 651, 652, 3, 411, 205, 0, 652, 653, 3, 399, 199, 0, 653, 654, 3, 433, 216, 0, 654, 96, 1, 0, 0, 0, 655, 656, 3, 399, 199, 0, 656, 657, 3, 423, 211, 0, 657, 658, 3, 421, 210, 0, 658, 659, 3, 431, 215, 0, 659, 660, 3, 433, 216, 0, 660, 661, 3, 429, 214, 0, 661, 662, 3, 395, 197, 0, 662, 663, 3, 411, 205, 0, 663, 664, 3, 421, 210, 0, 664, 665, 3, 433, 216, 0, 665, 98, 1, 0, 0, 0, 666, 667, 3, 399, 199, 0, 667, 668, 3, 429, 214, 0, 668, 669, 3, 403, 201, 0, 669, 670, 3, 395, 197, 0, 670, 671, 3, 433, 216, 0, 671, 672, 3, 403, 201, 0, 672, 100, 1, 0, 0, 0, 673, 674, 3, 399, 199, 0, 674, 675, 3, 429, 214, 0, 675, 676, 3, 423, 211, 0, 676, 677, 3, 431, 215, 0, 677, 678, 3, 431, 215, 0, 678, 102, 1, 0, 0, 0, 679, 680, 3, 399, 199, 0, 680, 681, 3, 435, 217, 0, 681, 682, 3, 429, 214, 0, 682, 683, 3, 429, 214, 0, 683, 684, 3, 403, 201, 0, 684, 685, 3, 421, 210, 0, 685, 686, 3, 433, 216, 0, 686, 687, 5, 95, 0, 0, 687, 688, 3, 401, 200, 0, 688, 689, 3, 395, 197, 0, 689, 690, 3, 433, 216, 0, 690, 691, 3, 403, 201, 0, 691, 104, 1, 0, 0, 0, 692, 693, 3, 399, 199, 0, 693, 694, 3, 435, 217, 0, 694, 695, 3, 429, 214, 0, 695, 696, 3, 429, 214, 0, 696, 697, 3, 403, 201, 0, 697, 698, 3, 421, 210, 0, 698, 699, 3, 433, 216, 0, 699, 700, 5, 95, 0, 0, 700, 701, 3, 433, 216, 0, 701, 702, 3, 411, 205, 0, 702, 703, 3, 419, 209, 0, 703, 704, 3, 403, 201, 0, 704, 106, 1, 0, 0, 0, 705, 706, 3, 399, 199, 0, 706, 707, 3, 435, 217, 0, 707, 708, 3, 429, 214, 0, 708, 709, 3, 429, 214, 0, 709, 710, 3, 403, 201, 0, 710, 711, 3, 421, 210, 0, 711, 712, 3, 433, 216, 0, 712, 713, 5, 95, 0, 0, 713, 714, 3, 433, 216, 0, 714, 715, 3, 411, 205, 0, 715, 716, 3, 419, 209, 0, 716, 717, 3, 403, 201, 0, 717, 718, 3, 431, 215, 0, 718, 719, 3, 433, 216, 0, 719, 720, 3, 395, 197, 0, 720, 721, 3, 419, 209, 0, 721, 722, 3, 425, 212, 0, 722, 108, 1, 0, 0, 0, 723, 724, 3, 401, 200, 0, 724, 725, 3, 395, 197, 0, 725, 726, 3, 433, 216, 0, 726, 727, 3, 395, 197, 0, 727, 728, 3, 397, 198, 0, 728, 729, 3, 395, 197, 0, 729, 730, 3, 431, 215, 0, 730, 731, 3, 403, 201, 0, 731, 110, 1, 0, 0, 0, 732, 733, 3, 401, 200, 0, 733, 734, 3, 403, 201, 0, 734, 735, 3, 405, 202, 0, 735, 736, 3, 395, 197, 0, 736, 737, 3, 435, 217, 0, 737, 738, 3, 417, 208, 0, 738, 739, 3, 433, 216, 0, 739, 112, 1, 0, 0, 0, 740, 741, 3, 401, 200, 0, 741, 742, 3, 403, 201, 0, 742, 743, 3, 405, 202, 0, 743, 744, 3, 403, 201, 0, 744, 745, 3, 429, 214, 0, 745, 746, 3, 429, 214, 0, 746, 747, 3, 395, 197, 0, 747, 748, 3, 397, 198, 0, 748, 749, 3, 417, 208, 0, 749, 750, 3, 403, 201, 0, 750, 114, 1, 0, 0, 0, 751, 752, 3, 401, 200, 0, 752, 753, 3, 403, 201, 0, 753, 754, 3, 405, 202, 0, 754, 755, 3, 403, 201, 0, 755, 756, 3, 429, 214, 0, 756, 757, 3, 429, 214, 0, 757, 758, 3, 403, 201, 0, 758, 759, 3, 401, 200, 0, 759, 116, 1, 0, 0, 0, 760, 761, 3, 401, 200, 0, 761, 762, 3, 403, 201, 0, 762, 763, 3, 417, 208, 0, 763, 764, 3, 403, 201, 0, 764, 765, 3, 433, 216, 0, 765, 766, 3, 403, 201, 0, 766, 118, 1, 0, 0, 0, 767, 768, 3, 401, 200, 0, 768, 769, 3, 403, 201, 0, 769, 770, 3, 431, 215, 0, 770, 771, 3, 399, 199, 0, 771, 120, 1, 0, 0, 0, 772, 773, 3, 401, 200, 0, 773, 774, 3, 403, 201, 0, 774, 775, 3, 433, 216, 0, 775, 776, 3, 395, 197, 0, 776, 777, 3, 399, 199, 0, 777, 778, 3, 409, 204, 0, 778, 122, 1, 0, 0, 0, 779, 780, 3, 401, 200, 0, 780, 781, 3, 411, 205, 0, 781, 782, 3, 431, 215, 0, 782, 783, 3, 433, 216, 0, 783, 784, 3, 411, 205, 0, 784, 785, 3, 421, 210, 0, 785, 786, 3, 399, 199, 0, 786, 787, 3, 433, 216, 0, 787, 124, 1, 0, 0, 0, 788, 789, 3, 401, 200, 0, 789, 790, 3, 429, 214, 0, 790, 791, 3, 423, 211, 0, 791, 792, 3, 425, 212, 0, 792, 126, 1, 0, 0, 0, 793, 794, 3, 403, 201, 0, 794, 795, 3, 395, 197, 0, 795, 796, 3, 399, 199, 0, 796, 797, 3, 409, 204, 0, 797, 128, 1, 0, 0, 0, 798, 799, 3, 403, 201, 0, 799, 800, 3, 417, 208, 0, 800, 801, 3, 431, 215, 0, 801, 802, 3, 403, 201, 0, 802, 130, 1, 0, 0, 0, 803, 804, 3, 403, 201, 0, 804, 805, 3, 421, 210, 0, 805, 806, 3, 401, 200, 0, 806, 132, 1, 0, 0, 0, 807, 808, 3, 403, 201, 0, 808, 809, 3, 431, 215, 0, 809, 810, 3, 399, 199, 0, 810, 811, 3, 395, 197, 0, 811, 812, 3, 425, 212, 0, 812, 813, 3, 403, 201, 0, 813, 134, 1, 0, 0, 0, 814, 815, 3, 403, 201, 0, 815, 816, 3, 441, 220, 0, 816, 817, 3, 399, 199, 0, 817, 818, 3, 403, 201, 0, 818, 819, 3, 425, 212, 0, 819, 820, 3, 433, 216, 0, 820, 136, 1, 0, 0, 0, 821, 822, 3, 403, 201, 0, 822, 823, 3, 441, 220, 0, 823, 824, 3, 399, 199, 0, 824, 825, 3, 417, 208, 0, 825, 826, 3, 435, 217, 0, 826, 827, 3, 431, 215, 0, 827, 828, 3, 411, 205, 0, 828, 829, 3, 437, 218, 0, 829, 830, 3, 403, 201, 0, 830, 138, 1, 0, 0, 0, 831, 832, 3, 403, 201, 0, 832, 833, 3, 441, 220, 0, 833, 834, 3, 411, 205, 0, 834, 835, 3, 431, 215, 0, 835, 836, 3, 433, 216, 0, 836, 837, 3, 431, 215, 0, 837, 140, 1, 0, 0, 0, 838, 839, 3, 403, 201, 0, 839, 840, 3, 441, 220, 0, 840, 841, 3, 425, 212, 0, 841, 842, 3, 417, 208, 0, 842, 843, 3, 395, 197, 0, 843, 844, 3, 411, 205, 0, 844, 845, 3, 421, 210, 0, 845, 142, 1, 0, 0, 0, 846, 847, 3, 405, 202, 0, 847, 848, 3, 395, 197, 0, 848, 849, 3, 411, 205, 0, 849, 850, 3, 417, 208, 0, 850, 144, 1, 0, 0, 0, 851, 852, 3, 405, 202, 0, 852, 853, 3, 423, 211, 0, 853, 854, 3, 429, 214, 0, 854, 146, 1, 0, 0, 0, 855, 856, 3, 405, 202, 0, 856, 857, 3, 423, 211, 0, 857, 858, 3, 429, 214, 0, 858, 859, 3, 403, 201, 0, 859, 860, 3, 411, 205, 0, 860, 861, 3, 407, 203, 0, 861, 862, 3, 421, 210, 0, 862, 148, 1, 0, 0, 0, 863, 864, 3, 405, 202, 0, 864, 865, 3, 429, 214, 0, 865, 866, 3, 423, 211, 0, 866, 867, 3, 419, 209, 0, 867, 150, 1, 0, 0, 0, 868, 869, 3, 405, 202, 0, 869, 870, 3, 435, 217, 0, 870, 871, 3, 417, 208, 0, 871, 872, 3, 417, 208, 0, 872, 152, 1, 0, 0, 0, 873, 874, 3, 407, 203, 0, 874, 875, 3, 417, 208, 0, 875, 876, 3, 423, 211, 0, 876, 877, 3, 397, 198, 0, 877, 154, 1, 0, 0, 0, 878, 879, 3, 407, 203, 0, 879, 880, 3, 429, 214, 0, 880, 881, 3, 423, 211, 0, 881, 882, 3, 435, 217, 0, 882, 883, 3, 425, 212, 0, 883, 156, 1, 0, 0, 0, 884, 885, 3, 409, 204, 0, 885, 886, 3, 395, 197, 0, 886, 887, 3, 437, 218, 0, 887, 888, 3, 411, 205, 0, 888, 889, 3, 421, 210, 0, 889, 890, 3, 407, 203, 0, 890, 158, 1, 0, 0, 0, 891, 892, 3, 411, 205, 0, 892, 893, 3, 405, 202, 0, 893, 160, 1, 0, 0, 0, 894, 895, 3, 411, 205, 0, 895, 896, 3, 407, 203, 0, 896, 897, 3, 421, 210, 0, 897, 898, 3, 423, 211, 0, 898, 899, 3, 429, 214, 0, 899, 900, 3, 403, 201, 0, 900, 162, 1, 0, 0, 0, 901, 902, 3, 411, 205, 0, 902, 903, 3, 419, 209, 0, 903, 904, 3, 419, 209, 0, 904, 905, 3, 403, 201, 0, 905, 906, 3, 401, 200, 0, 906, 907, 3, 411, 205, 0, 907, 908, 3, 395, 197, 0, 908, 909, 3, 433, 216, 0, 909, 910, 3, 403, 201, 0, 910, 164, 1, 0, 0, 0, 911, 912, 3, 411, 205, 0, 912, 913, 3, 421, 210, 0, 913, 166, 1, 0, 0, 0, 914, 915, 3, 411, 205, 0, 915, 916, 3, 421, 210, 0, 916, 917, 3, 401, 200, 0, 917, 918, 3, 403, 201, 0, 918, 919, 3, 441, 220, 0, 919, 168, 1, 0, 0, 0, 920, 921, 3, 411, 205, 0, 921, 922, 3, 421, 210, 0, 922, 923, 3, 401, 200, 0, 923, 924, 3, 403, 201, 0, 924, 925, 3, 441, 220, 0, 925, 926, 3, 403, 201, 0, 926, 927, 3, 401, 200, 0, 927, 170, 1, 0, 0, 0, 928, 929, 3, 411, 205, 0, 929, 930, 3, 421, 210, 0, 930, 931, 3, 411, 205, 0, 931, 932, 3, 433, 216, 0, 932, 933, 3, 411, 205, 0, 933, 934, 3, 395, 197, 0, 934, 935, 3, 417, 208, 0, 935, 936, 3, 417, 208, 0, 936, 937, 3, 443, 221, 0, 937, 172, 1, 0, 0, 0, 938, 939, 3, 411, 205, 0, 939, 940, 3, 421, 210, 0, 940, 941, 3, 421, 210, 0, 941, 942, 3, 403, 201, 0, 942, 943, 3, 429, 214, 0, 943, 174, 1, 0, 0, 0, 944, 945, 3, 411, 205, 0, 945, 946, 3, 421, 210, 0, 946, 947, 3, 431, 215, 0, 947, 948, 3, 403, 201, 0, 948, 949, 3, 429, 214, 0, 949, 950, 3, 433, 216, 0, 950, 176, 1, 0, 0, 0, 951, 952, 3, 411, 205, 0, 952, 953, 3, 421, 210, 0, 953, 954, 3, 431, 215, 0, 954, 955, 3, 433, 216, 0, 955, 956, 3, 403, 201, 0, 956, 957, 3, 395, 197, 0, 957, 958, 3, 401, 200, 0, 958, 178, 1, 0, 0, 0, 959, 960, 3, 411, 205, 0, 960, 961, 3, 421, 210, 0, 961, 962, 3, 433, 216, 0, 962, 963, 3, 403, 201, 0, 963, 964, 3, 429, 214, 0, 964, 965, 3, 431, 215, 0, 965, 966, 3, 403, 201, 0, 966, 967, 3, 399, 199, 0, 967, 968, 3, 433, 216, 0, 968, 180, 1, 0, 0, 0, 969, 970, 3, 411, 205, 0, 970, 971, 3, 421, 210, 0, 971, 972, 3, 433, 216, 0, 972, 973, 3, 423, 211, 0, 973, 182, 1, 0, 0, 0, 974, 975, 3, 411, 205, 0, 975, 976, 3, 431, 215, 0, 976, 184, 1, 0, 0, 0, 977, 978, 3, 411, 205, 0, 978, 979, 3, 431, 215, 0, 979, 980, 3, 421, 210, 0, 980, 981, 3, 435, 217, 0, 981, 982, 3, 417, 208, 0, 982, 983, 3, 417, 208, 0, 983, 186, 1, 0, 0, 0, 984, 985, 3, 413, 206, 0, 985, 986, 3, 423, 211, 0, 986, 987, 3, 411, 205, 0, 987, 988, 3, 421, 210, 0, 988, 188, 1, 0, 0, 0, 989, 990, 3, 415, 207, 0, 990, 991, 3, 403, 201, 0, 991, 992, 3, 443, 221, 0, 992, 190, 1, 0, 0, 0, 993, 994, 3, 417, 208, 0, 994, 995, 3, 403, 201, 0, 995, 996, 3, 405, 202, 0, 996, 997, 3, 433, 216, 0, 997, 192, 1, 0, 0, 0, 998, 999, 3, 417, 208, 0, 999, 1000, 3, 411, 205, 0, 1000, 1001, 3, 415, 207, 0, 1001, 1002, 3, 403, 201, 0, 1002, 194, 1, 0, 0, 0, 1003, 1004, 3, 417, 208, 0, 1004, 1005, 3, 411, 205, 0, 1005, 1006, 3, 419, 209, 0, 1006, 1007, 3, 411, 205, 0, 1007, 1008, 3, 433, 216, 0, 1008, 196, 1, 0, 0, 0, 1009, 1010, 3, 419, 209, 0, 1010, 1011, 3, 395, 197, 0, 1011, 1012, 3, 433, 216, 0, 1012, 1013, 3, 399, 199, 0, 1013, 1014, 3, 409, 204, 0, 1014, 198, 1, 0, 0, 0, 1015, 1016, 3, 421, 210, 0, 1016, 1017, 3, 395, 197, 0, 1017, 1018, 3, 433, 216, 0, 1018, 1019, 3, 435, 217, 0, 1019, 1020, 3, 429, 214, 0, 1020, 1021, 3, 395, 197, 0, 1021, 1022, 3, 417, 208, 0, 1022, 200, 1, 0, 0, 0, 1023, 1024, 3, 421, 210, 0, 1024, 1025, 3, 423, 211, 0, 1025, 202, 1, 0, 0, 0, 1026, 1027, 3, 421, 210, 0, 1027, 1028, 3, 423, 211, 0, 1028, 1029, 3, 433, 216, 0, 1029, 204, 1, 0, 0, 0, 1030, 1031, 3, 421, 210, 0, 1031, 1032, 3, 423, 211, 0, 1032, 1033, 3, 433, 216, 0, 1033, 1034, 3, 421, 210, 0, 1034, 1035, 3, 435, 217, 0, 1035, 1036, 3, 417, 208, 0, 1036, 1037, 3, 417, 208, 0, 1037, 206, 1, 0, 0, 0, 1038, 1039, 3, 421, 210, 0, 1039, 1040, 3, 435, 217, 0, 1040, 1041, 3, 417, 208, 0, 1041, 1042, 3, 417, 208, 0, 1042, 208, 1, 0, 0, 0, 1043, 1044, 3, 423, 211, 0, 1044, 1045, 3, 405, 202, 0, 1045, 210, 1, 0, 0, 0, 1046, 1047, 3, 423, 211, 0, 1047, 1048, 3, 405, 202, 0, 1048, 1049, 3, 405, 202, 0, 1049, 1050, 3, 431, 215, 0, 1050, 1051, 3, 403, 201, 0, 1051, 1052, 3, 433, 216, 0, 1052, 212, 1, 0, 0, 0, 1053, 1054, 3, 423, 211, 0, 1054, 1055, 3, 421, 210, 0, 1055, 214, 1, 0, 0, 0, 1056, 1057, 3, 423, 211, 0, 1057, 1058, 3, 429, 214, 0, 1058, 216, 1, 0, 0, 0, 1059, 1060, 3, 423, 211, 0, 1060, 1061, 3, 429, 214, 0, 1061, 1062, 3, 401, 200, 0, 1062, 1063, 3, 403, 201, 0, 1063, 1064, 3, 429, 214, 0, 1064, 218, 1, 0, 0, 0, 1065, 1066, 3, 423, 211, 0, 1066, 1067, 3, 435, 217, 0, 1067, 1068, 3, 433, 216, 0, 1068, 1069, 3, 403, 201, 0, 1069, 1070, 3, 429, 214, 0, 1070, 220, 1, 0, 0, 0, 1071, 1072, 3, 425, 212, 0, 1072, 1073, 3, 417, 208, 0, 1073, 1074, 3, 395, 197, 0, 1074, 1075, 3, 421, 210, 0, 1075, 222, 1, 0, 0, 0, 1076, 1077, 3, 425, 212, 0, 1077, 1078, 3, 429, 214, 0, 1078, 1079, 3, 395, 197, 0, 1079, 1080, 3, 407, 203, 0, 1080, 1081, 3, 419, 209, 0, 1081, 1082, 3, 395, 197, 0, 1082, 224, 1, 0, 0, 0, 1083, 1084, 3, 425, 212, 0, 1084, 1085, 3, 429, 214, 0, 1085, 1086, 3, 411, 205, 0, 1086, 1087, 3, 419, 209, 0, 1087, 1088, 3, 395, 197, 0, 1088, 1089, 3, 429, 214, 0, 1089, 1090, 3, 443, 221, 0, 1090, 226, 1, 0, 0, 0, 1091, 1092, 3, 427, 213, 0, 1092, 1093, 3, 435, 217, 0, 1093, 1094, 3, 403, 201, 0, 1094, 1095, 3, 429, 214, 0, 1095, 1096, 3, 443, 221, 0, 1096, 228, 1, 0, 0, 0, 1097, 1098, 3, 429, 214, 0, 1098, 1099, 3, 395, 197, 0, 1099, 1100, 3, 411, 205, 0, 1100, 1101, 3, 431, 215, 0, 1101, 1102, 3, 403, 201, 0, 1102, 230, 1, 0, 0, 0, 1103, 1104, 3, 429, 214, 0, 1104, 1105, 3, 403, 201, 0, 1105, 1106, 3, 399, 199, 0, 1106, 1107, 3, 435, 217, 0, 1107, 1108, 3, 429, 214, 0, 1108, 1109, 3, 431, 215, 0, 1109, 1110, 3, 411, 205, 0, 1110, 1111, 3, 437, 218, 0, 1111, 1112, 3, 403, 201, 0, 1112, 232, 1, 0, 0, 0, 1113, 1114, 3, 429, 214, 0, 1114, 1115, 3, 403, 201, 0, 1115, 1116, 3, 405, 202, 0, 1116, 1117, 3, 403, 201, 0, 1117, 1118, 3, 429, 214, 0, 1118, 1119, 3, 403, 201, 0, 1119, 1120, 3, 421, 210, 0, 1120, 1121, 3, 399, 199, 0, 1121, 1122, 3, 403, 201, 0, 1122, 1123, 3, 431, 215, 0, 1123, 234, 1, 0, 0, 0, 1124, 1125, 3, 429, 214, 0, 1125, 1126, 3, 403, 201, 0, 1126, 1127, 3, 407, 203, 0, 1127, 1128, 3, 403, 201, 0, 1128, 1129, 3, 441, 220, 0, 1129, 1130, 3, 425, 212, 0, 1130, 236, 1, 0, 0, 0, 1131, 1132, 3, 429, 214, 0, 1132, 1133, 3, 403, 201, 0, 1133, 1134, 3, 411, 205, 0, 1134, 1135, 3, 421, 210, 0, 1135, 1136, 3, 401, 200, 0, 1136, 1137, 3, 403, 201, 0, 1137, 1138, 3, 441, 220, 0, 1138, 238, 1, 0, 0, 0, 1139, 1140, 3, 429, 214, 0, 1140, 1141, 3, 403, 201, 0, 1141, 1142, 3, 417, 208, 0, 1142, 1143, 3, 403, 201, 0, 1143, 1144, 3, 395, 197, 0, 1144, 1145, 3, 431, 215, 0, 1145, 1146, 3, 403, 201, 0, 1146, 240, 1, 0, 0, 0, 1147, 1148, 3, 429, 214, 0, 1148, 1149, 3, 403, 201, 0, 1149, 1150, 3, 421, 210, 0, 1150, 1151, 3, 395, 197, 0, 1151, 1152, 3, 419, 209, 0, 1152, 1153, 3, 403, 201, 0, 1153, 242, 1, 0, 0, 0, 1154, 1155, 3, 429, 214, 0, 1155, 1156, 3, 403, 201, 0, 1156, 1157, 3, 425, 212, 0, 1157, 1158, 3, 417, 208, 0, 1158, 1159, 3, 395, 197, 0, 1159, 1160, 3, 399, 199, 0, 1160, 1161, 3, 403, 201, 0, 1161, 244, 1, 0, 0, 0, 1162, 1163, 3, 429, 214, 0, 1163, 1164, 3, 403, 201, 0, 1164, 1165, 3, 431, 215, 0, 1165, 1166, 3, 433, 216, 0, 1166, 1167, 3, 429, 214, 0, 1167, 1168, 3, 411, 205, 0, 1168, 1169, 3, 399, 199, 0, 1169, 1170, 3, 433, 216, 0, 1170, 246, 1, 0, 0, 0, 1171, 1172, 3, 429, 214, 0, 1172, 1173, 3, 403, 201, 0, 1173, 1174, 3, 433, 216, 0, 1174, 1175, 3, 435, 217, 0, 1175, 1176, 3, 429, 214, 0, 1176, 1177, 3, 421, 210, 0, 1177, 1178, 3, 411, 205, 0, 1178, 1179, 3, 421, 210, 0, 1179, 1180, 3, 407, 203, 0, 1180, 248, 1, 0, 0, 0, 1181, 1182, 3, 429, 214, 0, 1182, 1183, 3, 411, 205, 0, 1183, 1184, 3, 407, 203, 0, 1184, 1185, 3, 409, 204, 0, 1185, 1186, 3, 433, 216, 0, 1186, 250, 1, 0, 0, 0, 1187, 1188, 3, 429, 214, 0, 1188, 1189, 3, 423, 211, 0, 1189, 1190, 3, 417, 208, 0, 1190, 1191, 3, 417, 208, 0, 1191, 1192, 3, 397, 198, 0, 1192, 1193, 3, 395, 197, 0, 1193, 1194, 3, 399, 199, 0, 1194, 1195, 3, 415, 207, 0, 1195, 252, 1, 0, 0, 0, 1196, 1197, 3, 429, 214, 0, 1197, 1198, 3, 423, 211, 0, 1198, 1199, 3, 439, 219, 0, 1199, 254, 1, 0, 0, 0, 1200, 1201, 3, 429, 214, 0, 1201, 1202, 3, 423, 211, 0, 1202, 1203, 3, 439, 219, 0, 1203, 1204, 3, 431, 215, 0, 1204, 256, 1, 0, 0, 0, 1205, 1206, 3, 431, 215, 0, 1206, 1207, 3, 395, 197, 0, 1207, 1208, 3, 437, 218, 0, 1208, 1209, 3, 403, 201, 0, 1209, 1210, 3, 425, 212, 0, 1210, 1211, 3, 423, 211, 0, 1211, 1212, 3, 411, 205, 0, 1212, 1213, 3, 421, 210, 0, 1213, 1214, 3, 433, 216, 0, 1214, 258, 1, 0, 0, 0, 1215, 1216, 3, 431, 215, 0, 1216, 1217, 3, 403, 201, 0, 1217, 1218, 3, 417, 208, 0, 1218, 1219, 3, 403, 201, 0, 1219, 1220, 3, 399, 199, 0, 1220, 1221, 3, 433, 216, 0, 1221, 260, 1, 0, 0, 0, 1222, 1223, 3, 431, 215, 0, 1223, 1224, 3, 403, 201, 0, 1224, 1225, 3, 433, 216, 0, 1225, 262, 1, 0, 0, 0, 1226, 1227, 3, 431, 215, 0, 1227, 1228, 3, 433, 216, 0, 1228, 1229, 3, 429, 214, 0, 1229, 1230, 3, 411, 205, 0, 1230, 1231, 3, 399, 199, 0, 1231, 1232, 3, 433, 216, 0, 1232, 264, 1, 0, 0, 0, 1233, 1234, 3, 433, 216, 0, 1234, 1235, 3, 395, 197, 0, 1235, 1236, 3, 397, 198, 0, 1236, 1237, 3, 417, 208, 0, 1237, 1238, 3, 403, 201, 0, 1238, 266, 1, 0, 0, 0, 1239, 1240, 3, 433, 216, 0, 1240, 1241, 3, 403, 201, 0, 1241, 1242, 3, 419, 209, 0, 1242, 1243, 3, 425, 212, 0, 1243, 268, 1, 0, 0, 0, 1244, 1245, 3, 433, 216, 0, 1245, 1246, 3, 403, 201, 0, 1246, 1247, 3, 419, 209, 0, 1247, 1248, 3, 425, 212, 0, 1248, 1249, 3, 423, 211, 0, 1249, 1250, 3, 429, 214, 0, 1250, 1251, 3, 395, 197, 0, 1251, 1252, 3, 429, 214, 0, 1252, 1253, 3, 443, 221, 0, 1253, 270, 1, 0, 0, 0, 1254, 1255, 3, 433, 216, 0, 1255, 1256, 3, 409, 204, 0, 1256, 1257, 3, 403, 201, 0, 1257, 1258, 3, 421, 210, 0, 1258, 272, 1, 0, 0, 0, 1259, 1260, 3, 433, 216, 0, 1260, 1261, 3, 423, 211, 0, 1261, 274, 1, 0, 0, 0, 1262, 1263, 3, 433, 216, 0, 1263, 1264, 3, 429, 214, 0, 1264, 1265, 3, 395, 197, 0, 1265, 1266, 3, 421, 210, 0, 1266, 1267, 3, 431, 215, 0, 1267, 1268, 3, 395, 197, 0, 1268, 1269, 3, 399, 199, 0, 1269, 1270, 3, 433, 216, 0, 1270, 1271, 3, 411, 205, 0, 1271, 1272, 3, 423, 211, 0, 1272, 1273, 3, 421, 210, 0, 1273, 276, 1, 0, 0, 0, 1274, 1275, 3, 433, 216, 0, 1275, 1276, 3, 429, 214, 0, 1276, 1277, 3, 411, 205, 0, 1277, 1278, 3, 407, 203, 0, 1278, 1279, 3, 407, 203, 0, 1279, 1280, 3, 403, 201, 0, 1280, 1281, 3, 429, 214, 0, 1281, 278, 1, 0, 0, 0, 1282, 1283, 3, 435, 217, 0, 1283, 1284, 3, 421, 210, 0, 1284, 1285, 3, 411, 205, 0, 1285, 1286, 3, 423, 211, 0, 1286, 1287, 3, 421, 210, 0, 1287, 280, 1, 0, 0, 0, 1288, 1289, 3, 435, 217, 0, 1289, 1290, 3, 421, 210, 0, 1290, 1291, 3, 411, 205, 0, 1291, 1292, 3, 427, 213, 0, 1292, 1293, 3, 435, 217, 0, 1293, 1294, 3, 403, 201, 0, 1294, 282, 1, 0, 0, 0, 1295, 1296, 3, 435, 217, 0, 1296, 1297, 3, 425, 212, 0, 1297, 1298, 3, 401, 200, 0, 1298, 1299, 3, 395, 197, 0, 1299, 1300, 3, 433, 216, 0, 1300, 1301, 3, 403, 201, 0, 1301, 284, 1, 0, 0, 0, 1302, 1303, 3, 435, 217, 0, 1303, 1304, 3, 431, 215, 0, 1304, 1305, 3, 411, 205, 0, 1305, 1306, 3, 421, 210, 0, 1306, 1307, 3, 407, 203, 0, 1307, 286, 1, 0, 0, 0, 1308, 1309, 3, 437, 218, 0, 1309, 1310, 3, 395, 197, 0, 1310, 1311, 3, 399, 199, 0, 1311, 1312, 3, 435, 217, 0, 1312, 1313, 3, 435, 217, 0, 1313, 1314, 3, 419, 209, 0, 1314, 288, 1, 0, 0, 0, 1315, 1316, 3, 437, 218, 0, 1316, 1317, 3, 395, 197, 0, 1317, 1318, 3, 417, 208, 0, 1318, 1319, 3, 435, 217, 0, 1319, 1320, 3, 403, 201, 0, 1320, 1321, 3, 431, 215, 0, 1321, 290, 1, 0, 0, 0, 1322, 1323, 3, 437, 218, 0, 1323, 1324, 3, 411, 205, 0, 1324, 1325, 3, 403, 201, 0, 1325, 1326, 3, 439, 219, 0, 1326, 292, 1, 0, 0, 0, 1327, 1328, 3, 437, 218, 0, 1328, 1329, 3, 411, 205, 0, 1329, 1330, 3, 429, 214, 0, 1330, 1331, 3, 433, 216, 0, 1331, 1332, 3, 435, 217, 0, 1332, 1333, 3, 395, 197, 0, 1333, 1334, 3, 417, 208, 0, 1334, 294, 1, 0, 0, 0, 1335, 1336, 3, 439, 219, 0, 1336, 1337, 3, 409, 204, 0, 1337, 1338, 3, 403, 201, 0, 1338, 1339, 3, 421, 210, 0, 1339, 296, 1, 0, 0, 0, 1340, 1341, 3, 439, 219, 0, 1341, 1342, 3, 409, 204, 0, 1342, 1343, 3, 403, 201, 0, 1343, 1344, 3, 429, 214, 0, 1344, 1345, 3, 403, 201, 0, 1345, 298, 1, 0, 0, 0, 1346, 1347, 3, 439, 219, 0, 1347, 1348, 3, 411, 205, 0, 1348, 1349, 3, 433, 216, 0, 1349, 1350, 3, 409, 204, 0, 1350, 300, 1, 0, 0, 0, 1351, 1352, 3, 439, 219, 0, 1352, 1353, 3, 411, 205, 0, 1353, 1354, 3, 433, 216, 0, 1354, 1355, 3, 409, 204, 0, 1355, 1356, 3, 423, 211, 0, 1356, 1357, 3, 435, 217, 0, 1357, 1358, 3, 433, 216, 0, 1358, 302, 1, 0, 0, 0, 1359, 1360, 3, 405, 202, 0, 1360, 1361, 3, 411, 205, 0, 1361, 1362, 3, 429, 214, 0, 1362, 1363, 3, 431, 215, 0, 1363, 1364, 3, 433, 216, 0, 1364, 1365, 5, 95, 0, 0, 1365, 1366, 3, 437, 218, 0, 1366, 1367, 3, 395, 197, 0, 1367, 1368, 3, 417, 208, 0, 1368, 1369, 3, 435, 217, 0, 1369, 1370, 3, 403, 201, 0, 1370, 304, 1, 0, 0, 0, 1371, 1372, 3, 423, 211, 0, 1372, 1373, 3, 437, 218, 0, 1373, 1374, 3, 403, 201, 0, 1374, 1375, 3, 429, 214, 0, 1375, 306, 1, 0, 0, 0, 1376, 1377, 3, 425, 212, 0, 1377, 1378, 3, 395, 197, 0, 1378, 1379, 3, 429, 214, 0, 1379, 1380, 3, 433, 216, 0, 1380, 1381, 3, 411, 205, 0, 1381, 1382, 3, 433, 216, 0, 1382, 1383, 3, 411, 205, 0, 1383, 1384, 3, 423, 211, 0, 1384, 1385, 3, 421, 210, 0, 1385, 308, 1, 0, 0, 0, 1386, 1387, 3, 429, 214, 0, 1387, 1388, 3, 395, 197, 0, 1388, 1389, 3, 421, 210, 0, 1389, 1390, 3, 407, 203, 0, 1390, 1391, 3, 403, 201, 0, 1391, 310, 1, 0, 0, 0, 1392, 1393, 3, 425, 212, 0, 1393, 1394, 3, 429, 214, 0, 1394, 1395, 3, 403, 201, 0, 1395, 1396, 3, 399, 199, 0, 1396, 1397, 3, 403, 201, 0, 1397, 1398, 3, 401, 200, 0, 1398, 1399, 3, 411, 205, 0, 1399, 1400, 3, 421, 210, 0, 1400, 1401, 3, 407, 203, 0, 1401, 312, 1, 0, 0, 0, 1402, 1403, 3, 435, 217, 0, 1403, 1404, 3, 421, 210, 0, 1404, 1405, 3, 397, 198, 0, 1405, 1406, 3, 423, 211, 0, 1406, 1407, 3, 435, 217, 0, 1407, 1408, 3, 421, 210, 0, 1408, 1409, 3, 401, 200, 0, 1409, 1410, 3, 403, 201, 0, 1410, 1411, 3, 401, 200, 0, 1411, 314, 1, 0, 0, 0, 1412, 1413, 3, 399, 199, 0, 1413, 1414, 3, 435, 217, 0, 1414, 1415, 3, 429, 214, 0, 1415, 1416, 3, 429, 214, 0, 1416, 1417, 3, 403, 201, 0, 1417, 1418, 3, 421, 210, 0, 1418, 1419, 3, 433, 216, 0, 1419, 316, 1, 0, 0, 0, 1420, 1421, 3, 405, 202, 0, 1421, 1422, 3, 423, 211, 0, 1422, 1423, 3, 417, 208, 0, 1423, 1424, 3, 417, 208, 0, 1424, 1425, 3, 423, 211, 0, 1425, 1426, 3, 439, 219, 0, 1426, 1427, 3, 411, 205, 0, 1427, 1428, 3, 421, 210, 0, 1428, 1429, 3, 407, 203, 0, 1429, 318, 1, 0, 0, 0, 1430, 1431, 3, 399, 199, 0, 1431, 1432, 3, 435, 217, 0, 1432, 1433, 3, 419, 209, 0, 1433, 1434, 3, 403, 201, 0, 1434, 1435, 5, 95, 0, 0, 1435, 1436, 3, 401, 200, 0, 1436, 1437, 3, 411, 205, 0, 1437, 1438, 3, 431, 215, 0, 1438, 1439, 3, 433, 216, 0, 1439, 320, 1, 0, 0, 0, 1440, 1441, 3, 401, 200, 0, 1441, 1442, 3, 403, 201, 0, 1442, 1443, 3, 421, 210, 0, 1443, 1444, 3, 431, 215, 0, 1444, 1445, 3, 403, 201, 0, 1445, 1446, 5, 95, 0, 0, 1446, 1447, 3, 429, 214, 0, 1447, 1448, 3, 395, 197, 0, 1448, 1449, 3, 421, 210, 0, 1449, 1450, 3, 415, 207, 0, 1450, 322, 1, 0, 0, 0, 1451, 1452, 3, 417, 208, 0, 1452, 1453, 3, 395, 197, 0, 1453, 1454, 3, 407, 203, 0, 1454, 324, 1, 0, 0, 0, 1455, 1456, 3, 417, 208, 0, 1456, 1457, 3, 395, 197, 0, 1457, 1458, 3, 431, 215, 0, 1458, 1459, 3, 433, 216, 0, 1459, 1460, 5, 95, 0, 0, 1460, 1461, 3, 437, 218, 0, 1461, 1462, 3, 395, 197, 0, 1462, 1463, 3, 417, 208, 0, 1463, 1464, 3, 435, 217, 0, 1464, 1465, 3, 403, 201, 0, 1465, 326, 1, 0, 0, 0, 1466, 1467, 3, 417, 208, 0, 1467, 1468, 3, 403, 201, 0, 1468, 1469, 3, 395, 197, 0, 1469, 1470, 3, 401, 200, 0, 1470, 328, 1, 0, 0, 0, 1471, 1472, 3, 421, 210, 0, 1472, 1473, 3, 433, 216, 0, 1473, 1474, 3, 409, 204, 0, 1474, 1475, 5, 95, 0, 0, 1475, 1476, 3, 437, 218, 0, 1476, 1477, 3, 395, 197, 0, 1477, 1478, 3, 417, 208, 0, 1478, 1479, 3, 435, 217, 0, 1479, 1480, 3, 403, 201, 0, 1480, 330, 1, 0, 0, 0, 1481, 1482, 3, 421, 210, 0, 1482, 1483, 3, 433, 216, 0, 1483, 1484, 3, 411, 205, 0, 1484, 1485, 3, 417, 208, 0, 1485, 1486, 3, 403, 201, 0, 1486, 332, 1, 0, 0, 0, 1487, 1488, 3, 425, 212, 0, 1488, 1489, 3, 403, 201, 0, 1489, 1490, 3, 429, 214, 0, 1490, 1491, 3, 399, 199, 0, 1491, 1492, 3, 403, 201, 0, 1492, 1493, 3, 421, 210, 0, 1493, 1494, 3, 433, 216, 0, 1494, 1495, 5, 95, 0, 0, 1495, 1496, 3, 429, 214, 0, 1496, 1497, 3, 395, 197, 0, 1497, 1498, 3, 421, 210, 0, 1498, 1499, 3, 415, 207, 0, 1499, 334, 1, 0, 0, 0, 1500, 1501, 3, 429, 214, 0, 1501, 1502, 3, 395, 197, 0, 1502, 1503, 3, 421, 210, 0, 1503, 1504, 3, 415, 207, 0, 1504, 336, 1, 0, 0, 0, 1505, 1506, 3, 429, 214, 0, 1506, 1507, 3, 423, 211, 0, 1507, 1508, 3, 439, 219, 0, 1508, 1509, 5, 95, 0, 0, 1509, 1510, 3, 421, 210, 0, 1510, 1511, 3, 435, 217, 0, 1511, 1512, 3, 419, 209, 0, 1512, 1513, 3, 397, 198, 0, 1513, 1514, 3, 403, 201, 0, 1514, 1515, 3, 429, 214, 0, 1515, 338, 1, 0, 0, 0, 1516, 1517, 3, 407, 203, 0, 1517, 1518, 3, 403, 201, 0, 1518, 1519, 3, 421, 210, 0, 1519, 1520, 3, 403, 201, 0, 1520, 1521, 3, 429, 214, 0, 1521, 1522, 3, 395, 197, 0, 1522, 1523, 3, 433, 216, 0, 1523, 1524, 3, 403, 201, 0, 1524, 1525, 3, 401, 200, 0, 1525, 340, 1, 0, 0, 0, 1526, 1527, 3, 395, 197, 0, 1527, 1528, 3, 417, 208, 0, 1528, 1529, 3, 439, 219, 0, 1529, 1530, 3, 395, 197, 0, 1530, 1531, 3, 443, 221, 0, 1531, 1532, 3, 431, 215, 0, 1532, 342, 1, 0, 0, 0, 1533, 1534, 3, 431, 215, 0, 1534, 1535, 3, 433, 216, 0, 1535, 1536, 3, 423, 211, 0, 1536, 1537, 3, 429, 214, 0, 1537, 1538, 3, 403, 201, 0, 1538, 1539, 3, 401, 200, 0, 1539, 344, 1, 0, 0, 0, 1540, 1541, 3, 433, 216, 0, 1541, 1542, 3, 429, 214, 0, 1542, 1543, 3, 435, 217, 0, 1543, 1544, 3, 403, 201, 0, 1544, 346, 1, 0, 0, 0, 1545, 1546, 3, 405, 202, 0, 1546, 1547, 3, 395, 197, 0, 1547, 1548, 3, 417, 208, 0, 1548, 1549, 3, 431, 215, 0, 1549, 1550, 3, 403, 201, 0, 1550, 348, 1, 0, 0, 0, 1551, 1552, 3, 439, 219, 0, 1552, 1553, 3, 411, 205, 0, 1553, 1554, 3, 421, 210, 0, 1554, 1555, 3, 401, 200, 0, 1555, 1556, 3, 423, 211, 0, 1556, 1557, 3, 439, 219, 0, 1557, 350, 1, 0, 0, 0, 1558, 1559, 3, 421, 210, 0, 1559, 1560, 3, 435, 217, 0, 1560, 1561, 3, 417, 208, 0, 1561, 1562, 3, 417, 208, 0, 1562, 1563, 3, 431, 215, 0, 1563, 352, 1, 0, 0, 0, 1564, 1565, 3, 405, 202, 0, 1565, 1566, 3, 411, 205, 0, 1566, 1567, 3, 429, 214, 0, 1567, 1568, 3, 431, 215, 0, 1568, 1569, 3, 433, 216, 0, 1569, 354, 1, 0, 0, 0, 1570, 1571, 3, 417, 208, 0, 1571, 1572, 3, 395, 197, 0, 1572, 1573, 3, 431, 215, 0, 1573, 1574, 3, 433, 216, 0, 1574, 356, 1, 0, 0, 0, 1575, 1576, 3, 405, 202, 0, 1576, 1577, 3, 411, 205, 0, 1577, 1578, 3, 417, 208, 0, 1578, 1579, 3, 433, 216, 0, 1579, 1580, 3, 403, 201, 0, 1580, 1581, 3, 429, 214, 0, 1581, 358, 1, 0, 0, 0, 1582, 1583, 3, 407, 203, 0, 1583, 1584, 3, 429, 214, 0, 1584, 1585, 3, 423, 211, 0, 1585, 1586, 3, 435, 217, 0, 1586, 1587, 3, 425, 212, 0, 1587, 1588, 3, 431, 215, 0, 1588, 360, 1, 0, 0, 0, 1589, 1590, 3, 403, 201, 0, 1590, 1591, 3, 441, 220, 0, 1591, 1592, 3, 399, 199, 0, 1592, 1593, 3, 417, 208, 0, 1593, 1594, 3, 435, 217, 0, 1594, 1595, 3, 401, 200, 0, 1595, 1596, 3, 403, 201, 0, 1596, 362, 1, 0, 0, 0, 1597, 1598, 3, 433, 216, 0, 1598, 1599, 3, 411, 205, 0, 1599, 1600, 3, 403, 201, 0, 1600, 1601, 3, 431, 215, 0, 1601, 364, 1, 0, 0, 0, 1602, 1603, 3, 423, 211, 0, 1603, 1604, 3, 433, 216, 0, 1604, 1605, 3, 409, 204, 0, 1605, 1606, 3, 403, 201, 0, 1606, 1607, 3, 429, 214, 0, 1607, 1608, 3, 431, 215, 0, 1608, 366, 1, 0, 0, 0, 1609, 1610, 3, 401, 200, 0, 1610, 1611, 3, 423, 211, 0, 1611, 368, 1, 0, 0, 0, 1612, 1613, 3, 421, 210, 0, 1613, 1614, 3, 423, 211, 0, 1614, 1615, 3, 433, 216, 0, 1615, 1616, 3, 409, 204, 0, 1616, 1617, 3, 411, 205, 0, 1617, 1618, 3, 421, 210, 0, 1618, 1619, 3, 407, 203, 0, 1619, 370, 1, 0, 0, 0, 1620, 1626, 5, 34, 0, 0, 1621, 1625, 8, 0, 0, 0, 1622, 1623, 5, 34, 0, 0, 1623, 1625, 5, 34, 0, 0, 1624, 1621, 1, 0, 0, 0, 1624, 1622, 1, 0, 0, 0, 1625, 1628, 1, 0, 0, 0, 1626, 1624, 1, 0, 0, 0, 1626, 1627, 1, 0, 0, 0, 1627, 1629, 1, 0, 0, 0, 1628, 1626, 1, 0, 0, 0, 1629, 1656, 5, 34, 0, 0, 1630, 1636, 5, 96, 0, 0, 1631, 1635, 8, 1, 0, 0, 1632, 1633, 5, 96, 0, 0, 1633, 1635, 5, 96, 0, 0, 1634, 1631, 1, 0, 0, 0, 1634, 1632, 1, 0, 0, 0, 1635, 1638, 1, 0, 0, 0, 1636, 1634, 1, 0, 0, 0, 1636, 1637, 1, 0, 0, 0, 1637, 1639, 1, 0, 0, 0, 1638, 1636, 1, 0, 0, 0, 1639, 1656, 5, 96, 0, 0, 1640, 1644, 5, 91, 0, 0, 1641, 1643, 8, 2, 0, 0, 1642, 1641, 1, 0, 0, 0, 1643, 1646, 1, 0, 0, 0, 1644, 1642, 1, 0, 0, 0, 1644, 1645, 1, 0, 0, 0, 1645, 1647, 1, 0, 0, 0, 1646, 1644, 1, 0, 0, 0, 1647, 1656, 5, 93, 0, 0, 1648, 1652, 7, 3, 0, 0, 1649, 1651, 7, 4, 0, 0, 1650, 1649, 1, 0, 0, 0, 1651, 1654, 1, 0, 0, 0, 1652, 1650, 1, 0, 0, 0, 1652, 1653, 1, 0, 0, 0, 1653, 1656, 1, 0, 0, 0, 1654, 1652, 1, 0, 0, 0, 1655, 1620, 1, 0, 0, 0, 1655, 1630, 1, 0, 0, 0, 1655, 1640, 1, 0, 0, 0, 1655, 1648, 1, 0, 0, 0, 1656, 372, 1, 0, 0, 0, 1657, 1659, 3, 393, 196, 0, 1658, 1657, 1, 0, 0, 0, 1659, 1660, 1, 0, 0, 0, 1660, 1658, 1, 0, 0, 0, 1660, 1661, 1, 0, 0, 0, 1661, 1669, 1, 0, 0, 0, 1662, 1666, 5, 46, 0, 0, 1663, 1665, 3, 393, 196, 0, 1664, 1663, 1, 0, 0, 0, 1665, 1668, 1, 0, 0, 0, 1666, 1664, 1, 0, 0, 0, 1666, 1667, 1, 0, 0, 0, 1667, 1670, 1, 0, 0, 0, 1668, 1666, 1, 0, 0, 0, 1669, 1662, 1, 0, 0, 0, 1669, 1670, 1, 0, 0, 0, 1670, 1678, 1, 0, 0, 0, 1671, 1673, 5, 46, 0, 0, 1672, 1674, 3, 393, 196, 0, 1673, 1672, 1, 0, 0, 0, 1674, 1675, 1, 0, 0, 0, 1675, 1673, 1, 0, 0, 0, 1675, 1676, 1, 0, 0, 0, 1676, 1678, 1, 0, 0, 0, 1677, 1658, 1, 0, 0, 0, 1677, 1671, 1, 0, 0, 0, 1678, 1688, 1, 0, 0, 0, 1679, 1681, 3, 403, 201, 0, 1680, 1682, 7, 5, 0, 0, 1681, 1680, 1, 0, 0, 0, 1681, 1682, 1, 0, 0, 0, 1682, 1684, 1, 0, 0, 0, 1683, 1685, 3, 393, 196, 0, 1684, 1683, 1, 0, 0, 0, 1685, 1686, 1, 0, 0, 0, 1686, 1684, 1, 0, 0, 0, 1686, 1687, 1, 0, 0, 0, 1687, 1689, 1, 0, 0, 0, 1688, 1679, 1, 0, 0, 0, 1688, 1689, 1, 0, 0, 0, 1689, 1699, 1, 0, 0, 0, 1690, 1691, 5, 48, 0, 0, 1691, 1692, 5, 120, 0, 0, 1692, 1694, 1, 0, 0, 0, 1693, 1695, 3, 391, 195, 0, 1694, 1693, 1, 0, 0, 0, 1695, 1696, 1, 0, 0, 0, 1696, 1694, 1, 0, 0, 0, 1696, 1697, 1, 0, 0, 0, 1697, 1699, 1, 0, 0, 0, 1698, 1677, 1, 0, 0, 0, 1698, 1690, 1, 0, 0, 0, 1699, 374, 1, 0, 0, 0, 1700, 1704, 5, 63, 0, 0, 1701, 1703, 3, 393, 196, 0, 1702, 1701, 1, 0, 0, 0, 1703, 1706, 1, 0, 0, 0, 1704, 1702, 1, 0, 0, 0, 1704, 1705, 1, 0, 0, 0, 1705, 376, 1, 0, 0, 0, 1706, 1704, 1, 0, 0, 0, 1707, 1708, 7, 6, 0, 0, 1708, 1709, 3, 371, 185, 0, 1709, 378, 1, 0, 0, 0, 1710, 1716, 5, 39, 0, 0, 1711, 1715, 8, 7, 0, 0, 1712, 1713, 5, 39, 0, 0, 1713, 1715, 5, 39, 0, 0, 1714, 1711, 1, 0, 0, 0, 1714, 1712, 1, 0, 0, 0, 1715, 1718, 1, 0, 0, 0, 1716, 1714, 1, 0, 0, 0, 1716, 1717, 1, 0, 0, 0, 1717, 1719, 1, 0, 0, 0, 1718, 1716, 1, 0, 0, 0, 1719, 1720, 5, 39, 0, 0, 1720, 380, 1, 0, 0, 0, 1721, 1722, 3, 441, 220, 0, 1722, 1723, 3, 379, 189, 0, 1723, 382, 1, 0, 0, 0, 1724, 1725, 5, 45, 0, 0, 1725, 1726, 5, 45, 0, 0, 1726, 1730, 1, 0, 0, 0, 1727, 1729, 8, 8, 0, 0, 1728, 1727, 1, 0, 0, 0, 1729, 1732, 1, 0, 0, 0, 1730, 1728, 1, 0, 0, 0, 1730, 1731, 1, 0, 0, 0, 1731, 1738, 1, 0, 0, 0, 1732, 1730, 1, 0, 0, 0, 1733, 1735, 5, 13, 0, 0, 1734, 1733, 1, 0, 0, 0, 1734, 1735, 1, 0, 0, 0, 1735, 1736, 1, 0, 0, 0, 1736, 1739, 5, 10, 0, 0, 1737, 1739, 5, 0, 0, 1, 1738, 1734, 1, 0, 0, 0, 1738, 1737, 1, 0, 0, 0, 1739, 1740, 1, 0, 0, 0, 1740, 1741, 6, 191, 0, 0, 1741, 384, 1, 0, 0, 0, 1742, 1743, 5, 47, 0, 0, 1743, 1744, 5, 42, 0, 0, 1744, 1748, 1, 0, 0, 0, 1745, 1747, 9, 0, 0, 0, 1746, 1745, 1, 0, 0, 0, 1747, 1750, 1, 0, 0, 0, 1748, 1749, 1, 0, 0, 0, 1748, 1746, 1, 0, 0, 0, 1749, 1751, 1, 0, 0, 0, 1750, 1748, 1, 0, 0, 0, 1751, 1752, 5, 42, 0, 0, 1752, 1753, 5, 47, 0, 0, 1753, 1754, 1, 0, 0, 0, 1754, 1755, 6, 192, 0, 0, 1755, 386, 1, 0, 0, 0, 1756, 1757, 7, 9, 0, 0, 1757, 1758, 1, 0, 0, 0, 1758, 1759, 6, 193, 0, 0, 1759, 388, 1, 0, 0, 0, 1760, 1761, 9, 0, 0, 0, 1761, 390, 1, 0, 0, 0, 1762, 1763, 7, 10, 0, 0, 1763, 392, 1, 0, 0, 0, 1764, 1765, 7, 11, 0, 0, 1765, 394, 1, 0, 0, 0, 1766, 1767, 7, 12, 0, 0, 1767, 396, 1, 0, 0, 0, 1768, 1769, 7, 13, 0, 0, 1769, 398, 1, 0, 0, 0, 1770, 1771, 7, 14, 0, 0, 1771, 400, 1, 0, 0, 0, 1772, 1773, 7, 15, 0, 0, 1773, 402, 1, 0, 0, 0, 1774, 1775, 7, 16, 0, 0, 1775, 404, 1, 0, 0, 0, 1776, 1777, 7, 17, 0, 0, 1777, 406, 1, 0, 0, 0, 1778, 1779, 7, 18, 0, 0, 1779, 408, 1, 0, 0, 0, 1780, 1781, 7, 19, 0, 0, 1781, 410, 1, 0, 0, 0, 1782, 1783, 7, 20, 0, 0, 1783, 412, 1, 0, 0, 0, 1784, 1785, 7, 21, 0, 0, 1785, 414, 1, 0, 0, 0, 1786, 1787, 7, 22, 0, 0, 1787, 416, 1, 0, 0, 0, 1788, 1789, 7, 23, 0, 0, 1789, 418, 1, 0, 0, 0, 1790, 1791, 7, 24, 0, 0, 1791, 420, 1, 0, 0, 0, 1792, 1793, 7, 25, 0, 0, 1793, 422, 1, 0, 0, 0, 1794, 1795, 7, 26, 0, 0, 1795, 424, 1, 0, 0, 0, 1796, 1797, 7, 27, 0, 0, 1797, 426, 1, 0, 0, 0, 1798, 1799, 7, 28, 0, 0, 1799, 428, 1, 0, 0, 0, 1800, 1801, 7, 29, 0, 0, 1801, 430, 1, 0, 0, 0, 1802, 1803, 7, 30, 0, 0, 1803, 432, 1, 0, 0, 0, 1804, 1805, 7, 31, 0, 0, 1805, 434, 1, 0, 0, 0, 1806, 1807, 7, 32, 0, 0, 1807, 436, 1, 0, 0, 0, 1808, 1809, 7, 33, 0, 0, 1809, 438, 1, 0, 0, 0, 1810, 1811, 7, 34, 0, 0, 1811, 440, 1, 0, 0, 0, 1812, 1813, 7, 35, 0, 0, 1813, 442, 1, 0, 0, 0, 1814, 1815, 7, 36, 0, 0, 1815, 444, 1, 0, 0, 0, 1816, 1817, 7, 37, 0, 0, 1817, 446, 1, 0, 0, 0, 25, 0, 1624, 1626, 1634, 1636, 1644, 1652, 1655, 1660, 1666, 1669, 1675, 1677, 1681, 1686, 1688, 1696, 1698, 1704, 1714, 1716, 1730, 1734, 1738, 1748, 1, 0, 1, 0] \ No newline at end of file +[4, 0, 197, 1829, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, 7, 83, 2, 84, 7, 84, 2, 85, 7, 85, 2, 86, 7, 86, 2, 87, 7, 87, 2, 88, 7, 88, 2, 89, 7, 89, 2, 90, 7, 90, 2, 91, 7, 91, 2, 92, 7, 92, 2, 93, 7, 93, 2, 94, 7, 94, 2, 95, 7, 95, 2, 96, 7, 96, 2, 97, 7, 97, 2, 98, 7, 98, 2, 99, 7, 99, 2, 100, 7, 100, 2, 101, 7, 101, 2, 102, 7, 102, 2, 103, 7, 103, 2, 104, 7, 104, 2, 105, 7, 105, 2, 106, 7, 106, 2, 107, 7, 107, 2, 108, 7, 108, 2, 109, 7, 109, 2, 110, 7, 110, 2, 111, 7, 111, 2, 112, 7, 112, 2, 113, 7, 113, 2, 114, 7, 114, 2, 115, 7, 115, 2, 116, 7, 116, 2, 117, 7, 117, 2, 118, 7, 118, 2, 119, 7, 119, 2, 120, 7, 120, 2, 121, 7, 121, 2, 122, 7, 122, 2, 123, 7, 123, 2, 124, 7, 124, 2, 125, 7, 125, 2, 126, 7, 126, 2, 127, 7, 127, 2, 128, 7, 128, 2, 129, 7, 129, 2, 130, 7, 130, 2, 131, 7, 131, 2, 132, 7, 132, 2, 133, 7, 133, 2, 134, 7, 134, 2, 135, 7, 135, 2, 136, 7, 136, 2, 137, 7, 137, 2, 138, 7, 138, 2, 139, 7, 139, 2, 140, 7, 140, 2, 141, 7, 141, 2, 142, 7, 142, 2, 143, 7, 143, 2, 144, 7, 144, 2, 145, 7, 145, 2, 146, 7, 146, 2, 147, 7, 147, 2, 148, 7, 148, 2, 149, 7, 149, 2, 150, 7, 150, 2, 151, 7, 151, 2, 152, 7, 152, 2, 153, 7, 153, 2, 154, 7, 154, 2, 155, 7, 155, 2, 156, 7, 156, 2, 157, 7, 157, 2, 158, 7, 158, 2, 159, 7, 159, 2, 160, 7, 160, 2, 161, 7, 161, 2, 162, 7, 162, 2, 163, 7, 163, 2, 164, 7, 164, 2, 165, 7, 165, 2, 166, 7, 166, 2, 167, 7, 167, 2, 168, 7, 168, 2, 169, 7, 169, 2, 170, 7, 170, 2, 171, 7, 171, 2, 172, 7, 172, 2, 173, 7, 173, 2, 174, 7, 174, 2, 175, 7, 175, 2, 176, 7, 176, 2, 177, 7, 177, 2, 178, 7, 178, 2, 179, 7, 179, 2, 180, 7, 180, 2, 181, 7, 181, 2, 182, 7, 182, 2, 183, 7, 183, 2, 184, 7, 184, 2, 185, 7, 185, 2, 186, 7, 186, 2, 187, 7, 187, 2, 188, 7, 188, 2, 189, 7, 189, 2, 190, 7, 190, 2, 191, 7, 191, 2, 192, 7, 192, 2, 193, 7, 193, 2, 194, 7, 194, 2, 195, 7, 195, 2, 196, 7, 196, 2, 197, 7, 197, 2, 198, 7, 198, 2, 199, 7, 199, 2, 200, 7, 200, 2, 201, 7, 201, 2, 202, 7, 202, 2, 203, 7, 203, 2, 204, 7, 204, 2, 205, 7, 205, 2, 206, 7, 206, 2, 207, 7, 207, 2, 208, 7, 208, 2, 209, 7, 209, 2, 210, 7, 210, 2, 211, 7, 211, 2, 212, 7, 212, 2, 213, 7, 213, 2, 214, 7, 214, 2, 215, 7, 215, 2, 216, 7, 216, 2, 217, 7, 217, 2, 218, 7, 218, 2, 219, 7, 219, 2, 220, 7, 220, 2, 221, 7, 221, 2, 222, 7, 222, 2, 223, 7, 223, 2, 224, 7, 224, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, 28, 1, 28, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 30, 1, 30, 1, 30, 1, 30, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 67, 1, 67, 1, 67, 1, 67, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 74, 1, 74, 1, 74, 1, 74, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 79, 1, 79, 1, 79, 1, 79, 1, 79, 1, 79, 1, 80, 1, 80, 1, 80, 1, 80, 1, 80, 1, 80, 1, 80, 1, 81, 1, 81, 1, 81, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 84, 1, 84, 1, 84, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 92, 1, 92, 1, 92, 1, 92, 1, 92, 1, 93, 1, 93, 1, 93, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 96, 1, 96, 1, 96, 1, 96, 1, 97, 1, 97, 1, 97, 1, 97, 1, 97, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 102, 1, 102, 1, 102, 1, 103, 1, 103, 1, 103, 1, 103, 1, 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 106, 1, 106, 1, 106, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 108, 1, 108, 1, 108, 1, 109, 1, 109, 1, 109, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 113, 1, 113, 1, 113, 1, 113, 1, 113, 1, 113, 1, 113, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 117, 1, 117, 1, 117, 1, 117, 1, 117, 1, 117, 1, 117, 1, 117, 1, 117, 1, 117, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 121, 1, 121, 1, 121, 1, 121, 1, 121, 1, 121, 1, 121, 1, 121, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 128, 1, 128, 1, 128, 1, 128, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 132, 1, 132, 1, 132, 1, 132, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 136, 1, 136, 1, 136, 1, 136, 1, 136, 1, 136, 1, 136, 1, 136, 1, 136, 1, 136, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 138, 1, 138, 1, 138, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 140, 1, 140, 1, 140, 1, 140, 1, 140, 1, 140, 1, 140, 1, 140, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 1, 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 144, 1, 144, 1, 144, 1, 144, 1, 144, 1, 144, 1, 145, 1, 145, 1, 145, 1, 145, 1, 145, 1, 145, 1, 145, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 147, 1, 147, 1, 147, 1, 147, 1, 147, 1, 148, 1, 148, 1, 148, 1, 148, 1, 148, 1, 148, 1, 148, 1, 148, 1, 149, 1, 149, 1, 149, 1, 149, 1, 149, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 152, 1, 152, 1, 152, 1, 152, 1, 152, 1, 152, 1, 152, 1, 152, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 156, 1, 156, 1, 156, 1, 156, 1, 156, 1, 156, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 161, 1, 161, 1, 161, 1, 161, 1, 161, 1, 161, 1, 161, 1, 161, 1, 161, 1, 161, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 163, 1, 163, 1, 163, 1, 163, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 1, 174, 1, 174, 1, 174, 1, 174, 1, 174, 1, 175, 1, 175, 1, 175, 1, 175, 1, 175, 1, 175, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 177, 1, 177, 1, 177, 1, 177, 1, 177, 1, 177, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 181, 1, 181, 1, 181, 1, 181, 1, 181, 1, 181, 1, 181, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 183, 1, 183, 1, 183, 1, 183, 1, 183, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 185, 1, 185, 1, 185, 1, 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, 187, 1, 187, 1, 187, 1, 187, 5, 187, 1636, 8, 187, 10, 187, 12, 187, 1639, 9, 187, 1, 187, 1, 187, 1, 187, 1, 187, 1, 187, 5, 187, 1646, 8, 187, 10, 187, 12, 187, 1649, 9, 187, 1, 187, 1, 187, 1, 187, 5, 187, 1654, 8, 187, 10, 187, 12, 187, 1657, 9, 187, 1, 187, 1, 187, 1, 187, 5, 187, 1662, 8, 187, 10, 187, 12, 187, 1665, 9, 187, 3, 187, 1667, 8, 187, 1, 188, 4, 188, 1670, 8, 188, 11, 188, 12, 188, 1671, 1, 188, 1, 188, 5, 188, 1676, 8, 188, 10, 188, 12, 188, 1679, 9, 188, 3, 188, 1681, 8, 188, 1, 188, 1, 188, 4, 188, 1685, 8, 188, 11, 188, 12, 188, 1686, 3, 188, 1689, 8, 188, 1, 188, 1, 188, 3, 188, 1693, 8, 188, 1, 188, 4, 188, 1696, 8, 188, 11, 188, 12, 188, 1697, 3, 188, 1700, 8, 188, 1, 188, 1, 188, 1, 188, 1, 188, 4, 188, 1706, 8, 188, 11, 188, 12, 188, 1707, 3, 188, 1710, 8, 188, 1, 189, 1, 189, 5, 189, 1714, 8, 189, 10, 189, 12, 189, 1717, 9, 189, 1, 190, 1, 190, 1, 190, 1, 191, 1, 191, 1, 191, 1, 191, 5, 191, 1726, 8, 191, 10, 191, 12, 191, 1729, 9, 191, 1, 191, 1, 191, 1, 192, 1, 192, 1, 192, 1, 193, 1, 193, 1, 193, 1, 193, 5, 193, 1740, 8, 193, 10, 193, 12, 193, 1743, 9, 193, 1, 193, 3, 193, 1746, 8, 193, 1, 193, 1, 193, 3, 193, 1750, 8, 193, 1, 193, 1, 193, 1, 194, 1, 194, 1, 194, 1, 194, 5, 194, 1758, 8, 194, 10, 194, 12, 194, 1761, 9, 194, 1, 194, 1, 194, 1, 194, 1, 194, 1, 194, 1, 195, 1, 195, 1, 195, 1, 195, 1, 196, 1, 196, 1, 197, 1, 197, 1, 198, 1, 198, 1, 199, 1, 199, 1, 200, 1, 200, 1, 201, 1, 201, 1, 202, 1, 202, 1, 203, 1, 203, 1, 204, 1, 204, 1, 205, 1, 205, 1, 206, 1, 206, 1, 207, 1, 207, 1, 208, 1, 208, 1, 209, 1, 209, 1, 210, 1, 210, 1, 211, 1, 211, 1, 212, 1, 212, 1, 213, 1, 213, 1, 214, 1, 214, 1, 215, 1, 215, 1, 216, 1, 216, 1, 217, 1, 217, 1, 218, 1, 218, 1, 219, 1, 219, 1, 220, 1, 220, 1, 221, 1, 221, 1, 222, 1, 222, 1, 223, 1, 223, 1, 224, 1, 224, 1, 1759, 0, 225, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 20, 41, 21, 43, 22, 45, 23, 47, 24, 49, 25, 51, 26, 53, 27, 55, 28, 57, 29, 59, 30, 61, 31, 63, 32, 65, 33, 67, 34, 69, 35, 71, 36, 73, 37, 75, 38, 77, 39, 79, 40, 81, 41, 83, 42, 85, 43, 87, 44, 89, 45, 91, 46, 93, 47, 95, 48, 97, 49, 99, 50, 101, 51, 103, 52, 105, 53, 107, 54, 109, 55, 111, 56, 113, 57, 115, 58, 117, 59, 119, 60, 121, 61, 123, 62, 125, 63, 127, 64, 129, 65, 131, 66, 133, 67, 135, 68, 137, 69, 139, 70, 141, 71, 143, 72, 145, 73, 147, 74, 149, 75, 151, 76, 153, 77, 155, 78, 157, 79, 159, 80, 161, 81, 163, 82, 165, 83, 167, 84, 169, 85, 171, 86, 173, 87, 175, 88, 177, 89, 179, 90, 181, 91, 183, 92, 185, 93, 187, 94, 189, 95, 191, 96, 193, 97, 195, 98, 197, 99, 199, 100, 201, 101, 203, 102, 205, 103, 207, 104, 209, 105, 211, 106, 213, 107, 215, 108, 217, 109, 219, 110, 221, 111, 223, 112, 225, 113, 227, 114, 229, 115, 231, 116, 233, 117, 235, 118, 237, 119, 239, 120, 241, 121, 243, 122, 245, 123, 247, 124, 249, 125, 251, 126, 253, 127, 255, 128, 257, 129, 259, 130, 261, 131, 263, 132, 265, 133, 267, 134, 269, 135, 271, 136, 273, 137, 275, 138, 277, 139, 279, 140, 281, 141, 283, 142, 285, 143, 287, 144, 289, 145, 291, 146, 293, 147, 295, 148, 297, 149, 299, 150, 301, 151, 303, 152, 305, 153, 307, 154, 309, 155, 311, 156, 313, 157, 315, 158, 317, 159, 319, 160, 321, 161, 323, 162, 325, 163, 327, 164, 329, 165, 331, 166, 333, 167, 335, 168, 337, 169, 339, 170, 341, 171, 343, 172, 345, 173, 347, 174, 349, 175, 351, 176, 353, 177, 355, 178, 357, 179, 359, 180, 361, 181, 363, 182, 365, 183, 367, 184, 369, 185, 371, 186, 373, 187, 375, 188, 377, 189, 379, 190, 381, 191, 383, 192, 385, 193, 387, 194, 389, 195, 391, 196, 393, 197, 395, 0, 397, 0, 399, 0, 401, 0, 403, 0, 405, 0, 407, 0, 409, 0, 411, 0, 413, 0, 415, 0, 417, 0, 419, 0, 421, 0, 423, 0, 425, 0, 427, 0, 429, 0, 431, 0, 433, 0, 435, 0, 437, 0, 439, 0, 441, 0, 443, 0, 445, 0, 447, 0, 449, 0, 1, 0, 38, 1, 0, 34, 34, 1, 0, 96, 96, 1, 0, 93, 93, 3, 0, 65, 90, 95, 95, 97, 122, 4, 0, 48, 57, 65, 90, 95, 95, 97, 122, 2, 0, 43, 43, 45, 45, 3, 0, 36, 36, 58, 58, 64, 64, 1, 0, 39, 39, 2, 0, 10, 10, 13, 13, 3, 0, 9, 11, 13, 13, 32, 32, 3, 0, 48, 57, 65, 70, 97, 102, 1, 0, 48, 57, 2, 0, 65, 65, 97, 97, 2, 0, 66, 66, 98, 98, 2, 0, 67, 67, 99, 99, 2, 0, 68, 68, 100, 100, 2, 0, 69, 69, 101, 101, 2, 0, 70, 70, 102, 102, 2, 0, 71, 71, 103, 103, 2, 0, 72, 72, 104, 104, 2, 0, 73, 73, 105, 105, 2, 0, 74, 74, 106, 106, 2, 0, 75, 75, 107, 107, 2, 0, 76, 76, 108, 108, 2, 0, 77, 77, 109, 109, 2, 0, 78, 78, 110, 110, 2, 0, 79, 79, 111, 111, 2, 0, 80, 80, 112, 112, 2, 0, 81, 81, 113, 113, 2, 0, 82, 82, 114, 114, 2, 0, 83, 83, 115, 115, 2, 0, 84, 84, 116, 116, 2, 0, 85, 85, 117, 117, 2, 0, 86, 86, 118, 118, 2, 0, 87, 87, 119, 119, 2, 0, 88, 88, 120, 120, 2, 0, 89, 89, 121, 121, 2, 0, 90, 90, 122, 122, 1826, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 0, 61, 1, 0, 0, 0, 0, 63, 1, 0, 0, 0, 0, 65, 1, 0, 0, 0, 0, 67, 1, 0, 0, 0, 0, 69, 1, 0, 0, 0, 0, 71, 1, 0, 0, 0, 0, 73, 1, 0, 0, 0, 0, 75, 1, 0, 0, 0, 0, 77, 1, 0, 0, 0, 0, 79, 1, 0, 0, 0, 0, 81, 1, 0, 0, 0, 0, 83, 1, 0, 0, 0, 0, 85, 1, 0, 0, 0, 0, 87, 1, 0, 0, 0, 0, 89, 1, 0, 0, 0, 0, 91, 1, 0, 0, 0, 0, 93, 1, 0, 0, 0, 0, 95, 1, 0, 0, 0, 0, 97, 1, 0, 0, 0, 0, 99, 1, 0, 0, 0, 0, 101, 1, 0, 0, 0, 0, 103, 1, 0, 0, 0, 0, 105, 1, 0, 0, 0, 0, 107, 1, 0, 0, 0, 0, 109, 1, 0, 0, 0, 0, 111, 1, 0, 0, 0, 0, 113, 1, 0, 0, 0, 0, 115, 1, 0, 0, 0, 0, 117, 1, 0, 0, 0, 0, 119, 1, 0, 0, 0, 0, 121, 1, 0, 0, 0, 0, 123, 1, 0, 0, 0, 0, 125, 1, 0, 0, 0, 0, 127, 1, 0, 0, 0, 0, 129, 1, 0, 0, 0, 0, 131, 1, 0, 0, 0, 0, 133, 1, 0, 0, 0, 0, 135, 1, 0, 0, 0, 0, 137, 1, 0, 0, 0, 0, 139, 1, 0, 0, 0, 0, 141, 1, 0, 0, 0, 0, 143, 1, 0, 0, 0, 0, 145, 1, 0, 0, 0, 0, 147, 1, 0, 0, 0, 0, 149, 1, 0, 0, 0, 0, 151, 1, 0, 0, 0, 0, 153, 1, 0, 0, 0, 0, 155, 1, 0, 0, 0, 0, 157, 1, 0, 0, 0, 0, 159, 1, 0, 0, 0, 0, 161, 1, 0, 0, 0, 0, 163, 1, 0, 0, 0, 0, 165, 1, 0, 0, 0, 0, 167, 1, 0, 0, 0, 0, 169, 1, 0, 0, 0, 0, 171, 1, 0, 0, 0, 0, 173, 1, 0, 0, 0, 0, 175, 1, 0, 0, 0, 0, 177, 1, 0, 0, 0, 0, 179, 1, 0, 0, 0, 0, 181, 1, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 185, 1, 0, 0, 0, 0, 187, 1, 0, 0, 0, 0, 189, 1, 0, 0, 0, 0, 191, 1, 0, 0, 0, 0, 193, 1, 0, 0, 0, 0, 195, 1, 0, 0, 0, 0, 197, 1, 0, 0, 0, 0, 199, 1, 0, 0, 0, 0, 201, 1, 0, 0, 0, 0, 203, 1, 0, 0, 0, 0, 205, 1, 0, 0, 0, 0, 207, 1, 0, 0, 0, 0, 209, 1, 0, 0, 0, 0, 211, 1, 0, 0, 0, 0, 213, 1, 0, 0, 0, 0, 215, 1, 0, 0, 0, 0, 217, 1, 0, 0, 0, 0, 219, 1, 0, 0, 0, 0, 221, 1, 0, 0, 0, 0, 223, 1, 0, 0, 0, 0, 225, 1, 0, 0, 0, 0, 227, 1, 0, 0, 0, 0, 229, 1, 0, 0, 0, 0, 231, 1, 0, 0, 0, 0, 233, 1, 0, 0, 0, 0, 235, 1, 0, 0, 0, 0, 237, 1, 0, 0, 0, 0, 239, 1, 0, 0, 0, 0, 241, 1, 0, 0, 0, 0, 243, 1, 0, 0, 0, 0, 245, 1, 0, 0, 0, 0, 247, 1, 0, 0, 0, 0, 249, 1, 0, 0, 0, 0, 251, 1, 0, 0, 0, 0, 253, 1, 0, 0, 0, 0, 255, 1, 0, 0, 0, 0, 257, 1, 0, 0, 0, 0, 259, 1, 0, 0, 0, 0, 261, 1, 0, 0, 0, 0, 263, 1, 0, 0, 0, 0, 265, 1, 0, 0, 0, 0, 267, 1, 0, 0, 0, 0, 269, 1, 0, 0, 0, 0, 271, 1, 0, 0, 0, 0, 273, 1, 0, 0, 0, 0, 275, 1, 0, 0, 0, 0, 277, 1, 0, 0, 0, 0, 279, 1, 0, 0, 0, 0, 281, 1, 0, 0, 0, 0, 283, 1, 0, 0, 0, 0, 285, 1, 0, 0, 0, 0, 287, 1, 0, 0, 0, 0, 289, 1, 0, 0, 0, 0, 291, 1, 0, 0, 0, 0, 293, 1, 0, 0, 0, 0, 295, 1, 0, 0, 0, 0, 297, 1, 0, 0, 0, 0, 299, 1, 0, 0, 0, 0, 301, 1, 0, 0, 0, 0, 303, 1, 0, 0, 0, 0, 305, 1, 0, 0, 0, 0, 307, 1, 0, 0, 0, 0, 309, 1, 0, 0, 0, 0, 311, 1, 0, 0, 0, 0, 313, 1, 0, 0, 0, 0, 315, 1, 0, 0, 0, 0, 317, 1, 0, 0, 0, 0, 319, 1, 0, 0, 0, 0, 321, 1, 0, 0, 0, 0, 323, 1, 0, 0, 0, 0, 325, 1, 0, 0, 0, 0, 327, 1, 0, 0, 0, 0, 329, 1, 0, 0, 0, 0, 331, 1, 0, 0, 0, 0, 333, 1, 0, 0, 0, 0, 335, 1, 0, 0, 0, 0, 337, 1, 0, 0, 0, 0, 339, 1, 0, 0, 0, 0, 341, 1, 0, 0, 0, 0, 343, 1, 0, 0, 0, 0, 345, 1, 0, 0, 0, 0, 347, 1, 0, 0, 0, 0, 349, 1, 0, 0, 0, 0, 351, 1, 0, 0, 0, 0, 353, 1, 0, 0, 0, 0, 355, 1, 0, 0, 0, 0, 357, 1, 0, 0, 0, 0, 359, 1, 0, 0, 0, 0, 361, 1, 0, 0, 0, 0, 363, 1, 0, 0, 0, 0, 365, 1, 0, 0, 0, 0, 367, 1, 0, 0, 0, 0, 369, 1, 0, 0, 0, 0, 371, 1, 0, 0, 0, 0, 373, 1, 0, 0, 0, 0, 375, 1, 0, 0, 0, 0, 377, 1, 0, 0, 0, 0, 379, 1, 0, 0, 0, 0, 381, 1, 0, 0, 0, 0, 383, 1, 0, 0, 0, 0, 385, 1, 0, 0, 0, 0, 387, 1, 0, 0, 0, 0, 389, 1, 0, 0, 0, 0, 391, 1, 0, 0, 0, 0, 393, 1, 0, 0, 0, 1, 451, 1, 0, 0, 0, 3, 453, 1, 0, 0, 0, 5, 455, 1, 0, 0, 0, 7, 457, 1, 0, 0, 0, 9, 459, 1, 0, 0, 0, 11, 461, 1, 0, 0, 0, 13, 463, 1, 0, 0, 0, 15, 465, 1, 0, 0, 0, 17, 467, 1, 0, 0, 0, 19, 471, 1, 0, 0, 0, 21, 474, 1, 0, 0, 0, 23, 476, 1, 0, 0, 0, 25, 478, 1, 0, 0, 0, 27, 481, 1, 0, 0, 0, 29, 483, 1, 0, 0, 0, 31, 485, 1, 0, 0, 0, 33, 488, 1, 0, 0, 0, 35, 491, 1, 0, 0, 0, 37, 493, 1, 0, 0, 0, 39, 495, 1, 0, 0, 0, 41, 497, 1, 0, 0, 0, 43, 500, 1, 0, 0, 0, 45, 502, 1, 0, 0, 0, 47, 505, 1, 0, 0, 0, 49, 508, 1, 0, 0, 0, 51, 511, 1, 0, 0, 0, 53, 514, 1, 0, 0, 0, 55, 520, 1, 0, 0, 0, 57, 527, 1, 0, 0, 0, 59, 531, 1, 0, 0, 0, 61, 537, 1, 0, 0, 0, 63, 541, 1, 0, 0, 0, 65, 547, 1, 0, 0, 0, 67, 555, 1, 0, 0, 0, 69, 559, 1, 0, 0, 0, 71, 562, 1, 0, 0, 0, 73, 566, 1, 0, 0, 0, 75, 573, 1, 0, 0, 0, 77, 587, 1, 0, 0, 0, 79, 594, 1, 0, 0, 0, 81, 600, 1, 0, 0, 0, 83, 608, 1, 0, 0, 0, 85, 611, 1, 0, 0, 0, 87, 619, 1, 0, 0, 0, 89, 624, 1, 0, 0, 0, 91, 629, 1, 0, 0, 0, 93, 635, 1, 0, 0, 0, 95, 643, 1, 0, 0, 0, 97, 650, 1, 0, 0, 0, 99, 657, 1, 0, 0, 0, 101, 666, 1, 0, 0, 0, 103, 677, 1, 0, 0, 0, 105, 684, 1, 0, 0, 0, 107, 690, 1, 0, 0, 0, 109, 703, 1, 0, 0, 0, 111, 716, 1, 0, 0, 0, 113, 734, 1, 0, 0, 0, 115, 743, 1, 0, 0, 0, 117, 751, 1, 0, 0, 0, 119, 762, 1, 0, 0, 0, 121, 771, 1, 0, 0, 0, 123, 778, 1, 0, 0, 0, 125, 783, 1, 0, 0, 0, 127, 790, 1, 0, 0, 0, 129, 799, 1, 0, 0, 0, 131, 804, 1, 0, 0, 0, 133, 809, 1, 0, 0, 0, 135, 814, 1, 0, 0, 0, 137, 818, 1, 0, 0, 0, 139, 825, 1, 0, 0, 0, 141, 832, 1, 0, 0, 0, 143, 842, 1, 0, 0, 0, 145, 849, 1, 0, 0, 0, 147, 857, 1, 0, 0, 0, 149, 862, 1, 0, 0, 0, 151, 866, 1, 0, 0, 0, 153, 874, 1, 0, 0, 0, 155, 879, 1, 0, 0, 0, 157, 884, 1, 0, 0, 0, 159, 889, 1, 0, 0, 0, 161, 895, 1, 0, 0, 0, 163, 902, 1, 0, 0, 0, 165, 905, 1, 0, 0, 0, 167, 912, 1, 0, 0, 0, 169, 922, 1, 0, 0, 0, 171, 925, 1, 0, 0, 0, 173, 931, 1, 0, 0, 0, 175, 939, 1, 0, 0, 0, 177, 949, 1, 0, 0, 0, 179, 955, 1, 0, 0, 0, 181, 962, 1, 0, 0, 0, 183, 970, 1, 0, 0, 0, 185, 980, 1, 0, 0, 0, 187, 985, 1, 0, 0, 0, 189, 988, 1, 0, 0, 0, 191, 995, 1, 0, 0, 0, 193, 1000, 1, 0, 0, 0, 195, 1004, 1, 0, 0, 0, 197, 1009, 1, 0, 0, 0, 199, 1014, 1, 0, 0, 0, 201, 1020, 1, 0, 0, 0, 203, 1026, 1, 0, 0, 0, 205, 1034, 1, 0, 0, 0, 207, 1037, 1, 0, 0, 0, 209, 1041, 1, 0, 0, 0, 211, 1049, 1, 0, 0, 0, 213, 1054, 1, 0, 0, 0, 215, 1057, 1, 0, 0, 0, 217, 1064, 1, 0, 0, 0, 219, 1067, 1, 0, 0, 0, 221, 1070, 1, 0, 0, 0, 223, 1076, 1, 0, 0, 0, 225, 1082, 1, 0, 0, 0, 227, 1087, 1, 0, 0, 0, 229, 1094, 1, 0, 0, 0, 231, 1102, 1, 0, 0, 0, 233, 1108, 1, 0, 0, 0, 235, 1114, 1, 0, 0, 0, 237, 1124, 1, 0, 0, 0, 239, 1135, 1, 0, 0, 0, 241, 1142, 1, 0, 0, 0, 243, 1150, 1, 0, 0, 0, 245, 1158, 1, 0, 0, 0, 247, 1165, 1, 0, 0, 0, 249, 1173, 1, 0, 0, 0, 251, 1182, 1, 0, 0, 0, 253, 1192, 1, 0, 0, 0, 255, 1198, 1, 0, 0, 0, 257, 1207, 1, 0, 0, 0, 259, 1211, 1, 0, 0, 0, 261, 1216, 1, 0, 0, 0, 263, 1226, 1, 0, 0, 0, 265, 1233, 1, 0, 0, 0, 267, 1237, 1, 0, 0, 0, 269, 1244, 1, 0, 0, 0, 271, 1250, 1, 0, 0, 0, 273, 1255, 1, 0, 0, 0, 275, 1265, 1, 0, 0, 0, 277, 1270, 1, 0, 0, 0, 279, 1273, 1, 0, 0, 0, 281, 1285, 1, 0, 0, 0, 283, 1293, 1, 0, 0, 0, 285, 1299, 1, 0, 0, 0, 287, 1306, 1, 0, 0, 0, 289, 1313, 1, 0, 0, 0, 291, 1319, 1, 0, 0, 0, 293, 1326, 1, 0, 0, 0, 295, 1333, 1, 0, 0, 0, 297, 1338, 1, 0, 0, 0, 299, 1346, 1, 0, 0, 0, 301, 1351, 1, 0, 0, 0, 303, 1357, 1, 0, 0, 0, 305, 1362, 1, 0, 0, 0, 307, 1370, 1, 0, 0, 0, 309, 1382, 1, 0, 0, 0, 311, 1387, 1, 0, 0, 0, 313, 1397, 1, 0, 0, 0, 315, 1403, 1, 0, 0, 0, 317, 1413, 1, 0, 0, 0, 319, 1423, 1, 0, 0, 0, 321, 1431, 1, 0, 0, 0, 323, 1441, 1, 0, 0, 0, 325, 1451, 1, 0, 0, 0, 327, 1462, 1, 0, 0, 0, 329, 1466, 1, 0, 0, 0, 331, 1477, 1, 0, 0, 0, 333, 1482, 1, 0, 0, 0, 335, 1492, 1, 0, 0, 0, 337, 1498, 1, 0, 0, 0, 339, 1511, 1, 0, 0, 0, 341, 1516, 1, 0, 0, 0, 343, 1527, 1, 0, 0, 0, 345, 1537, 1, 0, 0, 0, 347, 1544, 1, 0, 0, 0, 349, 1551, 1, 0, 0, 0, 351, 1556, 1, 0, 0, 0, 353, 1562, 1, 0, 0, 0, 355, 1569, 1, 0, 0, 0, 357, 1575, 1, 0, 0, 0, 359, 1581, 1, 0, 0, 0, 361, 1586, 1, 0, 0, 0, 363, 1593, 1, 0, 0, 0, 365, 1600, 1, 0, 0, 0, 367, 1608, 1, 0, 0, 0, 369, 1613, 1, 0, 0, 0, 371, 1620, 1, 0, 0, 0, 373, 1623, 1, 0, 0, 0, 375, 1666, 1, 0, 0, 0, 377, 1709, 1, 0, 0, 0, 379, 1711, 1, 0, 0, 0, 381, 1718, 1, 0, 0, 0, 383, 1721, 1, 0, 0, 0, 385, 1732, 1, 0, 0, 0, 387, 1735, 1, 0, 0, 0, 389, 1753, 1, 0, 0, 0, 391, 1767, 1, 0, 0, 0, 393, 1771, 1, 0, 0, 0, 395, 1773, 1, 0, 0, 0, 397, 1775, 1, 0, 0, 0, 399, 1777, 1, 0, 0, 0, 401, 1779, 1, 0, 0, 0, 403, 1781, 1, 0, 0, 0, 405, 1783, 1, 0, 0, 0, 407, 1785, 1, 0, 0, 0, 409, 1787, 1, 0, 0, 0, 411, 1789, 1, 0, 0, 0, 413, 1791, 1, 0, 0, 0, 415, 1793, 1, 0, 0, 0, 417, 1795, 1, 0, 0, 0, 419, 1797, 1, 0, 0, 0, 421, 1799, 1, 0, 0, 0, 423, 1801, 1, 0, 0, 0, 425, 1803, 1, 0, 0, 0, 427, 1805, 1, 0, 0, 0, 429, 1807, 1, 0, 0, 0, 431, 1809, 1, 0, 0, 0, 433, 1811, 1, 0, 0, 0, 435, 1813, 1, 0, 0, 0, 437, 1815, 1, 0, 0, 0, 439, 1817, 1, 0, 0, 0, 441, 1819, 1, 0, 0, 0, 443, 1821, 1, 0, 0, 0, 445, 1823, 1, 0, 0, 0, 447, 1825, 1, 0, 0, 0, 449, 1827, 1, 0, 0, 0, 451, 452, 5, 59, 0, 0, 452, 2, 1, 0, 0, 0, 453, 454, 5, 46, 0, 0, 454, 4, 1, 0, 0, 0, 455, 456, 5, 40, 0, 0, 456, 6, 1, 0, 0, 0, 457, 458, 5, 41, 0, 0, 458, 8, 1, 0, 0, 0, 459, 460, 5, 44, 0, 0, 460, 10, 1, 0, 0, 0, 461, 462, 5, 61, 0, 0, 462, 12, 1, 0, 0, 0, 463, 464, 5, 42, 0, 0, 464, 14, 1, 0, 0, 0, 465, 466, 5, 43, 0, 0, 466, 16, 1, 0, 0, 0, 467, 468, 5, 45, 0, 0, 468, 469, 5, 62, 0, 0, 469, 470, 5, 62, 0, 0, 470, 18, 1, 0, 0, 0, 471, 472, 5, 45, 0, 0, 472, 473, 5, 62, 0, 0, 473, 20, 1, 0, 0, 0, 474, 475, 5, 45, 0, 0, 475, 22, 1, 0, 0, 0, 476, 477, 5, 126, 0, 0, 477, 24, 1, 0, 0, 0, 478, 479, 5, 124, 0, 0, 479, 480, 5, 124, 0, 0, 480, 26, 1, 0, 0, 0, 481, 482, 5, 47, 0, 0, 482, 28, 1, 0, 0, 0, 483, 484, 5, 37, 0, 0, 484, 30, 1, 0, 0, 0, 485, 486, 5, 60, 0, 0, 486, 487, 5, 60, 0, 0, 487, 32, 1, 0, 0, 0, 488, 489, 5, 62, 0, 0, 489, 490, 5, 62, 0, 0, 490, 34, 1, 0, 0, 0, 491, 492, 5, 38, 0, 0, 492, 36, 1, 0, 0, 0, 493, 494, 5, 124, 0, 0, 494, 38, 1, 0, 0, 0, 495, 496, 5, 60, 0, 0, 496, 40, 1, 0, 0, 0, 497, 498, 5, 60, 0, 0, 498, 499, 5, 61, 0, 0, 499, 42, 1, 0, 0, 0, 500, 501, 5, 62, 0, 0, 501, 44, 1, 0, 0, 0, 502, 503, 5, 62, 0, 0, 503, 504, 5, 61, 0, 0, 504, 46, 1, 0, 0, 0, 505, 506, 5, 61, 0, 0, 506, 507, 5, 61, 0, 0, 507, 48, 1, 0, 0, 0, 508, 509, 5, 33, 0, 0, 509, 510, 5, 61, 0, 0, 510, 50, 1, 0, 0, 0, 511, 512, 5, 60, 0, 0, 512, 513, 5, 62, 0, 0, 513, 52, 1, 0, 0, 0, 514, 515, 3, 399, 199, 0, 515, 516, 3, 401, 200, 0, 516, 517, 3, 427, 213, 0, 517, 518, 3, 433, 216, 0, 518, 519, 3, 437, 218, 0, 519, 54, 1, 0, 0, 0, 520, 521, 3, 399, 199, 0, 521, 522, 3, 403, 201, 0, 522, 523, 3, 437, 218, 0, 523, 524, 3, 415, 207, 0, 524, 525, 3, 427, 213, 0, 525, 526, 3, 425, 212, 0, 526, 56, 1, 0, 0, 0, 527, 528, 3, 399, 199, 0, 528, 529, 3, 405, 202, 0, 529, 530, 3, 405, 202, 0, 530, 58, 1, 0, 0, 0, 531, 532, 3, 399, 199, 0, 532, 533, 3, 409, 204, 0, 533, 534, 3, 437, 218, 0, 534, 535, 3, 407, 203, 0, 535, 536, 3, 433, 216, 0, 536, 60, 1, 0, 0, 0, 537, 538, 3, 399, 199, 0, 538, 539, 3, 421, 210, 0, 539, 540, 3, 421, 210, 0, 540, 62, 1, 0, 0, 0, 541, 542, 3, 399, 199, 0, 542, 543, 3, 421, 210, 0, 543, 544, 3, 437, 218, 0, 544, 545, 3, 407, 203, 0, 545, 546, 3, 433, 216, 0, 546, 64, 1, 0, 0, 0, 547, 548, 3, 399, 199, 0, 548, 549, 3, 425, 212, 0, 549, 550, 3, 399, 199, 0, 550, 551, 3, 421, 210, 0, 551, 552, 3, 447, 223, 0, 552, 553, 3, 449, 224, 0, 553, 554, 3, 407, 203, 0, 554, 66, 1, 0, 0, 0, 555, 556, 3, 399, 199, 0, 556, 557, 3, 425, 212, 0, 557, 558, 3, 405, 202, 0, 558, 68, 1, 0, 0, 0, 559, 560, 3, 399, 199, 0, 560, 561, 3, 435, 217, 0, 561, 70, 1, 0, 0, 0, 562, 563, 3, 399, 199, 0, 563, 564, 3, 435, 217, 0, 564, 565, 3, 403, 201, 0, 565, 72, 1, 0, 0, 0, 566, 567, 3, 399, 199, 0, 567, 568, 3, 437, 218, 0, 568, 569, 3, 437, 218, 0, 569, 570, 3, 399, 199, 0, 570, 571, 3, 403, 201, 0, 571, 572, 3, 413, 206, 0, 572, 74, 1, 0, 0, 0, 573, 574, 3, 399, 199, 0, 574, 575, 3, 439, 219, 0, 575, 576, 3, 437, 218, 0, 576, 577, 3, 427, 213, 0, 577, 578, 3, 415, 207, 0, 578, 579, 3, 425, 212, 0, 579, 580, 3, 403, 201, 0, 580, 581, 3, 433, 216, 0, 581, 582, 3, 407, 203, 0, 582, 583, 3, 423, 211, 0, 583, 584, 3, 407, 203, 0, 584, 585, 3, 425, 212, 0, 585, 586, 3, 437, 218, 0, 586, 76, 1, 0, 0, 0, 587, 588, 3, 401, 200, 0, 588, 589, 3, 407, 203, 0, 589, 590, 3, 409, 204, 0, 590, 591, 3, 427, 213, 0, 591, 592, 3, 433, 216, 0, 592, 593, 3, 407, 203, 0, 593, 78, 1, 0, 0, 0, 594, 595, 3, 401, 200, 0, 595, 596, 3, 407, 203, 0, 596, 597, 3, 411, 205, 0, 597, 598, 3, 415, 207, 0, 598, 599, 3, 425, 212, 0, 599, 80, 1, 0, 0, 0, 600, 601, 3, 401, 200, 0, 601, 602, 3, 407, 203, 0, 602, 603, 3, 437, 218, 0, 603, 604, 3, 443, 221, 0, 604, 605, 3, 407, 203, 0, 605, 606, 3, 407, 203, 0, 606, 607, 3, 425, 212, 0, 607, 82, 1, 0, 0, 0, 608, 609, 3, 401, 200, 0, 609, 610, 3, 447, 223, 0, 610, 84, 1, 0, 0, 0, 611, 612, 3, 403, 201, 0, 612, 613, 3, 399, 199, 0, 613, 614, 3, 435, 217, 0, 614, 615, 3, 403, 201, 0, 615, 616, 3, 399, 199, 0, 616, 617, 3, 405, 202, 0, 617, 618, 3, 407, 203, 0, 618, 86, 1, 0, 0, 0, 619, 620, 3, 403, 201, 0, 620, 621, 3, 399, 199, 0, 621, 622, 3, 435, 217, 0, 622, 623, 3, 407, 203, 0, 623, 88, 1, 0, 0, 0, 624, 625, 3, 403, 201, 0, 625, 626, 3, 399, 199, 0, 626, 627, 3, 435, 217, 0, 627, 628, 3, 437, 218, 0, 628, 90, 1, 0, 0, 0, 629, 630, 3, 403, 201, 0, 630, 631, 3, 413, 206, 0, 631, 632, 3, 407, 203, 0, 632, 633, 3, 403, 201, 0, 633, 634, 3, 419, 209, 0, 634, 92, 1, 0, 0, 0, 635, 636, 3, 403, 201, 0, 636, 637, 3, 427, 213, 0, 637, 638, 3, 421, 210, 0, 638, 639, 3, 421, 210, 0, 639, 640, 3, 399, 199, 0, 640, 641, 3, 437, 218, 0, 641, 642, 3, 407, 203, 0, 642, 94, 1, 0, 0, 0, 643, 644, 3, 403, 201, 0, 644, 645, 3, 427, 213, 0, 645, 646, 3, 421, 210, 0, 646, 647, 3, 439, 219, 0, 647, 648, 3, 423, 211, 0, 648, 649, 3, 425, 212, 0, 649, 96, 1, 0, 0, 0, 650, 651, 3, 403, 201, 0, 651, 652, 3, 427, 213, 0, 652, 653, 3, 423, 211, 0, 653, 654, 3, 423, 211, 0, 654, 655, 3, 415, 207, 0, 655, 656, 3, 437, 218, 0, 656, 98, 1, 0, 0, 0, 657, 658, 3, 403, 201, 0, 658, 659, 3, 427, 213, 0, 659, 660, 3, 425, 212, 0, 660, 661, 3, 409, 204, 0, 661, 662, 3, 421, 210, 0, 662, 663, 3, 415, 207, 0, 663, 664, 3, 403, 201, 0, 664, 665, 3, 437, 218, 0, 665, 100, 1, 0, 0, 0, 666, 667, 3, 403, 201, 0, 667, 668, 3, 427, 213, 0, 668, 669, 3, 425, 212, 0, 669, 670, 3, 435, 217, 0, 670, 671, 3, 437, 218, 0, 671, 672, 3, 433, 216, 0, 672, 673, 3, 399, 199, 0, 673, 674, 3, 415, 207, 0, 674, 675, 3, 425, 212, 0, 675, 676, 3, 437, 218, 0, 676, 102, 1, 0, 0, 0, 677, 678, 3, 403, 201, 0, 678, 679, 3, 433, 216, 0, 679, 680, 3, 407, 203, 0, 680, 681, 3, 399, 199, 0, 681, 682, 3, 437, 218, 0, 682, 683, 3, 407, 203, 0, 683, 104, 1, 0, 0, 0, 684, 685, 3, 403, 201, 0, 685, 686, 3, 433, 216, 0, 686, 687, 3, 427, 213, 0, 687, 688, 3, 435, 217, 0, 688, 689, 3, 435, 217, 0, 689, 106, 1, 0, 0, 0, 690, 691, 3, 403, 201, 0, 691, 692, 3, 439, 219, 0, 692, 693, 3, 433, 216, 0, 693, 694, 3, 433, 216, 0, 694, 695, 3, 407, 203, 0, 695, 696, 3, 425, 212, 0, 696, 697, 3, 437, 218, 0, 697, 698, 5, 95, 0, 0, 698, 699, 3, 405, 202, 0, 699, 700, 3, 399, 199, 0, 700, 701, 3, 437, 218, 0, 701, 702, 3, 407, 203, 0, 702, 108, 1, 0, 0, 0, 703, 704, 3, 403, 201, 0, 704, 705, 3, 439, 219, 0, 705, 706, 3, 433, 216, 0, 706, 707, 3, 433, 216, 0, 707, 708, 3, 407, 203, 0, 708, 709, 3, 425, 212, 0, 709, 710, 3, 437, 218, 0, 710, 711, 5, 95, 0, 0, 711, 712, 3, 437, 218, 0, 712, 713, 3, 415, 207, 0, 713, 714, 3, 423, 211, 0, 714, 715, 3, 407, 203, 0, 715, 110, 1, 0, 0, 0, 716, 717, 3, 403, 201, 0, 717, 718, 3, 439, 219, 0, 718, 719, 3, 433, 216, 0, 719, 720, 3, 433, 216, 0, 720, 721, 3, 407, 203, 0, 721, 722, 3, 425, 212, 0, 722, 723, 3, 437, 218, 0, 723, 724, 5, 95, 0, 0, 724, 725, 3, 437, 218, 0, 725, 726, 3, 415, 207, 0, 726, 727, 3, 423, 211, 0, 727, 728, 3, 407, 203, 0, 728, 729, 3, 435, 217, 0, 729, 730, 3, 437, 218, 0, 730, 731, 3, 399, 199, 0, 731, 732, 3, 423, 211, 0, 732, 733, 3, 429, 214, 0, 733, 112, 1, 0, 0, 0, 734, 735, 3, 405, 202, 0, 735, 736, 3, 399, 199, 0, 736, 737, 3, 437, 218, 0, 737, 738, 3, 399, 199, 0, 738, 739, 3, 401, 200, 0, 739, 740, 3, 399, 199, 0, 740, 741, 3, 435, 217, 0, 741, 742, 3, 407, 203, 0, 742, 114, 1, 0, 0, 0, 743, 744, 3, 405, 202, 0, 744, 745, 3, 407, 203, 0, 745, 746, 3, 409, 204, 0, 746, 747, 3, 399, 199, 0, 747, 748, 3, 439, 219, 0, 748, 749, 3, 421, 210, 0, 749, 750, 3, 437, 218, 0, 750, 116, 1, 0, 0, 0, 751, 752, 3, 405, 202, 0, 752, 753, 3, 407, 203, 0, 753, 754, 3, 409, 204, 0, 754, 755, 3, 407, 203, 0, 755, 756, 3, 433, 216, 0, 756, 757, 3, 433, 216, 0, 757, 758, 3, 399, 199, 0, 758, 759, 3, 401, 200, 0, 759, 760, 3, 421, 210, 0, 760, 761, 3, 407, 203, 0, 761, 118, 1, 0, 0, 0, 762, 763, 3, 405, 202, 0, 763, 764, 3, 407, 203, 0, 764, 765, 3, 409, 204, 0, 765, 766, 3, 407, 203, 0, 766, 767, 3, 433, 216, 0, 767, 768, 3, 433, 216, 0, 768, 769, 3, 407, 203, 0, 769, 770, 3, 405, 202, 0, 770, 120, 1, 0, 0, 0, 771, 772, 3, 405, 202, 0, 772, 773, 3, 407, 203, 0, 773, 774, 3, 421, 210, 0, 774, 775, 3, 407, 203, 0, 775, 776, 3, 437, 218, 0, 776, 777, 3, 407, 203, 0, 777, 122, 1, 0, 0, 0, 778, 779, 3, 405, 202, 0, 779, 780, 3, 407, 203, 0, 780, 781, 3, 435, 217, 0, 781, 782, 3, 403, 201, 0, 782, 124, 1, 0, 0, 0, 783, 784, 3, 405, 202, 0, 784, 785, 3, 407, 203, 0, 785, 786, 3, 437, 218, 0, 786, 787, 3, 399, 199, 0, 787, 788, 3, 403, 201, 0, 788, 789, 3, 413, 206, 0, 789, 126, 1, 0, 0, 0, 790, 791, 3, 405, 202, 0, 791, 792, 3, 415, 207, 0, 792, 793, 3, 435, 217, 0, 793, 794, 3, 437, 218, 0, 794, 795, 3, 415, 207, 0, 795, 796, 3, 425, 212, 0, 796, 797, 3, 403, 201, 0, 797, 798, 3, 437, 218, 0, 798, 128, 1, 0, 0, 0, 799, 800, 3, 405, 202, 0, 800, 801, 3, 433, 216, 0, 801, 802, 3, 427, 213, 0, 802, 803, 3, 429, 214, 0, 803, 130, 1, 0, 0, 0, 804, 805, 3, 407, 203, 0, 805, 806, 3, 399, 199, 0, 806, 807, 3, 403, 201, 0, 807, 808, 3, 413, 206, 0, 808, 132, 1, 0, 0, 0, 809, 810, 3, 407, 203, 0, 810, 811, 3, 421, 210, 0, 811, 812, 3, 435, 217, 0, 812, 813, 3, 407, 203, 0, 813, 134, 1, 0, 0, 0, 814, 815, 3, 407, 203, 0, 815, 816, 3, 425, 212, 0, 816, 817, 3, 405, 202, 0, 817, 136, 1, 0, 0, 0, 818, 819, 3, 407, 203, 0, 819, 820, 3, 435, 217, 0, 820, 821, 3, 403, 201, 0, 821, 822, 3, 399, 199, 0, 822, 823, 3, 429, 214, 0, 823, 824, 3, 407, 203, 0, 824, 138, 1, 0, 0, 0, 825, 826, 3, 407, 203, 0, 826, 827, 3, 445, 222, 0, 827, 828, 3, 403, 201, 0, 828, 829, 3, 407, 203, 0, 829, 830, 3, 429, 214, 0, 830, 831, 3, 437, 218, 0, 831, 140, 1, 0, 0, 0, 832, 833, 3, 407, 203, 0, 833, 834, 3, 445, 222, 0, 834, 835, 3, 403, 201, 0, 835, 836, 3, 421, 210, 0, 836, 837, 3, 439, 219, 0, 837, 838, 3, 435, 217, 0, 838, 839, 3, 415, 207, 0, 839, 840, 3, 441, 220, 0, 840, 841, 3, 407, 203, 0, 841, 142, 1, 0, 0, 0, 842, 843, 3, 407, 203, 0, 843, 844, 3, 445, 222, 0, 844, 845, 3, 415, 207, 0, 845, 846, 3, 435, 217, 0, 846, 847, 3, 437, 218, 0, 847, 848, 3, 435, 217, 0, 848, 144, 1, 0, 0, 0, 849, 850, 3, 407, 203, 0, 850, 851, 3, 445, 222, 0, 851, 852, 3, 429, 214, 0, 852, 853, 3, 421, 210, 0, 853, 854, 3, 399, 199, 0, 854, 855, 3, 415, 207, 0, 855, 856, 3, 425, 212, 0, 856, 146, 1, 0, 0, 0, 857, 858, 3, 409, 204, 0, 858, 859, 3, 399, 199, 0, 859, 860, 3, 415, 207, 0, 860, 861, 3, 421, 210, 0, 861, 148, 1, 0, 0, 0, 862, 863, 3, 409, 204, 0, 863, 864, 3, 427, 213, 0, 864, 865, 3, 433, 216, 0, 865, 150, 1, 0, 0, 0, 866, 867, 3, 409, 204, 0, 867, 868, 3, 427, 213, 0, 868, 869, 3, 433, 216, 0, 869, 870, 3, 407, 203, 0, 870, 871, 3, 415, 207, 0, 871, 872, 3, 411, 205, 0, 872, 873, 3, 425, 212, 0, 873, 152, 1, 0, 0, 0, 874, 875, 3, 409, 204, 0, 875, 876, 3, 433, 216, 0, 876, 877, 3, 427, 213, 0, 877, 878, 3, 423, 211, 0, 878, 154, 1, 0, 0, 0, 879, 880, 3, 409, 204, 0, 880, 881, 3, 439, 219, 0, 881, 882, 3, 421, 210, 0, 882, 883, 3, 421, 210, 0, 883, 156, 1, 0, 0, 0, 884, 885, 3, 411, 205, 0, 885, 886, 3, 421, 210, 0, 886, 887, 3, 427, 213, 0, 887, 888, 3, 401, 200, 0, 888, 158, 1, 0, 0, 0, 889, 890, 3, 411, 205, 0, 890, 891, 3, 433, 216, 0, 891, 892, 3, 427, 213, 0, 892, 893, 3, 439, 219, 0, 893, 894, 3, 429, 214, 0, 894, 160, 1, 0, 0, 0, 895, 896, 3, 413, 206, 0, 896, 897, 3, 399, 199, 0, 897, 898, 3, 441, 220, 0, 898, 899, 3, 415, 207, 0, 899, 900, 3, 425, 212, 0, 900, 901, 3, 411, 205, 0, 901, 162, 1, 0, 0, 0, 902, 903, 3, 415, 207, 0, 903, 904, 3, 409, 204, 0, 904, 164, 1, 0, 0, 0, 905, 906, 3, 415, 207, 0, 906, 907, 3, 411, 205, 0, 907, 908, 3, 425, 212, 0, 908, 909, 3, 427, 213, 0, 909, 910, 3, 433, 216, 0, 910, 911, 3, 407, 203, 0, 911, 166, 1, 0, 0, 0, 912, 913, 3, 415, 207, 0, 913, 914, 3, 423, 211, 0, 914, 915, 3, 423, 211, 0, 915, 916, 3, 407, 203, 0, 916, 917, 3, 405, 202, 0, 917, 918, 3, 415, 207, 0, 918, 919, 3, 399, 199, 0, 919, 920, 3, 437, 218, 0, 920, 921, 3, 407, 203, 0, 921, 168, 1, 0, 0, 0, 922, 923, 3, 415, 207, 0, 923, 924, 3, 425, 212, 0, 924, 170, 1, 0, 0, 0, 925, 926, 3, 415, 207, 0, 926, 927, 3, 425, 212, 0, 927, 928, 3, 405, 202, 0, 928, 929, 3, 407, 203, 0, 929, 930, 3, 445, 222, 0, 930, 172, 1, 0, 0, 0, 931, 932, 3, 415, 207, 0, 932, 933, 3, 425, 212, 0, 933, 934, 3, 405, 202, 0, 934, 935, 3, 407, 203, 0, 935, 936, 3, 445, 222, 0, 936, 937, 3, 407, 203, 0, 937, 938, 3, 405, 202, 0, 938, 174, 1, 0, 0, 0, 939, 940, 3, 415, 207, 0, 940, 941, 3, 425, 212, 0, 941, 942, 3, 415, 207, 0, 942, 943, 3, 437, 218, 0, 943, 944, 3, 415, 207, 0, 944, 945, 3, 399, 199, 0, 945, 946, 3, 421, 210, 0, 946, 947, 3, 421, 210, 0, 947, 948, 3, 447, 223, 0, 948, 176, 1, 0, 0, 0, 949, 950, 3, 415, 207, 0, 950, 951, 3, 425, 212, 0, 951, 952, 3, 425, 212, 0, 952, 953, 3, 407, 203, 0, 953, 954, 3, 433, 216, 0, 954, 178, 1, 0, 0, 0, 955, 956, 3, 415, 207, 0, 956, 957, 3, 425, 212, 0, 957, 958, 3, 435, 217, 0, 958, 959, 3, 407, 203, 0, 959, 960, 3, 433, 216, 0, 960, 961, 3, 437, 218, 0, 961, 180, 1, 0, 0, 0, 962, 963, 3, 415, 207, 0, 963, 964, 3, 425, 212, 0, 964, 965, 3, 435, 217, 0, 965, 966, 3, 437, 218, 0, 966, 967, 3, 407, 203, 0, 967, 968, 3, 399, 199, 0, 968, 969, 3, 405, 202, 0, 969, 182, 1, 0, 0, 0, 970, 971, 3, 415, 207, 0, 971, 972, 3, 425, 212, 0, 972, 973, 3, 437, 218, 0, 973, 974, 3, 407, 203, 0, 974, 975, 3, 433, 216, 0, 975, 976, 3, 435, 217, 0, 976, 977, 3, 407, 203, 0, 977, 978, 3, 403, 201, 0, 978, 979, 3, 437, 218, 0, 979, 184, 1, 0, 0, 0, 980, 981, 3, 415, 207, 0, 981, 982, 3, 425, 212, 0, 982, 983, 3, 437, 218, 0, 983, 984, 3, 427, 213, 0, 984, 186, 1, 0, 0, 0, 985, 986, 3, 415, 207, 0, 986, 987, 3, 435, 217, 0, 987, 188, 1, 0, 0, 0, 988, 989, 3, 415, 207, 0, 989, 990, 3, 435, 217, 0, 990, 991, 3, 425, 212, 0, 991, 992, 3, 439, 219, 0, 992, 993, 3, 421, 210, 0, 993, 994, 3, 421, 210, 0, 994, 190, 1, 0, 0, 0, 995, 996, 3, 417, 208, 0, 996, 997, 3, 427, 213, 0, 997, 998, 3, 415, 207, 0, 998, 999, 3, 425, 212, 0, 999, 192, 1, 0, 0, 0, 1000, 1001, 3, 419, 209, 0, 1001, 1002, 3, 407, 203, 0, 1002, 1003, 3, 447, 223, 0, 1003, 194, 1, 0, 0, 0, 1004, 1005, 3, 421, 210, 0, 1005, 1006, 3, 407, 203, 0, 1006, 1007, 3, 409, 204, 0, 1007, 1008, 3, 437, 218, 0, 1008, 196, 1, 0, 0, 0, 1009, 1010, 3, 421, 210, 0, 1010, 1011, 3, 415, 207, 0, 1011, 1012, 3, 419, 209, 0, 1012, 1013, 3, 407, 203, 0, 1013, 198, 1, 0, 0, 0, 1014, 1015, 3, 421, 210, 0, 1015, 1016, 3, 415, 207, 0, 1016, 1017, 3, 423, 211, 0, 1017, 1018, 3, 415, 207, 0, 1018, 1019, 3, 437, 218, 0, 1019, 200, 1, 0, 0, 0, 1020, 1021, 3, 423, 211, 0, 1021, 1022, 3, 399, 199, 0, 1022, 1023, 3, 437, 218, 0, 1023, 1024, 3, 403, 201, 0, 1024, 1025, 3, 413, 206, 0, 1025, 202, 1, 0, 0, 0, 1026, 1027, 3, 425, 212, 0, 1027, 1028, 3, 399, 199, 0, 1028, 1029, 3, 437, 218, 0, 1029, 1030, 3, 439, 219, 0, 1030, 1031, 3, 433, 216, 0, 1031, 1032, 3, 399, 199, 0, 1032, 1033, 3, 421, 210, 0, 1033, 204, 1, 0, 0, 0, 1034, 1035, 3, 425, 212, 0, 1035, 1036, 3, 427, 213, 0, 1036, 206, 1, 0, 0, 0, 1037, 1038, 3, 425, 212, 0, 1038, 1039, 3, 427, 213, 0, 1039, 1040, 3, 437, 218, 0, 1040, 208, 1, 0, 0, 0, 1041, 1042, 3, 425, 212, 0, 1042, 1043, 3, 427, 213, 0, 1043, 1044, 3, 437, 218, 0, 1044, 1045, 3, 425, 212, 0, 1045, 1046, 3, 439, 219, 0, 1046, 1047, 3, 421, 210, 0, 1047, 1048, 3, 421, 210, 0, 1048, 210, 1, 0, 0, 0, 1049, 1050, 3, 425, 212, 0, 1050, 1051, 3, 439, 219, 0, 1051, 1052, 3, 421, 210, 0, 1052, 1053, 3, 421, 210, 0, 1053, 212, 1, 0, 0, 0, 1054, 1055, 3, 427, 213, 0, 1055, 1056, 3, 409, 204, 0, 1056, 214, 1, 0, 0, 0, 1057, 1058, 3, 427, 213, 0, 1058, 1059, 3, 409, 204, 0, 1059, 1060, 3, 409, 204, 0, 1060, 1061, 3, 435, 217, 0, 1061, 1062, 3, 407, 203, 0, 1062, 1063, 3, 437, 218, 0, 1063, 216, 1, 0, 0, 0, 1064, 1065, 3, 427, 213, 0, 1065, 1066, 3, 425, 212, 0, 1066, 218, 1, 0, 0, 0, 1067, 1068, 3, 427, 213, 0, 1068, 1069, 3, 433, 216, 0, 1069, 220, 1, 0, 0, 0, 1070, 1071, 3, 427, 213, 0, 1071, 1072, 3, 433, 216, 0, 1072, 1073, 3, 405, 202, 0, 1073, 1074, 3, 407, 203, 0, 1074, 1075, 3, 433, 216, 0, 1075, 222, 1, 0, 0, 0, 1076, 1077, 3, 427, 213, 0, 1077, 1078, 3, 439, 219, 0, 1078, 1079, 3, 437, 218, 0, 1079, 1080, 3, 407, 203, 0, 1080, 1081, 3, 433, 216, 0, 1081, 224, 1, 0, 0, 0, 1082, 1083, 3, 429, 214, 0, 1083, 1084, 3, 421, 210, 0, 1084, 1085, 3, 399, 199, 0, 1085, 1086, 3, 425, 212, 0, 1086, 226, 1, 0, 0, 0, 1087, 1088, 3, 429, 214, 0, 1088, 1089, 3, 433, 216, 0, 1089, 1090, 3, 399, 199, 0, 1090, 1091, 3, 411, 205, 0, 1091, 1092, 3, 423, 211, 0, 1092, 1093, 3, 399, 199, 0, 1093, 228, 1, 0, 0, 0, 1094, 1095, 3, 429, 214, 0, 1095, 1096, 3, 433, 216, 0, 1096, 1097, 3, 415, 207, 0, 1097, 1098, 3, 423, 211, 0, 1098, 1099, 3, 399, 199, 0, 1099, 1100, 3, 433, 216, 0, 1100, 1101, 3, 447, 223, 0, 1101, 230, 1, 0, 0, 0, 1102, 1103, 3, 431, 215, 0, 1103, 1104, 3, 439, 219, 0, 1104, 1105, 3, 407, 203, 0, 1105, 1106, 3, 433, 216, 0, 1106, 1107, 3, 447, 223, 0, 1107, 232, 1, 0, 0, 0, 1108, 1109, 3, 433, 216, 0, 1109, 1110, 3, 399, 199, 0, 1110, 1111, 3, 415, 207, 0, 1111, 1112, 3, 435, 217, 0, 1112, 1113, 3, 407, 203, 0, 1113, 234, 1, 0, 0, 0, 1114, 1115, 3, 433, 216, 0, 1115, 1116, 3, 407, 203, 0, 1116, 1117, 3, 403, 201, 0, 1117, 1118, 3, 439, 219, 0, 1118, 1119, 3, 433, 216, 0, 1119, 1120, 3, 435, 217, 0, 1120, 1121, 3, 415, 207, 0, 1121, 1122, 3, 441, 220, 0, 1122, 1123, 3, 407, 203, 0, 1123, 236, 1, 0, 0, 0, 1124, 1125, 3, 433, 216, 0, 1125, 1126, 3, 407, 203, 0, 1126, 1127, 3, 409, 204, 0, 1127, 1128, 3, 407, 203, 0, 1128, 1129, 3, 433, 216, 0, 1129, 1130, 3, 407, 203, 0, 1130, 1131, 3, 425, 212, 0, 1131, 1132, 3, 403, 201, 0, 1132, 1133, 3, 407, 203, 0, 1133, 1134, 3, 435, 217, 0, 1134, 238, 1, 0, 0, 0, 1135, 1136, 3, 433, 216, 0, 1136, 1137, 3, 407, 203, 0, 1137, 1138, 3, 411, 205, 0, 1138, 1139, 3, 407, 203, 0, 1139, 1140, 3, 445, 222, 0, 1140, 1141, 3, 429, 214, 0, 1141, 240, 1, 0, 0, 0, 1142, 1143, 3, 433, 216, 0, 1143, 1144, 3, 407, 203, 0, 1144, 1145, 3, 415, 207, 0, 1145, 1146, 3, 425, 212, 0, 1146, 1147, 3, 405, 202, 0, 1147, 1148, 3, 407, 203, 0, 1148, 1149, 3, 445, 222, 0, 1149, 242, 1, 0, 0, 0, 1150, 1151, 3, 433, 216, 0, 1151, 1152, 3, 407, 203, 0, 1152, 1153, 3, 421, 210, 0, 1153, 1154, 3, 407, 203, 0, 1154, 1155, 3, 399, 199, 0, 1155, 1156, 3, 435, 217, 0, 1156, 1157, 3, 407, 203, 0, 1157, 244, 1, 0, 0, 0, 1158, 1159, 3, 433, 216, 0, 1159, 1160, 3, 407, 203, 0, 1160, 1161, 3, 425, 212, 0, 1161, 1162, 3, 399, 199, 0, 1162, 1163, 3, 423, 211, 0, 1163, 1164, 3, 407, 203, 0, 1164, 246, 1, 0, 0, 0, 1165, 1166, 3, 433, 216, 0, 1166, 1167, 3, 407, 203, 0, 1167, 1168, 3, 429, 214, 0, 1168, 1169, 3, 421, 210, 0, 1169, 1170, 3, 399, 199, 0, 1170, 1171, 3, 403, 201, 0, 1171, 1172, 3, 407, 203, 0, 1172, 248, 1, 0, 0, 0, 1173, 1174, 3, 433, 216, 0, 1174, 1175, 3, 407, 203, 0, 1175, 1176, 3, 435, 217, 0, 1176, 1177, 3, 437, 218, 0, 1177, 1178, 3, 433, 216, 0, 1178, 1179, 3, 415, 207, 0, 1179, 1180, 3, 403, 201, 0, 1180, 1181, 3, 437, 218, 0, 1181, 250, 1, 0, 0, 0, 1182, 1183, 3, 433, 216, 0, 1183, 1184, 3, 407, 203, 0, 1184, 1185, 3, 437, 218, 0, 1185, 1186, 3, 439, 219, 0, 1186, 1187, 3, 433, 216, 0, 1187, 1188, 3, 425, 212, 0, 1188, 1189, 3, 415, 207, 0, 1189, 1190, 3, 425, 212, 0, 1190, 1191, 3, 411, 205, 0, 1191, 252, 1, 0, 0, 0, 1192, 1193, 3, 433, 216, 0, 1193, 1194, 3, 415, 207, 0, 1194, 1195, 3, 411, 205, 0, 1195, 1196, 3, 413, 206, 0, 1196, 1197, 3, 437, 218, 0, 1197, 254, 1, 0, 0, 0, 1198, 1199, 3, 433, 216, 0, 1199, 1200, 3, 427, 213, 0, 1200, 1201, 3, 421, 210, 0, 1201, 1202, 3, 421, 210, 0, 1202, 1203, 3, 401, 200, 0, 1203, 1204, 3, 399, 199, 0, 1204, 1205, 3, 403, 201, 0, 1205, 1206, 3, 419, 209, 0, 1206, 256, 1, 0, 0, 0, 1207, 1208, 3, 433, 216, 0, 1208, 1209, 3, 427, 213, 0, 1209, 1210, 3, 443, 221, 0, 1210, 258, 1, 0, 0, 0, 1211, 1212, 3, 433, 216, 0, 1212, 1213, 3, 427, 213, 0, 1213, 1214, 3, 443, 221, 0, 1214, 1215, 3, 435, 217, 0, 1215, 260, 1, 0, 0, 0, 1216, 1217, 3, 435, 217, 0, 1217, 1218, 3, 399, 199, 0, 1218, 1219, 3, 441, 220, 0, 1219, 1220, 3, 407, 203, 0, 1220, 1221, 3, 429, 214, 0, 1221, 1222, 3, 427, 213, 0, 1222, 1223, 3, 415, 207, 0, 1223, 1224, 3, 425, 212, 0, 1224, 1225, 3, 437, 218, 0, 1225, 262, 1, 0, 0, 0, 1226, 1227, 3, 435, 217, 0, 1227, 1228, 3, 407, 203, 0, 1228, 1229, 3, 421, 210, 0, 1229, 1230, 3, 407, 203, 0, 1230, 1231, 3, 403, 201, 0, 1231, 1232, 3, 437, 218, 0, 1232, 264, 1, 0, 0, 0, 1233, 1234, 3, 435, 217, 0, 1234, 1235, 3, 407, 203, 0, 1235, 1236, 3, 437, 218, 0, 1236, 266, 1, 0, 0, 0, 1237, 1238, 3, 435, 217, 0, 1238, 1239, 3, 437, 218, 0, 1239, 1240, 3, 433, 216, 0, 1240, 1241, 3, 415, 207, 0, 1241, 1242, 3, 403, 201, 0, 1242, 1243, 3, 437, 218, 0, 1243, 268, 1, 0, 0, 0, 1244, 1245, 3, 437, 218, 0, 1245, 1246, 3, 399, 199, 0, 1246, 1247, 3, 401, 200, 0, 1247, 1248, 3, 421, 210, 0, 1248, 1249, 3, 407, 203, 0, 1249, 270, 1, 0, 0, 0, 1250, 1251, 3, 437, 218, 0, 1251, 1252, 3, 407, 203, 0, 1252, 1253, 3, 423, 211, 0, 1253, 1254, 3, 429, 214, 0, 1254, 272, 1, 0, 0, 0, 1255, 1256, 3, 437, 218, 0, 1256, 1257, 3, 407, 203, 0, 1257, 1258, 3, 423, 211, 0, 1258, 1259, 3, 429, 214, 0, 1259, 1260, 3, 427, 213, 0, 1260, 1261, 3, 433, 216, 0, 1261, 1262, 3, 399, 199, 0, 1262, 1263, 3, 433, 216, 0, 1263, 1264, 3, 447, 223, 0, 1264, 274, 1, 0, 0, 0, 1265, 1266, 3, 437, 218, 0, 1266, 1267, 3, 413, 206, 0, 1267, 1268, 3, 407, 203, 0, 1268, 1269, 3, 425, 212, 0, 1269, 276, 1, 0, 0, 0, 1270, 1271, 3, 437, 218, 0, 1271, 1272, 3, 427, 213, 0, 1272, 278, 1, 0, 0, 0, 1273, 1274, 3, 437, 218, 0, 1274, 1275, 3, 433, 216, 0, 1275, 1276, 3, 399, 199, 0, 1276, 1277, 3, 425, 212, 0, 1277, 1278, 3, 435, 217, 0, 1278, 1279, 3, 399, 199, 0, 1279, 1280, 3, 403, 201, 0, 1280, 1281, 3, 437, 218, 0, 1281, 1282, 3, 415, 207, 0, 1282, 1283, 3, 427, 213, 0, 1283, 1284, 3, 425, 212, 0, 1284, 280, 1, 0, 0, 0, 1285, 1286, 3, 437, 218, 0, 1286, 1287, 3, 433, 216, 0, 1287, 1288, 3, 415, 207, 0, 1288, 1289, 3, 411, 205, 0, 1289, 1290, 3, 411, 205, 0, 1290, 1291, 3, 407, 203, 0, 1291, 1292, 3, 433, 216, 0, 1292, 282, 1, 0, 0, 0, 1293, 1294, 3, 439, 219, 0, 1294, 1295, 3, 425, 212, 0, 1295, 1296, 3, 415, 207, 0, 1296, 1297, 3, 427, 213, 0, 1297, 1298, 3, 425, 212, 0, 1298, 284, 1, 0, 0, 0, 1299, 1300, 3, 439, 219, 0, 1300, 1301, 3, 425, 212, 0, 1301, 1302, 3, 415, 207, 0, 1302, 1303, 3, 431, 215, 0, 1303, 1304, 3, 439, 219, 0, 1304, 1305, 3, 407, 203, 0, 1305, 286, 1, 0, 0, 0, 1306, 1307, 3, 439, 219, 0, 1307, 1308, 3, 429, 214, 0, 1308, 1309, 3, 405, 202, 0, 1309, 1310, 3, 399, 199, 0, 1310, 1311, 3, 437, 218, 0, 1311, 1312, 3, 407, 203, 0, 1312, 288, 1, 0, 0, 0, 1313, 1314, 3, 439, 219, 0, 1314, 1315, 3, 435, 217, 0, 1315, 1316, 3, 415, 207, 0, 1316, 1317, 3, 425, 212, 0, 1317, 1318, 3, 411, 205, 0, 1318, 290, 1, 0, 0, 0, 1319, 1320, 3, 441, 220, 0, 1320, 1321, 3, 399, 199, 0, 1321, 1322, 3, 403, 201, 0, 1322, 1323, 3, 439, 219, 0, 1323, 1324, 3, 439, 219, 0, 1324, 1325, 3, 423, 211, 0, 1325, 292, 1, 0, 0, 0, 1326, 1327, 3, 441, 220, 0, 1327, 1328, 3, 399, 199, 0, 1328, 1329, 3, 421, 210, 0, 1329, 1330, 3, 439, 219, 0, 1330, 1331, 3, 407, 203, 0, 1331, 1332, 3, 435, 217, 0, 1332, 294, 1, 0, 0, 0, 1333, 1334, 3, 441, 220, 0, 1334, 1335, 3, 415, 207, 0, 1335, 1336, 3, 407, 203, 0, 1336, 1337, 3, 443, 221, 0, 1337, 296, 1, 0, 0, 0, 1338, 1339, 3, 441, 220, 0, 1339, 1340, 3, 415, 207, 0, 1340, 1341, 3, 433, 216, 0, 1341, 1342, 3, 437, 218, 0, 1342, 1343, 3, 439, 219, 0, 1343, 1344, 3, 399, 199, 0, 1344, 1345, 3, 421, 210, 0, 1345, 298, 1, 0, 0, 0, 1346, 1347, 3, 443, 221, 0, 1347, 1348, 3, 413, 206, 0, 1348, 1349, 3, 407, 203, 0, 1349, 1350, 3, 425, 212, 0, 1350, 300, 1, 0, 0, 0, 1351, 1352, 3, 443, 221, 0, 1352, 1353, 3, 413, 206, 0, 1353, 1354, 3, 407, 203, 0, 1354, 1355, 3, 433, 216, 0, 1355, 1356, 3, 407, 203, 0, 1356, 302, 1, 0, 0, 0, 1357, 1358, 3, 443, 221, 0, 1358, 1359, 3, 415, 207, 0, 1359, 1360, 3, 437, 218, 0, 1360, 1361, 3, 413, 206, 0, 1361, 304, 1, 0, 0, 0, 1362, 1363, 3, 443, 221, 0, 1363, 1364, 3, 415, 207, 0, 1364, 1365, 3, 437, 218, 0, 1365, 1366, 3, 413, 206, 0, 1366, 1367, 3, 427, 213, 0, 1367, 1368, 3, 439, 219, 0, 1368, 1369, 3, 437, 218, 0, 1369, 306, 1, 0, 0, 0, 1370, 1371, 3, 409, 204, 0, 1371, 1372, 3, 415, 207, 0, 1372, 1373, 3, 433, 216, 0, 1373, 1374, 3, 435, 217, 0, 1374, 1375, 3, 437, 218, 0, 1375, 1376, 5, 95, 0, 0, 1376, 1377, 3, 441, 220, 0, 1377, 1378, 3, 399, 199, 0, 1378, 1379, 3, 421, 210, 0, 1379, 1380, 3, 439, 219, 0, 1380, 1381, 3, 407, 203, 0, 1381, 308, 1, 0, 0, 0, 1382, 1383, 3, 427, 213, 0, 1383, 1384, 3, 441, 220, 0, 1384, 1385, 3, 407, 203, 0, 1385, 1386, 3, 433, 216, 0, 1386, 310, 1, 0, 0, 0, 1387, 1388, 3, 429, 214, 0, 1388, 1389, 3, 399, 199, 0, 1389, 1390, 3, 433, 216, 0, 1390, 1391, 3, 437, 218, 0, 1391, 1392, 3, 415, 207, 0, 1392, 1393, 3, 437, 218, 0, 1393, 1394, 3, 415, 207, 0, 1394, 1395, 3, 427, 213, 0, 1395, 1396, 3, 425, 212, 0, 1396, 312, 1, 0, 0, 0, 1397, 1398, 3, 433, 216, 0, 1398, 1399, 3, 399, 199, 0, 1399, 1400, 3, 425, 212, 0, 1400, 1401, 3, 411, 205, 0, 1401, 1402, 3, 407, 203, 0, 1402, 314, 1, 0, 0, 0, 1403, 1404, 3, 429, 214, 0, 1404, 1405, 3, 433, 216, 0, 1405, 1406, 3, 407, 203, 0, 1406, 1407, 3, 403, 201, 0, 1407, 1408, 3, 407, 203, 0, 1408, 1409, 3, 405, 202, 0, 1409, 1410, 3, 415, 207, 0, 1410, 1411, 3, 425, 212, 0, 1411, 1412, 3, 411, 205, 0, 1412, 316, 1, 0, 0, 0, 1413, 1414, 3, 439, 219, 0, 1414, 1415, 3, 425, 212, 0, 1415, 1416, 3, 401, 200, 0, 1416, 1417, 3, 427, 213, 0, 1417, 1418, 3, 439, 219, 0, 1418, 1419, 3, 425, 212, 0, 1419, 1420, 3, 405, 202, 0, 1420, 1421, 3, 407, 203, 0, 1421, 1422, 3, 405, 202, 0, 1422, 318, 1, 0, 0, 0, 1423, 1424, 3, 403, 201, 0, 1424, 1425, 3, 439, 219, 0, 1425, 1426, 3, 433, 216, 0, 1426, 1427, 3, 433, 216, 0, 1427, 1428, 3, 407, 203, 0, 1428, 1429, 3, 425, 212, 0, 1429, 1430, 3, 437, 218, 0, 1430, 320, 1, 0, 0, 0, 1431, 1432, 3, 409, 204, 0, 1432, 1433, 3, 427, 213, 0, 1433, 1434, 3, 421, 210, 0, 1434, 1435, 3, 421, 210, 0, 1435, 1436, 3, 427, 213, 0, 1436, 1437, 3, 443, 221, 0, 1437, 1438, 3, 415, 207, 0, 1438, 1439, 3, 425, 212, 0, 1439, 1440, 3, 411, 205, 0, 1440, 322, 1, 0, 0, 0, 1441, 1442, 3, 403, 201, 0, 1442, 1443, 3, 439, 219, 0, 1443, 1444, 3, 423, 211, 0, 1444, 1445, 3, 407, 203, 0, 1445, 1446, 5, 95, 0, 0, 1446, 1447, 3, 405, 202, 0, 1447, 1448, 3, 415, 207, 0, 1448, 1449, 3, 435, 217, 0, 1449, 1450, 3, 437, 218, 0, 1450, 324, 1, 0, 0, 0, 1451, 1452, 3, 405, 202, 0, 1452, 1453, 3, 407, 203, 0, 1453, 1454, 3, 425, 212, 0, 1454, 1455, 3, 435, 217, 0, 1455, 1456, 3, 407, 203, 0, 1456, 1457, 5, 95, 0, 0, 1457, 1458, 3, 433, 216, 0, 1458, 1459, 3, 399, 199, 0, 1459, 1460, 3, 425, 212, 0, 1460, 1461, 3, 419, 209, 0, 1461, 326, 1, 0, 0, 0, 1462, 1463, 3, 421, 210, 0, 1463, 1464, 3, 399, 199, 0, 1464, 1465, 3, 411, 205, 0, 1465, 328, 1, 0, 0, 0, 1466, 1467, 3, 421, 210, 0, 1467, 1468, 3, 399, 199, 0, 1468, 1469, 3, 435, 217, 0, 1469, 1470, 3, 437, 218, 0, 1470, 1471, 5, 95, 0, 0, 1471, 1472, 3, 441, 220, 0, 1472, 1473, 3, 399, 199, 0, 1473, 1474, 3, 421, 210, 0, 1474, 1475, 3, 439, 219, 0, 1475, 1476, 3, 407, 203, 0, 1476, 330, 1, 0, 0, 0, 1477, 1478, 3, 421, 210, 0, 1478, 1479, 3, 407, 203, 0, 1479, 1480, 3, 399, 199, 0, 1480, 1481, 3, 405, 202, 0, 1481, 332, 1, 0, 0, 0, 1482, 1483, 3, 425, 212, 0, 1483, 1484, 3, 437, 218, 0, 1484, 1485, 3, 413, 206, 0, 1485, 1486, 5, 95, 0, 0, 1486, 1487, 3, 441, 220, 0, 1487, 1488, 3, 399, 199, 0, 1488, 1489, 3, 421, 210, 0, 1489, 1490, 3, 439, 219, 0, 1490, 1491, 3, 407, 203, 0, 1491, 334, 1, 0, 0, 0, 1492, 1493, 3, 425, 212, 0, 1493, 1494, 3, 437, 218, 0, 1494, 1495, 3, 415, 207, 0, 1495, 1496, 3, 421, 210, 0, 1496, 1497, 3, 407, 203, 0, 1497, 336, 1, 0, 0, 0, 1498, 1499, 3, 429, 214, 0, 1499, 1500, 3, 407, 203, 0, 1500, 1501, 3, 433, 216, 0, 1501, 1502, 3, 403, 201, 0, 1502, 1503, 3, 407, 203, 0, 1503, 1504, 3, 425, 212, 0, 1504, 1505, 3, 437, 218, 0, 1505, 1506, 5, 95, 0, 0, 1506, 1507, 3, 433, 216, 0, 1507, 1508, 3, 399, 199, 0, 1508, 1509, 3, 425, 212, 0, 1509, 1510, 3, 419, 209, 0, 1510, 338, 1, 0, 0, 0, 1511, 1512, 3, 433, 216, 0, 1512, 1513, 3, 399, 199, 0, 1513, 1514, 3, 425, 212, 0, 1514, 1515, 3, 419, 209, 0, 1515, 340, 1, 0, 0, 0, 1516, 1517, 3, 433, 216, 0, 1517, 1518, 3, 427, 213, 0, 1518, 1519, 3, 443, 221, 0, 1519, 1520, 5, 95, 0, 0, 1520, 1521, 3, 425, 212, 0, 1521, 1522, 3, 439, 219, 0, 1522, 1523, 3, 423, 211, 0, 1523, 1524, 3, 401, 200, 0, 1524, 1525, 3, 407, 203, 0, 1525, 1526, 3, 433, 216, 0, 1526, 342, 1, 0, 0, 0, 1527, 1528, 3, 411, 205, 0, 1528, 1529, 3, 407, 203, 0, 1529, 1530, 3, 425, 212, 0, 1530, 1531, 3, 407, 203, 0, 1531, 1532, 3, 433, 216, 0, 1532, 1533, 3, 399, 199, 0, 1533, 1534, 3, 437, 218, 0, 1534, 1535, 3, 407, 203, 0, 1535, 1536, 3, 405, 202, 0, 1536, 344, 1, 0, 0, 0, 1537, 1538, 3, 399, 199, 0, 1538, 1539, 3, 421, 210, 0, 1539, 1540, 3, 443, 221, 0, 1540, 1541, 3, 399, 199, 0, 1541, 1542, 3, 447, 223, 0, 1542, 1543, 3, 435, 217, 0, 1543, 346, 1, 0, 0, 0, 1544, 1545, 3, 435, 217, 0, 1545, 1546, 3, 437, 218, 0, 1546, 1547, 3, 427, 213, 0, 1547, 1548, 3, 433, 216, 0, 1548, 1549, 3, 407, 203, 0, 1549, 1550, 3, 405, 202, 0, 1550, 348, 1, 0, 0, 0, 1551, 1552, 3, 437, 218, 0, 1552, 1553, 3, 433, 216, 0, 1553, 1554, 3, 439, 219, 0, 1554, 1555, 3, 407, 203, 0, 1555, 350, 1, 0, 0, 0, 1556, 1557, 3, 409, 204, 0, 1557, 1558, 3, 399, 199, 0, 1558, 1559, 3, 421, 210, 0, 1559, 1560, 3, 435, 217, 0, 1560, 1561, 3, 407, 203, 0, 1561, 352, 1, 0, 0, 0, 1562, 1563, 3, 443, 221, 0, 1563, 1564, 3, 415, 207, 0, 1564, 1565, 3, 425, 212, 0, 1565, 1566, 3, 405, 202, 0, 1566, 1567, 3, 427, 213, 0, 1567, 1568, 3, 443, 221, 0, 1568, 354, 1, 0, 0, 0, 1569, 1570, 3, 425, 212, 0, 1570, 1571, 3, 439, 219, 0, 1571, 1572, 3, 421, 210, 0, 1572, 1573, 3, 421, 210, 0, 1573, 1574, 3, 435, 217, 0, 1574, 356, 1, 0, 0, 0, 1575, 1576, 3, 409, 204, 0, 1576, 1577, 3, 415, 207, 0, 1577, 1578, 3, 433, 216, 0, 1578, 1579, 3, 435, 217, 0, 1579, 1580, 3, 437, 218, 0, 1580, 358, 1, 0, 0, 0, 1581, 1582, 3, 421, 210, 0, 1582, 1583, 3, 399, 199, 0, 1583, 1584, 3, 435, 217, 0, 1584, 1585, 3, 437, 218, 0, 1585, 360, 1, 0, 0, 0, 1586, 1587, 3, 409, 204, 0, 1587, 1588, 3, 415, 207, 0, 1588, 1589, 3, 421, 210, 0, 1589, 1590, 3, 437, 218, 0, 1590, 1591, 3, 407, 203, 0, 1591, 1592, 3, 433, 216, 0, 1592, 362, 1, 0, 0, 0, 1593, 1594, 3, 411, 205, 0, 1594, 1595, 3, 433, 216, 0, 1595, 1596, 3, 427, 213, 0, 1596, 1597, 3, 439, 219, 0, 1597, 1598, 3, 429, 214, 0, 1598, 1599, 3, 435, 217, 0, 1599, 364, 1, 0, 0, 0, 1600, 1601, 3, 407, 203, 0, 1601, 1602, 3, 445, 222, 0, 1602, 1603, 3, 403, 201, 0, 1603, 1604, 3, 421, 210, 0, 1604, 1605, 3, 439, 219, 0, 1605, 1606, 3, 405, 202, 0, 1606, 1607, 3, 407, 203, 0, 1607, 366, 1, 0, 0, 0, 1608, 1609, 3, 437, 218, 0, 1609, 1610, 3, 415, 207, 0, 1610, 1611, 3, 407, 203, 0, 1611, 1612, 3, 435, 217, 0, 1612, 368, 1, 0, 0, 0, 1613, 1614, 3, 427, 213, 0, 1614, 1615, 3, 437, 218, 0, 1615, 1616, 3, 413, 206, 0, 1616, 1617, 3, 407, 203, 0, 1617, 1618, 3, 433, 216, 0, 1618, 1619, 3, 435, 217, 0, 1619, 370, 1, 0, 0, 0, 1620, 1621, 3, 405, 202, 0, 1621, 1622, 3, 427, 213, 0, 1622, 372, 1, 0, 0, 0, 1623, 1624, 3, 425, 212, 0, 1624, 1625, 3, 427, 213, 0, 1625, 1626, 3, 437, 218, 0, 1626, 1627, 3, 413, 206, 0, 1627, 1628, 3, 415, 207, 0, 1628, 1629, 3, 425, 212, 0, 1629, 1630, 3, 411, 205, 0, 1630, 374, 1, 0, 0, 0, 1631, 1637, 5, 34, 0, 0, 1632, 1636, 8, 0, 0, 0, 1633, 1634, 5, 34, 0, 0, 1634, 1636, 5, 34, 0, 0, 1635, 1632, 1, 0, 0, 0, 1635, 1633, 1, 0, 0, 0, 1636, 1639, 1, 0, 0, 0, 1637, 1635, 1, 0, 0, 0, 1637, 1638, 1, 0, 0, 0, 1638, 1640, 1, 0, 0, 0, 1639, 1637, 1, 0, 0, 0, 1640, 1667, 5, 34, 0, 0, 1641, 1647, 5, 96, 0, 0, 1642, 1646, 8, 1, 0, 0, 1643, 1644, 5, 96, 0, 0, 1644, 1646, 5, 96, 0, 0, 1645, 1642, 1, 0, 0, 0, 1645, 1643, 1, 0, 0, 0, 1646, 1649, 1, 0, 0, 0, 1647, 1645, 1, 0, 0, 0, 1647, 1648, 1, 0, 0, 0, 1648, 1650, 1, 0, 0, 0, 1649, 1647, 1, 0, 0, 0, 1650, 1667, 5, 96, 0, 0, 1651, 1655, 5, 91, 0, 0, 1652, 1654, 8, 2, 0, 0, 1653, 1652, 1, 0, 0, 0, 1654, 1657, 1, 0, 0, 0, 1655, 1653, 1, 0, 0, 0, 1655, 1656, 1, 0, 0, 0, 1656, 1658, 1, 0, 0, 0, 1657, 1655, 1, 0, 0, 0, 1658, 1667, 5, 93, 0, 0, 1659, 1663, 7, 3, 0, 0, 1660, 1662, 7, 4, 0, 0, 1661, 1660, 1, 0, 0, 0, 1662, 1665, 1, 0, 0, 0, 1663, 1661, 1, 0, 0, 0, 1663, 1664, 1, 0, 0, 0, 1664, 1667, 1, 0, 0, 0, 1665, 1663, 1, 0, 0, 0, 1666, 1631, 1, 0, 0, 0, 1666, 1641, 1, 0, 0, 0, 1666, 1651, 1, 0, 0, 0, 1666, 1659, 1, 0, 0, 0, 1667, 376, 1, 0, 0, 0, 1668, 1670, 3, 397, 198, 0, 1669, 1668, 1, 0, 0, 0, 1670, 1671, 1, 0, 0, 0, 1671, 1669, 1, 0, 0, 0, 1671, 1672, 1, 0, 0, 0, 1672, 1680, 1, 0, 0, 0, 1673, 1677, 5, 46, 0, 0, 1674, 1676, 3, 397, 198, 0, 1675, 1674, 1, 0, 0, 0, 1676, 1679, 1, 0, 0, 0, 1677, 1675, 1, 0, 0, 0, 1677, 1678, 1, 0, 0, 0, 1678, 1681, 1, 0, 0, 0, 1679, 1677, 1, 0, 0, 0, 1680, 1673, 1, 0, 0, 0, 1680, 1681, 1, 0, 0, 0, 1681, 1689, 1, 0, 0, 0, 1682, 1684, 5, 46, 0, 0, 1683, 1685, 3, 397, 198, 0, 1684, 1683, 1, 0, 0, 0, 1685, 1686, 1, 0, 0, 0, 1686, 1684, 1, 0, 0, 0, 1686, 1687, 1, 0, 0, 0, 1687, 1689, 1, 0, 0, 0, 1688, 1669, 1, 0, 0, 0, 1688, 1682, 1, 0, 0, 0, 1689, 1699, 1, 0, 0, 0, 1690, 1692, 3, 407, 203, 0, 1691, 1693, 7, 5, 0, 0, 1692, 1691, 1, 0, 0, 0, 1692, 1693, 1, 0, 0, 0, 1693, 1695, 1, 0, 0, 0, 1694, 1696, 3, 397, 198, 0, 1695, 1694, 1, 0, 0, 0, 1696, 1697, 1, 0, 0, 0, 1697, 1695, 1, 0, 0, 0, 1697, 1698, 1, 0, 0, 0, 1698, 1700, 1, 0, 0, 0, 1699, 1690, 1, 0, 0, 0, 1699, 1700, 1, 0, 0, 0, 1700, 1710, 1, 0, 0, 0, 1701, 1702, 5, 48, 0, 0, 1702, 1703, 5, 120, 0, 0, 1703, 1705, 1, 0, 0, 0, 1704, 1706, 3, 395, 197, 0, 1705, 1704, 1, 0, 0, 0, 1706, 1707, 1, 0, 0, 0, 1707, 1705, 1, 0, 0, 0, 1707, 1708, 1, 0, 0, 0, 1708, 1710, 1, 0, 0, 0, 1709, 1688, 1, 0, 0, 0, 1709, 1701, 1, 0, 0, 0, 1710, 378, 1, 0, 0, 0, 1711, 1715, 5, 63, 0, 0, 1712, 1714, 3, 397, 198, 0, 1713, 1712, 1, 0, 0, 0, 1714, 1717, 1, 0, 0, 0, 1715, 1713, 1, 0, 0, 0, 1715, 1716, 1, 0, 0, 0, 1716, 380, 1, 0, 0, 0, 1717, 1715, 1, 0, 0, 0, 1718, 1719, 7, 6, 0, 0, 1719, 1720, 3, 375, 187, 0, 1720, 382, 1, 0, 0, 0, 1721, 1727, 5, 39, 0, 0, 1722, 1726, 8, 7, 0, 0, 1723, 1724, 5, 39, 0, 0, 1724, 1726, 5, 39, 0, 0, 1725, 1722, 1, 0, 0, 0, 1725, 1723, 1, 0, 0, 0, 1726, 1729, 1, 0, 0, 0, 1727, 1725, 1, 0, 0, 0, 1727, 1728, 1, 0, 0, 0, 1728, 1730, 1, 0, 0, 0, 1729, 1727, 1, 0, 0, 0, 1730, 1731, 5, 39, 0, 0, 1731, 384, 1, 0, 0, 0, 1732, 1733, 3, 445, 222, 0, 1733, 1734, 3, 383, 191, 0, 1734, 386, 1, 0, 0, 0, 1735, 1736, 5, 45, 0, 0, 1736, 1737, 5, 45, 0, 0, 1737, 1741, 1, 0, 0, 0, 1738, 1740, 8, 8, 0, 0, 1739, 1738, 1, 0, 0, 0, 1740, 1743, 1, 0, 0, 0, 1741, 1739, 1, 0, 0, 0, 1741, 1742, 1, 0, 0, 0, 1742, 1749, 1, 0, 0, 0, 1743, 1741, 1, 0, 0, 0, 1744, 1746, 5, 13, 0, 0, 1745, 1744, 1, 0, 0, 0, 1745, 1746, 1, 0, 0, 0, 1746, 1747, 1, 0, 0, 0, 1747, 1750, 5, 10, 0, 0, 1748, 1750, 5, 0, 0, 1, 1749, 1745, 1, 0, 0, 0, 1749, 1748, 1, 0, 0, 0, 1750, 1751, 1, 0, 0, 0, 1751, 1752, 6, 193, 0, 0, 1752, 388, 1, 0, 0, 0, 1753, 1754, 5, 47, 0, 0, 1754, 1755, 5, 42, 0, 0, 1755, 1759, 1, 0, 0, 0, 1756, 1758, 9, 0, 0, 0, 1757, 1756, 1, 0, 0, 0, 1758, 1761, 1, 0, 0, 0, 1759, 1760, 1, 0, 0, 0, 1759, 1757, 1, 0, 0, 0, 1760, 1762, 1, 0, 0, 0, 1761, 1759, 1, 0, 0, 0, 1762, 1763, 5, 42, 0, 0, 1763, 1764, 5, 47, 0, 0, 1764, 1765, 1, 0, 0, 0, 1765, 1766, 6, 194, 0, 0, 1766, 390, 1, 0, 0, 0, 1767, 1768, 7, 9, 0, 0, 1768, 1769, 1, 0, 0, 0, 1769, 1770, 6, 195, 0, 0, 1770, 392, 1, 0, 0, 0, 1771, 1772, 9, 0, 0, 0, 1772, 394, 1, 0, 0, 0, 1773, 1774, 7, 10, 0, 0, 1774, 396, 1, 0, 0, 0, 1775, 1776, 7, 11, 0, 0, 1776, 398, 1, 0, 0, 0, 1777, 1778, 7, 12, 0, 0, 1778, 400, 1, 0, 0, 0, 1779, 1780, 7, 13, 0, 0, 1780, 402, 1, 0, 0, 0, 1781, 1782, 7, 14, 0, 0, 1782, 404, 1, 0, 0, 0, 1783, 1784, 7, 15, 0, 0, 1784, 406, 1, 0, 0, 0, 1785, 1786, 7, 16, 0, 0, 1786, 408, 1, 0, 0, 0, 1787, 1788, 7, 17, 0, 0, 1788, 410, 1, 0, 0, 0, 1789, 1790, 7, 18, 0, 0, 1790, 412, 1, 0, 0, 0, 1791, 1792, 7, 19, 0, 0, 1792, 414, 1, 0, 0, 0, 1793, 1794, 7, 20, 0, 0, 1794, 416, 1, 0, 0, 0, 1795, 1796, 7, 21, 0, 0, 1796, 418, 1, 0, 0, 0, 1797, 1798, 7, 22, 0, 0, 1798, 420, 1, 0, 0, 0, 1799, 1800, 7, 23, 0, 0, 1800, 422, 1, 0, 0, 0, 1801, 1802, 7, 24, 0, 0, 1802, 424, 1, 0, 0, 0, 1803, 1804, 7, 25, 0, 0, 1804, 426, 1, 0, 0, 0, 1805, 1806, 7, 26, 0, 0, 1806, 428, 1, 0, 0, 0, 1807, 1808, 7, 27, 0, 0, 1808, 430, 1, 0, 0, 0, 1809, 1810, 7, 28, 0, 0, 1810, 432, 1, 0, 0, 0, 1811, 1812, 7, 29, 0, 0, 1812, 434, 1, 0, 0, 0, 1813, 1814, 7, 30, 0, 0, 1814, 436, 1, 0, 0, 0, 1815, 1816, 7, 31, 0, 0, 1816, 438, 1, 0, 0, 0, 1817, 1818, 7, 32, 0, 0, 1818, 440, 1, 0, 0, 0, 1819, 1820, 7, 33, 0, 0, 1820, 442, 1, 0, 0, 0, 1821, 1822, 7, 34, 0, 0, 1822, 444, 1, 0, 0, 0, 1823, 1824, 7, 35, 0, 0, 1824, 446, 1, 0, 0, 0, 1825, 1826, 7, 36, 0, 0, 1826, 448, 1, 0, 0, 0, 1827, 1828, 7, 37, 0, 0, 1828, 450, 1, 0, 0, 0, 25, 0, 1635, 1637, 1645, 1647, 1655, 1663, 1666, 1671, 1677, 1680, 1686, 1688, 1692, 1697, 1699, 1707, 1709, 1715, 1725, 1727, 1741, 1745, 1749, 1759, 1, 0, 1, 0] \ No newline at end of file diff --git a/internal/engine/sqlite/parser/SQLiteLexer.tokens b/internal/engine/sqlite/parser/SQLiteLexer.tokens index 928604c851..6777c57bdc 100644 --- a/internal/engine/sqlite/parser/SQLiteLexer.tokens +++ b/internal/engine/sqlite/parser/SQLiteLexer.tokens @@ -6,193 +6,195 @@ COMMA=5 ASSIGN=6 STAR=7 PLUS=8 -MINUS=9 -TILDE=10 -PIPE2=11 -DIV=12 -MOD=13 -LT2=14 -GT2=15 -AMP=16 -PIPE=17 -LT=18 -LT_EQ=19 -GT=20 -GT_EQ=21 -EQ=22 -NOT_EQ1=23 -NOT_EQ2=24 -ABORT_=25 -ACTION_=26 -ADD_=27 -AFTER_=28 -ALL_=29 -ALTER_=30 -ANALYZE_=31 -AND_=32 -AS_=33 -ASC_=34 -ATTACH_=35 -AUTOINCREMENT_=36 -BEFORE_=37 -BEGIN_=38 -BETWEEN_=39 -BY_=40 -CASCADE_=41 -CASE_=42 -CAST_=43 -CHECK_=44 -COLLATE_=45 -COLUMN_=46 -COMMIT_=47 -CONFLICT_=48 -CONSTRAINT_=49 -CREATE_=50 -CROSS_=51 -CURRENT_DATE_=52 -CURRENT_TIME_=53 -CURRENT_TIMESTAMP_=54 -DATABASE_=55 -DEFAULT_=56 -DEFERRABLE_=57 -DEFERRED_=58 -DELETE_=59 -DESC_=60 -DETACH_=61 -DISTINCT_=62 -DROP_=63 -EACH_=64 -ELSE_=65 -END_=66 -ESCAPE_=67 -EXCEPT_=68 -EXCLUSIVE_=69 -EXISTS_=70 -EXPLAIN_=71 -FAIL_=72 -FOR_=73 -FOREIGN_=74 -FROM_=75 -FULL_=76 -GLOB_=77 -GROUP_=78 -HAVING_=79 -IF_=80 -IGNORE_=81 -IMMEDIATE_=82 -IN_=83 -INDEX_=84 -INDEXED_=85 -INITIALLY_=86 -INNER_=87 -INSERT_=88 -INSTEAD_=89 -INTERSECT_=90 -INTO_=91 -IS_=92 -ISNULL_=93 -JOIN_=94 -KEY_=95 -LEFT_=96 -LIKE_=97 -LIMIT_=98 -MATCH_=99 -NATURAL_=100 -NO_=101 -NOT_=102 -NOTNULL_=103 -NULL_=104 -OF_=105 -OFFSET_=106 -ON_=107 -OR_=108 -ORDER_=109 -OUTER_=110 -PLAN_=111 -PRAGMA_=112 -PRIMARY_=113 -QUERY_=114 -RAISE_=115 -RECURSIVE_=116 -REFERENCES_=117 -REGEXP_=118 -REINDEX_=119 -RELEASE_=120 -RENAME_=121 -REPLACE_=122 -RESTRICT_=123 -RETURNING_=124 -RIGHT_=125 -ROLLBACK_=126 -ROW_=127 -ROWS_=128 -SAVEPOINT_=129 -SELECT_=130 -SET_=131 -STRICT_=132 -TABLE_=133 -TEMP_=134 -TEMPORARY_=135 -THEN_=136 -TO_=137 -TRANSACTION_=138 -TRIGGER_=139 -UNION_=140 -UNIQUE_=141 -UPDATE_=142 -USING_=143 -VACUUM_=144 -VALUES_=145 -VIEW_=146 -VIRTUAL_=147 -WHEN_=148 -WHERE_=149 -WITH_=150 -WITHOUT_=151 -FIRST_VALUE_=152 -OVER_=153 -PARTITION_=154 -RANGE_=155 -PRECEDING_=156 -UNBOUNDED_=157 -CURRENT_=158 -FOLLOWING_=159 -CUME_DIST_=160 -DENSE_RANK_=161 -LAG_=162 -LAST_VALUE_=163 -LEAD_=164 -NTH_VALUE_=165 -NTILE_=166 -PERCENT_RANK_=167 -RANK_=168 -ROW_NUMBER_=169 -GENERATED_=170 -ALWAYS_=171 -STORED_=172 -TRUE_=173 -FALSE_=174 -WINDOW_=175 -NULLS_=176 -FIRST_=177 -LAST_=178 -FILTER_=179 -GROUPS_=180 -EXCLUDE_=181 -TIES_=182 -OTHERS_=183 -DO_=184 -NOTHING_=185 -IDENTIFIER=186 -NUMERIC_LITERAL=187 -NUMBERED_BIND_PARAMETER=188 -NAMED_BIND_PARAMETER=189 -STRING_LITERAL=190 -BLOB_LITERAL=191 -SINGLE_LINE_COMMENT=192 -MULTILINE_COMMENT=193 -SPACES=194 -UNEXPECTED_CHAR=195 +PTR2=9 +PTR=10 +MINUS=11 +TILDE=12 +PIPE2=13 +DIV=14 +MOD=15 +LT2=16 +GT2=17 +AMP=18 +PIPE=19 +LT=20 +LT_EQ=21 +GT=22 +GT_EQ=23 +EQ=24 +NOT_EQ1=25 +NOT_EQ2=26 +ABORT_=27 +ACTION_=28 +ADD_=29 +AFTER_=30 +ALL_=31 +ALTER_=32 +ANALYZE_=33 +AND_=34 +AS_=35 +ASC_=36 +ATTACH_=37 +AUTOINCREMENT_=38 +BEFORE_=39 +BEGIN_=40 +BETWEEN_=41 +BY_=42 +CASCADE_=43 +CASE_=44 +CAST_=45 +CHECK_=46 +COLLATE_=47 +COLUMN_=48 +COMMIT_=49 +CONFLICT_=50 +CONSTRAINT_=51 +CREATE_=52 +CROSS_=53 +CURRENT_DATE_=54 +CURRENT_TIME_=55 +CURRENT_TIMESTAMP_=56 +DATABASE_=57 +DEFAULT_=58 +DEFERRABLE_=59 +DEFERRED_=60 +DELETE_=61 +DESC_=62 +DETACH_=63 +DISTINCT_=64 +DROP_=65 +EACH_=66 +ELSE_=67 +END_=68 +ESCAPE_=69 +EXCEPT_=70 +EXCLUSIVE_=71 +EXISTS_=72 +EXPLAIN_=73 +FAIL_=74 +FOR_=75 +FOREIGN_=76 +FROM_=77 +FULL_=78 +GLOB_=79 +GROUP_=80 +HAVING_=81 +IF_=82 +IGNORE_=83 +IMMEDIATE_=84 +IN_=85 +INDEX_=86 +INDEXED_=87 +INITIALLY_=88 +INNER_=89 +INSERT_=90 +INSTEAD_=91 +INTERSECT_=92 +INTO_=93 +IS_=94 +ISNULL_=95 +JOIN_=96 +KEY_=97 +LEFT_=98 +LIKE_=99 +LIMIT_=100 +MATCH_=101 +NATURAL_=102 +NO_=103 +NOT_=104 +NOTNULL_=105 +NULL_=106 +OF_=107 +OFFSET_=108 +ON_=109 +OR_=110 +ORDER_=111 +OUTER_=112 +PLAN_=113 +PRAGMA_=114 +PRIMARY_=115 +QUERY_=116 +RAISE_=117 +RECURSIVE_=118 +REFERENCES_=119 +REGEXP_=120 +REINDEX_=121 +RELEASE_=122 +RENAME_=123 +REPLACE_=124 +RESTRICT_=125 +RETURNING_=126 +RIGHT_=127 +ROLLBACK_=128 +ROW_=129 +ROWS_=130 +SAVEPOINT_=131 +SELECT_=132 +SET_=133 +STRICT_=134 +TABLE_=135 +TEMP_=136 +TEMPORARY_=137 +THEN_=138 +TO_=139 +TRANSACTION_=140 +TRIGGER_=141 +UNION_=142 +UNIQUE_=143 +UPDATE_=144 +USING_=145 +VACUUM_=146 +VALUES_=147 +VIEW_=148 +VIRTUAL_=149 +WHEN_=150 +WHERE_=151 +WITH_=152 +WITHOUT_=153 +FIRST_VALUE_=154 +OVER_=155 +PARTITION_=156 +RANGE_=157 +PRECEDING_=158 +UNBOUNDED_=159 +CURRENT_=160 +FOLLOWING_=161 +CUME_DIST_=162 +DENSE_RANK_=163 +LAG_=164 +LAST_VALUE_=165 +LEAD_=166 +NTH_VALUE_=167 +NTILE_=168 +PERCENT_RANK_=169 +RANK_=170 +ROW_NUMBER_=171 +GENERATED_=172 +ALWAYS_=173 +STORED_=174 +TRUE_=175 +FALSE_=176 +WINDOW_=177 +NULLS_=178 +FIRST_=179 +LAST_=180 +FILTER_=181 +GROUPS_=182 +EXCLUDE_=183 +TIES_=184 +OTHERS_=185 +DO_=186 +NOTHING_=187 +IDENTIFIER=188 +NUMERIC_LITERAL=189 +NUMBERED_BIND_PARAMETER=190 +NAMED_BIND_PARAMETER=191 +STRING_LITERAL=192 +BLOB_LITERAL=193 +SINGLE_LINE_COMMENT=194 +MULTILINE_COMMENT=195 +SPACES=196 +UNEXPECTED_CHAR=197 ';'=1 '.'=2 '('=3 @@ -201,19 +203,21 @@ UNEXPECTED_CHAR=195 '='=6 '*'=7 '+'=8 -'-'=9 -'~'=10 -'||'=11 -'/'=12 -'%'=13 -'<<'=14 -'>>'=15 -'&'=16 -'|'=17 -'<'=18 -'<='=19 -'>'=20 -'>='=21 -'=='=22 -'!='=23 -'<>'=24 +'->>'=9 +'->'=10 +'-'=11 +'~'=12 +'||'=13 +'/'=14 +'%'=15 +'<<'=16 +'>>'=17 +'&'=18 +'|'=19 +'<'=20 +'<='=21 +'>'=22 +'>='=23 +'=='=24 +'!='=25 +'<>'=26 diff --git a/internal/engine/sqlite/parser/SQLiteParser.g4 b/internal/engine/sqlite/parser/SQLiteParser.g4 index d141603cbc..14ca873687 100644 --- a/internal/engine/sqlite/parser/SQLiteParser.g4 +++ b/internal/engine/sqlite/parser/SQLiteParser.g4 @@ -282,8 +282,9 @@ expr: | ((schema_name DOT)? table_name DOT)? column_name #expr_qualified_column_name | unary_operator expr #expr_unary | expr PIPE2 expr #expr_binary - | expr ( STAR | DIV | MOD) expr #expr_math_op - | expr ( PLUS | MINUS) expr #expr_math_op + | expr ( PTR | PTR2 ) expr #expr_binary + | expr ( STAR | DIV | MOD) expr #expr_binary + | expr ( PLUS | MINUS) expr #expr_binary | expr ( LT2 | GT2 | AMP | PIPE) expr #expr_comparison | expr ( LT | LT_EQ | GT | GT_EQ) expr #expr_comparison | expr ( @@ -304,8 +305,8 @@ expr: | ( schema_name DOT)? table_name | (schema_name DOT)? table_function_name OPEN_PAR (expr (COMMA expr)*)? CLOSE_PAR ) #expr_in_select - | expr AND_ expr #expr_binary - | expr OR_ expr #expr_binary + | expr AND_ expr #expr_bool + | expr OR_ expr #expr_bool | qualified_function_name OPEN_PAR ((DISTINCT_? expr ( COMMA expr)*) | STAR)? CLOSE_PAR filter_clause? over_clause? #expr_function | OPEN_PAR expr (COMMA expr)* CLOSE_PAR #expr_list | CAST_ OPEN_PAR expr AS_ type_name CLOSE_PAR #expr_cast @@ -358,9 +359,9 @@ insert_stmt: COMMA OPEN_PAR expr ( COMMA expr)* CLOSE_PAR )* | select_stmt + | DEFAULT_ VALUES_ ) upsert_clause? returning_clause? ) - | DEFAULT_ VALUES_ ; upsert_clause: diff --git a/internal/engine/sqlite/parser/SQLiteParser.interp b/internal/engine/sqlite/parser/SQLiteParser.interp index 2617e0bc04..7a268aa1a8 100644 --- a/internal/engine/sqlite/parser/SQLiteParser.interp +++ b/internal/engine/sqlite/parser/SQLiteParser.interp @@ -8,6 +8,8 @@ null '=' '*' '+' +'->>' +'->' '-' '~' '||' @@ -206,6 +208,8 @@ COMMA ASSIGN STAR PLUS +PTR2 +PTR MINUS TILDE PIPE2 @@ -513,4 +517,4 @@ any_name atn: -[4, 1, 195, 2175, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, 7, 83, 2, 84, 7, 84, 2, 85, 7, 85, 2, 86, 7, 86, 2, 87, 7, 87, 2, 88, 7, 88, 2, 89, 7, 89, 2, 90, 7, 90, 2, 91, 7, 91, 2, 92, 7, 92, 2, 93, 7, 93, 2, 94, 7, 94, 2, 95, 7, 95, 2, 96, 7, 96, 2, 97, 7, 97, 2, 98, 7, 98, 2, 99, 7, 99, 2, 100, 7, 100, 2, 101, 7, 101, 2, 102, 7, 102, 2, 103, 7, 103, 2, 104, 7, 104, 2, 105, 7, 105, 2, 106, 7, 106, 2, 107, 7, 107, 2, 108, 7, 108, 2, 109, 7, 109, 2, 110, 7, 110, 2, 111, 7, 111, 2, 112, 7, 112, 2, 113, 7, 113, 2, 114, 7, 114, 1, 0, 5, 0, 232, 8, 0, 10, 0, 12, 0, 235, 9, 0, 1, 0, 1, 0, 1, 1, 5, 1, 240, 8, 1, 10, 1, 12, 1, 243, 9, 1, 1, 1, 1, 1, 4, 1, 247, 8, 1, 11, 1, 12, 1, 248, 1, 1, 5, 1, 252, 8, 1, 10, 1, 12, 1, 255, 9, 1, 1, 1, 5, 1, 258, 8, 1, 10, 1, 12, 1, 261, 9, 1, 1, 2, 1, 2, 1, 2, 3, 2, 266, 8, 2, 3, 2, 268, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 294, 8, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 301, 8, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 308, 8, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 314, 8, 3, 1, 3, 1, 3, 3, 3, 318, 8, 3, 1, 3, 1, 3, 1, 3, 3, 3, 323, 8, 3, 1, 3, 3, 3, 326, 8, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 333, 8, 4, 1, 4, 3, 4, 336, 8, 4, 1, 5, 1, 5, 3, 5, 340, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 3, 6, 348, 8, 6, 1, 6, 1, 6, 3, 6, 352, 8, 6, 3, 6, 354, 8, 6, 1, 7, 1, 7, 3, 7, 358, 8, 7, 1, 8, 1, 8, 3, 8, 362, 8, 8, 1, 8, 1, 8, 3, 8, 366, 8, 8, 1, 8, 3, 8, 369, 8, 8, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 3, 10, 376, 8, 10, 1, 10, 1, 10, 1, 11, 1, 11, 3, 11, 382, 8, 11, 1, 11, 1, 11, 1, 11, 1, 11, 3, 11, 388, 8, 11, 1, 11, 1, 11, 1, 11, 3, 11, 393, 8, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 5, 11, 402, 8, 11, 10, 11, 12, 11, 405, 9, 11, 1, 11, 1, 11, 1, 11, 3, 11, 410, 8, 11, 1, 12, 1, 12, 3, 12, 414, 8, 12, 1, 12, 1, 12, 3, 12, 418, 8, 12, 1, 12, 3, 12, 421, 8, 12, 1, 13, 1, 13, 1, 13, 3, 13, 426, 8, 13, 1, 14, 1, 14, 3, 14, 430, 8, 14, 1, 14, 1, 14, 1, 14, 1, 14, 3, 14, 436, 8, 14, 1, 14, 1, 14, 1, 14, 3, 14, 441, 8, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 5, 14, 448, 8, 14, 10, 14, 12, 14, 451, 9, 14, 1, 14, 1, 14, 5, 14, 455, 8, 14, 10, 14, 12, 14, 458, 9, 14, 1, 14, 1, 14, 1, 14, 1, 14, 5, 14, 464, 8, 14, 10, 14, 12, 14, 467, 9, 14, 3, 14, 469, 8, 14, 1, 14, 1, 14, 3, 14, 473, 8, 14, 1, 15, 1, 15, 3, 15, 477, 8, 15, 1, 15, 5, 15, 480, 8, 15, 10, 15, 12, 15, 483, 9, 15, 1, 16, 4, 16, 486, 8, 16, 11, 16, 12, 16, 487, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 3, 16, 500, 8, 16, 1, 17, 1, 17, 3, 17, 504, 8, 17, 1, 17, 1, 17, 1, 17, 3, 17, 509, 8, 17, 1, 17, 3, 17, 512, 8, 17, 1, 17, 3, 17, 515, 8, 17, 1, 17, 1, 17, 1, 17, 3, 17, 520, 8, 17, 1, 17, 3, 17, 523, 8, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 537, 8, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 544, 8, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 551, 8, 17, 3, 17, 553, 8, 17, 1, 18, 3, 18, 556, 8, 18, 1, 18, 1, 18, 1, 19, 1, 19, 3, 19, 562, 8, 19, 1, 19, 1, 19, 1, 19, 3, 19, 567, 8, 19, 1, 19, 1, 19, 1, 19, 1, 19, 5, 19, 573, 8, 19, 10, 19, 12, 19, 576, 9, 19, 1, 19, 1, 19, 3, 19, 580, 8, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 5, 19, 593, 8, 19, 10, 19, 12, 19, 596, 9, 19, 1, 19, 1, 19, 1, 19, 3, 19, 601, 8, 19, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 5, 20, 609, 8, 20, 10, 20, 12, 20, 612, 9, 20, 1, 20, 1, 20, 3, 20, 616, 8, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 3, 20, 626, 8, 20, 1, 20, 1, 20, 5, 20, 630, 8, 20, 10, 20, 12, 20, 633, 9, 20, 1, 20, 3, 20, 636, 8, 20, 1, 20, 1, 20, 1, 20, 3, 20, 641, 8, 20, 3, 20, 643, 8, 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 22, 1, 22, 3, 22, 651, 8, 22, 1, 22, 1, 22, 1, 22, 1, 22, 3, 22, 657, 8, 22, 1, 22, 1, 22, 1, 22, 3, 22, 662, 8, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 3, 22, 669, 8, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 5, 22, 678, 8, 22, 10, 22, 12, 22, 681, 9, 22, 3, 22, 683, 8, 22, 3, 22, 685, 8, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 3, 22, 692, 8, 22, 1, 22, 1, 22, 3, 22, 696, 8, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 3, 22, 703, 8, 22, 1, 22, 1, 22, 4, 22, 707, 8, 22, 11, 22, 12, 22, 708, 1, 22, 1, 22, 1, 23, 1, 23, 3, 23, 715, 8, 23, 1, 23, 1, 23, 1, 23, 1, 23, 3, 23, 721, 8, 23, 1, 23, 1, 23, 1, 23, 3, 23, 726, 8, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 5, 23, 733, 8, 23, 10, 23, 12, 23, 736, 9, 23, 1, 23, 1, 23, 3, 23, 740, 8, 23, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 3, 24, 751, 8, 24, 1, 24, 1, 24, 1, 24, 3, 24, 756, 8, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 5, 24, 765, 8, 24, 10, 24, 12, 24, 768, 9, 24, 1, 24, 1, 24, 3, 24, 772, 8, 24, 1, 25, 1, 25, 3, 25, 776, 8, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 5, 25, 790, 8, 25, 10, 25, 12, 25, 793, 9, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 5, 26, 800, 8, 26, 10, 26, 12, 26, 803, 9, 26, 1, 26, 1, 26, 3, 26, 807, 8, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 3, 27, 815, 8, 27, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 5, 28, 825, 8, 28, 10, 28, 12, 28, 828, 9, 28, 1, 28, 1, 28, 3, 28, 832, 8, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 29, 1, 29, 1, 29, 1, 29, 3, 29, 843, 8, 29, 1, 29, 3, 29, 846, 8, 29, 3, 29, 848, 8, 29, 1, 29, 1, 29, 1, 29, 1, 29, 3, 29, 854, 8, 29, 1, 29, 3, 29, 857, 8, 29, 3, 29, 859, 8, 29, 5, 29, 861, 8, 29, 10, 29, 12, 29, 864, 9, 29, 1, 30, 3, 30, 867, 8, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 3, 30, 874, 8, 30, 1, 30, 3, 30, 877, 8, 30, 1, 31, 3, 31, 880, 8, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 3, 31, 887, 8, 31, 1, 31, 3, 31, 890, 8, 31, 1, 31, 3, 31, 893, 8, 31, 1, 31, 3, 31, 896, 8, 31, 1, 32, 1, 32, 3, 32, 900, 8, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 33, 3, 33, 908, 8, 33, 1, 33, 1, 33, 1, 33, 3, 33, 913, 8, 33, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 924, 8, 34, 1, 34, 1, 34, 1, 34, 3, 34, 929, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 938, 8, 34, 1, 34, 1, 34, 1, 34, 5, 34, 943, 8, 34, 10, 34, 12, 34, 946, 9, 34, 1, 34, 3, 34, 949, 8, 34, 1, 34, 1, 34, 3, 34, 953, 8, 34, 1, 34, 3, 34, 956, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 5, 34, 962, 8, 34, 10, 34, 12, 34, 965, 9, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 977, 8, 34, 1, 34, 3, 34, 980, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 988, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 4, 34, 995, 8, 34, 11, 34, 12, 34, 996, 1, 34, 1, 34, 3, 34, 1001, 8, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1006, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1032, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1039, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1050, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1059, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 5, 34, 1067, 8, 34, 10, 34, 12, 34, 1070, 9, 34, 3, 34, 1072, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1078, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1084, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 5, 34, 1091, 8, 34, 10, 34, 12, 34, 1094, 9, 34, 3, 34, 1096, 8, 34, 1, 34, 1, 34, 3, 34, 1100, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1107, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1113, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1120, 8, 34, 5, 34, 1122, 8, 34, 10, 34, 12, 34, 1125, 9, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 3, 35, 1133, 8, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 37, 3, 37, 1140, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 1147, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 1153, 8, 37, 1, 37, 1, 37, 1, 37, 3, 37, 1158, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 5, 37, 1164, 8, 37, 10, 37, 12, 37, 1167, 9, 37, 1, 37, 1, 37, 3, 37, 1171, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 5, 37, 1178, 8, 37, 10, 37, 12, 37, 1181, 9, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 5, 37, 1189, 8, 37, 10, 37, 12, 37, 1192, 9, 37, 1, 37, 1, 37, 5, 37, 1196, 8, 37, 10, 37, 12, 37, 1199, 9, 37, 1, 37, 3, 37, 1202, 8, 37, 1, 37, 3, 37, 1205, 8, 37, 1, 37, 3, 37, 1208, 8, 37, 1, 37, 1, 37, 3, 37, 1212, 8, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 5, 38, 1220, 8, 38, 10, 38, 12, 38, 1223, 9, 38, 1, 38, 1, 38, 1, 38, 3, 38, 1228, 8, 38, 3, 38, 1230, 8, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 1238, 8, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 1245, 8, 38, 1, 38, 1, 38, 1, 38, 5, 38, 1250, 8, 38, 10, 38, 12, 38, 1253, 9, 38, 1, 38, 1, 38, 3, 38, 1257, 8, 38, 3, 38, 1259, 8, 38, 1, 39, 1, 39, 1, 39, 1, 39, 3, 39, 1265, 8, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 3, 39, 1274, 8, 39, 1, 40, 1, 40, 1, 40, 3, 40, 1279, 8, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 3, 41, 1286, 8, 41, 1, 41, 1, 41, 3, 41, 1290, 8, 41, 3, 41, 1292, 8, 41, 1, 42, 3, 42, 1295, 8, 42, 1, 42, 1, 42, 1, 42, 1, 42, 5, 42, 1301, 8, 42, 10, 42, 12, 42, 1304, 9, 42, 1, 42, 3, 42, 1307, 8, 42, 1, 42, 3, 42, 1310, 8, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 5, 43, 1317, 8, 43, 10, 43, 12, 43, 1320, 9, 43, 1, 44, 1, 44, 3, 44, 1324, 8, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1329, 8, 44, 10, 44, 12, 44, 1332, 9, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1338, 8, 44, 10, 44, 12, 44, 1341, 9, 44, 1, 44, 3, 44, 1344, 8, 44, 3, 44, 1346, 8, 44, 1, 44, 1, 44, 3, 44, 1350, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1357, 8, 44, 10, 44, 12, 44, 1360, 9, 44, 1, 44, 1, 44, 3, 44, 1364, 8, 44, 3, 44, 1366, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1377, 8, 44, 10, 44, 12, 44, 1380, 9, 44, 3, 44, 1382, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1389, 8, 44, 10, 44, 12, 44, 1392, 9, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1400, 8, 44, 10, 44, 12, 44, 1403, 9, 44, 1, 44, 1, 44, 5, 44, 1407, 8, 44, 10, 44, 12, 44, 1410, 9, 44, 3, 44, 1412, 8, 44, 1, 45, 1, 45, 1, 46, 3, 46, 1417, 8, 46, 1, 46, 1, 46, 3, 46, 1421, 8, 46, 1, 46, 3, 46, 1424, 8, 46, 1, 47, 3, 47, 1427, 8, 47, 1, 47, 1, 47, 1, 47, 3, 47, 1432, 8, 47, 1, 47, 1, 47, 3, 47, 1436, 8, 47, 1, 47, 4, 47, 1439, 8, 47, 11, 47, 12, 47, 1440, 1, 47, 3, 47, 1444, 8, 47, 1, 47, 3, 47, 1447, 8, 47, 1, 48, 1, 48, 1, 48, 3, 48, 1452, 8, 48, 1, 48, 1, 48, 3, 48, 1456, 8, 48, 1, 48, 3, 48, 1459, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1466, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1471, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1478, 8, 48, 10, 48, 12, 48, 1481, 9, 48, 1, 48, 1, 48, 3, 48, 1485, 8, 48, 1, 48, 3, 48, 1488, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1494, 8, 48, 10, 48, 12, 48, 1497, 9, 48, 1, 48, 3, 48, 1500, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1508, 8, 48, 1, 48, 3, 48, 1511, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1516, 8, 48, 1, 48, 1, 48, 3, 48, 1520, 8, 48, 1, 48, 3, 48, 1523, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1530, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1535, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1542, 8, 48, 10, 48, 12, 48, 1545, 9, 48, 1, 48, 1, 48, 3, 48, 1549, 8, 48, 1, 48, 3, 48, 1552, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1558, 8, 48, 10, 48, 12, 48, 1561, 9, 48, 1, 48, 3, 48, 1564, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1572, 8, 48, 1, 48, 3, 48, 1575, 8, 48, 3, 48, 1577, 8, 48, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 3, 49, 1586, 8, 49, 1, 49, 3, 49, 1589, 8, 49, 3, 49, 1591, 8, 49, 1, 50, 1, 50, 3, 50, 1595, 8, 50, 1, 50, 1, 50, 3, 50, 1599, 8, 50, 1, 50, 3, 50, 1602, 8, 50, 1, 50, 1, 50, 1, 50, 3, 50, 1607, 8, 50, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 5, 51, 1616, 8, 51, 10, 51, 12, 51, 1619, 9, 51, 1, 51, 1, 51, 3, 51, 1623, 8, 51, 1, 52, 1, 52, 3, 52, 1627, 8, 52, 1, 52, 1, 52, 3, 52, 1631, 8, 52, 1, 53, 3, 53, 1634, 8, 53, 1, 53, 1, 53, 1, 53, 3, 53, 1639, 8, 53, 1, 53, 1, 53, 1, 53, 1, 53, 3, 53, 1645, 8, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 3, 53, 1652, 8, 53, 1, 53, 1, 53, 1, 53, 5, 53, 1657, 8, 53, 10, 53, 12, 53, 1660, 9, 53, 1, 53, 1, 53, 3, 53, 1664, 8, 53, 1, 53, 3, 53, 1667, 8, 53, 1, 54, 1, 54, 1, 54, 1, 54, 5, 54, 1673, 8, 54, 10, 54, 12, 54, 1676, 9, 54, 1, 54, 1, 54, 1, 55, 3, 55, 1681, 8, 55, 1, 55, 1, 55, 1, 55, 3, 55, 1686, 8, 55, 1, 55, 1, 55, 1, 55, 1, 55, 3, 55, 1692, 8, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 3, 55, 1699, 8, 55, 1, 55, 1, 55, 1, 55, 5, 55, 1704, 8, 55, 10, 55, 12, 55, 1707, 9, 55, 1, 55, 1, 55, 3, 55, 1711, 8, 55, 1, 55, 3, 55, 1714, 8, 55, 1, 55, 3, 55, 1717, 8, 55, 1, 56, 1, 56, 1, 56, 3, 56, 1722, 8, 56, 1, 56, 1, 56, 1, 56, 3, 56, 1727, 8, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 3, 56, 1734, 8, 56, 1, 57, 1, 57, 3, 57, 1738, 8, 57, 1, 57, 1, 57, 3, 57, 1742, 8, 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 3, 59, 1752, 8, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 5, 59, 1759, 8, 59, 10, 59, 12, 59, 1762, 9, 59, 3, 59, 1764, 8, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 5, 59, 1771, 8, 59, 10, 59, 12, 59, 1774, 9, 59, 1, 59, 3, 59, 1777, 8, 59, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 60, 3, 60, 1785, 8, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 5, 60, 1792, 8, 60, 10, 60, 12, 60, 1795, 9, 60, 3, 60, 1797, 8, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 5, 60, 1804, 8, 60, 10, 60, 12, 60, 1807, 9, 60, 3, 60, 1809, 8, 60, 1, 60, 3, 60, 1812, 8, 60, 1, 60, 3, 60, 1815, 8, 60, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 3, 61, 1825, 8, 61, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 3, 62, 1834, 8, 62, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 5, 63, 1841, 8, 63, 10, 63, 12, 63, 1844, 9, 63, 1, 63, 3, 63, 1847, 8, 63, 1, 63, 1, 63, 1, 64, 1, 64, 1, 64, 3, 64, 1854, 8, 64, 1, 64, 1, 64, 1, 64, 5, 64, 1859, 8, 64, 10, 64, 12, 64, 1862, 9, 64, 1, 64, 3, 64, 1865, 8, 64, 1, 64, 1, 64, 3, 64, 1869, 8, 64, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 5, 65, 1876, 8, 65, 10, 65, 12, 65, 1879, 9, 65, 1, 65, 3, 65, 1882, 8, 65, 1, 65, 1, 65, 3, 65, 1886, 8, 65, 1, 65, 1, 65, 1, 65, 3, 65, 1891, 8, 65, 1, 66, 1, 66, 3, 66, 1895, 8, 66, 1, 66, 1, 66, 1, 66, 5, 66, 1900, 8, 66, 10, 66, 12, 66, 1903, 9, 66, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 5, 67, 1910, 8, 67, 10, 67, 12, 67, 1913, 9, 67, 1, 68, 1, 68, 1, 68, 1, 68, 3, 68, 1919, 8, 68, 1, 69, 1, 69, 1, 69, 3, 69, 1924, 8, 69, 1, 69, 3, 69, 1927, 8, 69, 1, 69, 1, 69, 3, 69, 1931, 8, 69, 1, 70, 1, 70, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 3, 71, 1945, 8, 71, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 3, 72, 1957, 8, 72, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 3, 73, 1966, 8, 73, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 1975, 8, 74, 1, 74, 1, 74, 3, 74, 1979, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 1989, 8, 74, 1, 74, 3, 74, 1992, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2001, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2010, 8, 74, 1, 74, 3, 74, 2013, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2019, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2033, 8, 74, 1, 74, 1, 74, 3, 74, 2037, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2048, 8, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2053, 8, 74, 1, 75, 1, 75, 1, 75, 1, 76, 1, 76, 1, 76, 1, 77, 1, 77, 1, 77, 4, 77, 2064, 8, 77, 11, 77, 12, 77, 2065, 1, 78, 1, 78, 1, 78, 4, 78, 2071, 8, 78, 11, 78, 12, 78, 2072, 1, 79, 1, 79, 1, 79, 1, 79, 1, 80, 1, 80, 3, 80, 2081, 8, 80, 1, 80, 1, 80, 1, 80, 3, 80, 2086, 8, 80, 5, 80, 2088, 8, 80, 10, 80, 12, 80, 2091, 9, 80, 1, 81, 1, 81, 1, 82, 1, 82, 1, 83, 1, 83, 1, 84, 1, 84, 1, 85, 1, 85, 3, 85, 2103, 8, 85, 1, 86, 1, 86, 1, 87, 1, 87, 1, 88, 1, 88, 1, 89, 1, 89, 1, 90, 1, 90, 1, 90, 3, 90, 2116, 8, 90, 1, 90, 1, 90, 1, 91, 1, 91, 1, 92, 1, 92, 1, 93, 1, 93, 1, 94, 1, 94, 1, 95, 1, 95, 1, 96, 1, 96, 1, 97, 1, 97, 1, 98, 1, 98, 1, 99, 1, 99, 1, 100, 1, 100, 1, 101, 1, 101, 1, 102, 1, 102, 1, 103, 1, 103, 1, 104, 1, 104, 1, 105, 1, 105, 1, 106, 1, 106, 1, 107, 1, 107, 1, 108, 1, 108, 1, 109, 1, 109, 1, 110, 1, 110, 1, 111, 1, 111, 1, 112, 1, 112, 1, 113, 1, 113, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 3, 114, 2173, 8, 114, 1, 114, 2, 449, 487, 1, 68, 115, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 0, 29, 3, 0, 58, 58, 69, 69, 82, 82, 2, 0, 47, 47, 66, 66, 1, 0, 134, 135, 2, 0, 147, 147, 172, 172, 1, 0, 8, 9, 2, 0, 59, 59, 142, 142, 2, 0, 56, 56, 104, 104, 2, 0, 58, 58, 82, 82, 5, 0, 25, 25, 72, 72, 81, 81, 122, 122, 126, 126, 4, 0, 84, 84, 133, 133, 139, 139, 146, 146, 2, 0, 7, 7, 12, 13, 1, 0, 14, 17, 1, 0, 18, 21, 4, 0, 77, 77, 97, 97, 99, 99, 118, 118, 3, 0, 25, 25, 72, 72, 126, 126, 5, 0, 52, 54, 104, 104, 173, 174, 187, 187, 190, 191, 2, 0, 29, 29, 62, 62, 3, 0, 76, 76, 96, 96, 125, 125, 3, 0, 128, 128, 155, 155, 180, 180, 2, 0, 5, 5, 106, 106, 1, 0, 177, 178, 2, 0, 34, 34, 60, 60, 2, 0, 152, 152, 163, 163, 2, 0, 160, 160, 167, 167, 2, 0, 161, 161, 168, 169, 2, 0, 162, 162, 164, 164, 2, 0, 8, 10, 102, 102, 2, 0, 186, 186, 190, 190, 1, 0, 25, 181, 2480, 0, 233, 1, 0, 0, 0, 2, 241, 1, 0, 0, 0, 4, 267, 1, 0, 0, 0, 6, 295, 1, 0, 0, 0, 8, 327, 1, 0, 0, 0, 10, 337, 1, 0, 0, 0, 12, 345, 1, 0, 0, 0, 14, 355, 1, 0, 0, 0, 16, 359, 1, 0, 0, 0, 18, 370, 1, 0, 0, 0, 20, 373, 1, 0, 0, 0, 22, 379, 1, 0, 0, 0, 24, 413, 1, 0, 0, 0, 26, 425, 1, 0, 0, 0, 28, 427, 1, 0, 0, 0, 30, 474, 1, 0, 0, 0, 32, 485, 1, 0, 0, 0, 34, 503, 1, 0, 0, 0, 36, 555, 1, 0, 0, 0, 38, 561, 1, 0, 0, 0, 40, 602, 1, 0, 0, 0, 42, 644, 1, 0, 0, 0, 44, 648, 1, 0, 0, 0, 46, 712, 1, 0, 0, 0, 48, 744, 1, 0, 0, 0, 50, 773, 1, 0, 0, 0, 52, 794, 1, 0, 0, 0, 54, 808, 1, 0, 0, 0, 56, 819, 1, 0, 0, 0, 58, 838, 1, 0, 0, 0, 60, 866, 1, 0, 0, 0, 62, 879, 1, 0, 0, 0, 64, 897, 1, 0, 0, 0, 66, 903, 1, 0, 0, 0, 68, 1005, 1, 0, 0, 0, 70, 1126, 1, 0, 0, 0, 72, 1136, 1, 0, 0, 0, 74, 1211, 1, 0, 0, 0, 76, 1213, 1, 0, 0, 0, 78, 1260, 1, 0, 0, 0, 80, 1278, 1, 0, 0, 0, 82, 1280, 1, 0, 0, 0, 84, 1294, 1, 0, 0, 0, 86, 1311, 1, 0, 0, 0, 88, 1411, 1, 0, 0, 0, 90, 1413, 1, 0, 0, 0, 92, 1416, 1, 0, 0, 0, 94, 1426, 1, 0, 0, 0, 96, 1576, 1, 0, 0, 0, 98, 1590, 1, 0, 0, 0, 100, 1606, 1, 0, 0, 0, 102, 1622, 1, 0, 0, 0, 104, 1630, 1, 0, 0, 0, 106, 1633, 1, 0, 0, 0, 108, 1668, 1, 0, 0, 0, 110, 1680, 1, 0, 0, 0, 112, 1721, 1, 0, 0, 0, 114, 1735, 1, 0, 0, 0, 116, 1743, 1, 0, 0, 0, 118, 1749, 1, 0, 0, 0, 120, 1780, 1, 0, 0, 0, 122, 1816, 1, 0, 0, 0, 124, 1826, 1, 0, 0, 0, 126, 1835, 1, 0, 0, 0, 128, 1850, 1, 0, 0, 0, 130, 1870, 1, 0, 0, 0, 132, 1892, 1, 0, 0, 0, 134, 1904, 1, 0, 0, 0, 136, 1914, 1, 0, 0, 0, 138, 1920, 1, 0, 0, 0, 140, 1932, 1, 0, 0, 0, 142, 1944, 1, 0, 0, 0, 144, 1956, 1, 0, 0, 0, 146, 1965, 1, 0, 0, 0, 148, 2052, 1, 0, 0, 0, 150, 2054, 1, 0, 0, 0, 152, 2057, 1, 0, 0, 0, 154, 2060, 1, 0, 0, 0, 156, 2067, 1, 0, 0, 0, 158, 2074, 1, 0, 0, 0, 160, 2078, 1, 0, 0, 0, 162, 2092, 1, 0, 0, 0, 164, 2094, 1, 0, 0, 0, 166, 2096, 1, 0, 0, 0, 168, 2098, 1, 0, 0, 0, 170, 2102, 1, 0, 0, 0, 172, 2104, 1, 0, 0, 0, 174, 2106, 1, 0, 0, 0, 176, 2108, 1, 0, 0, 0, 178, 2110, 1, 0, 0, 0, 180, 2115, 1, 0, 0, 0, 182, 2119, 1, 0, 0, 0, 184, 2121, 1, 0, 0, 0, 186, 2123, 1, 0, 0, 0, 188, 2125, 1, 0, 0, 0, 190, 2127, 1, 0, 0, 0, 192, 2129, 1, 0, 0, 0, 194, 2131, 1, 0, 0, 0, 196, 2133, 1, 0, 0, 0, 198, 2135, 1, 0, 0, 0, 200, 2137, 1, 0, 0, 0, 202, 2139, 1, 0, 0, 0, 204, 2141, 1, 0, 0, 0, 206, 2143, 1, 0, 0, 0, 208, 2145, 1, 0, 0, 0, 210, 2147, 1, 0, 0, 0, 212, 2149, 1, 0, 0, 0, 214, 2151, 1, 0, 0, 0, 216, 2153, 1, 0, 0, 0, 218, 2155, 1, 0, 0, 0, 220, 2157, 1, 0, 0, 0, 222, 2159, 1, 0, 0, 0, 224, 2161, 1, 0, 0, 0, 226, 2163, 1, 0, 0, 0, 228, 2172, 1, 0, 0, 0, 230, 232, 3, 2, 1, 0, 231, 230, 1, 0, 0, 0, 232, 235, 1, 0, 0, 0, 233, 231, 1, 0, 0, 0, 233, 234, 1, 0, 0, 0, 234, 236, 1, 0, 0, 0, 235, 233, 1, 0, 0, 0, 236, 237, 5, 0, 0, 1, 237, 1, 1, 0, 0, 0, 238, 240, 5, 1, 0, 0, 239, 238, 1, 0, 0, 0, 240, 243, 1, 0, 0, 0, 241, 239, 1, 0, 0, 0, 241, 242, 1, 0, 0, 0, 242, 244, 1, 0, 0, 0, 243, 241, 1, 0, 0, 0, 244, 253, 3, 4, 2, 0, 245, 247, 5, 1, 0, 0, 246, 245, 1, 0, 0, 0, 247, 248, 1, 0, 0, 0, 248, 246, 1, 0, 0, 0, 248, 249, 1, 0, 0, 0, 249, 250, 1, 0, 0, 0, 250, 252, 3, 4, 2, 0, 251, 246, 1, 0, 0, 0, 252, 255, 1, 0, 0, 0, 253, 251, 1, 0, 0, 0, 253, 254, 1, 0, 0, 0, 254, 259, 1, 0, 0, 0, 255, 253, 1, 0, 0, 0, 256, 258, 5, 1, 0, 0, 257, 256, 1, 0, 0, 0, 258, 261, 1, 0, 0, 0, 259, 257, 1, 0, 0, 0, 259, 260, 1, 0, 0, 0, 260, 3, 1, 0, 0, 0, 261, 259, 1, 0, 0, 0, 262, 265, 5, 71, 0, 0, 263, 264, 5, 114, 0, 0, 264, 266, 5, 111, 0, 0, 265, 263, 1, 0, 0, 0, 265, 266, 1, 0, 0, 0, 266, 268, 1, 0, 0, 0, 267, 262, 1, 0, 0, 0, 267, 268, 1, 0, 0, 0, 268, 293, 1, 0, 0, 0, 269, 294, 3, 6, 3, 0, 270, 294, 3, 8, 4, 0, 271, 294, 3, 10, 5, 0, 272, 294, 3, 12, 6, 0, 273, 294, 3, 14, 7, 0, 274, 294, 3, 22, 11, 0, 275, 294, 3, 28, 14, 0, 276, 294, 3, 44, 22, 0, 277, 294, 3, 46, 23, 0, 278, 294, 3, 48, 24, 0, 279, 294, 3, 60, 30, 0, 280, 294, 3, 62, 31, 0, 281, 294, 3, 64, 32, 0, 282, 294, 3, 66, 33, 0, 283, 294, 3, 74, 37, 0, 284, 294, 3, 78, 39, 0, 285, 294, 3, 82, 41, 0, 286, 294, 3, 20, 10, 0, 287, 294, 3, 16, 8, 0, 288, 294, 3, 18, 9, 0, 289, 294, 3, 84, 42, 0, 290, 294, 3, 106, 53, 0, 291, 294, 3, 110, 55, 0, 292, 294, 3, 114, 57, 0, 293, 269, 1, 0, 0, 0, 293, 270, 1, 0, 0, 0, 293, 271, 1, 0, 0, 0, 293, 272, 1, 0, 0, 0, 293, 273, 1, 0, 0, 0, 293, 274, 1, 0, 0, 0, 293, 275, 1, 0, 0, 0, 293, 276, 1, 0, 0, 0, 293, 277, 1, 0, 0, 0, 293, 278, 1, 0, 0, 0, 293, 279, 1, 0, 0, 0, 293, 280, 1, 0, 0, 0, 293, 281, 1, 0, 0, 0, 293, 282, 1, 0, 0, 0, 293, 283, 1, 0, 0, 0, 293, 284, 1, 0, 0, 0, 293, 285, 1, 0, 0, 0, 293, 286, 1, 0, 0, 0, 293, 287, 1, 0, 0, 0, 293, 288, 1, 0, 0, 0, 293, 289, 1, 0, 0, 0, 293, 290, 1, 0, 0, 0, 293, 291, 1, 0, 0, 0, 293, 292, 1, 0, 0, 0, 294, 5, 1, 0, 0, 0, 295, 296, 5, 30, 0, 0, 296, 300, 5, 133, 0, 0, 297, 298, 3, 182, 91, 0, 298, 299, 5, 2, 0, 0, 299, 301, 1, 0, 0, 0, 300, 297, 1, 0, 0, 0, 300, 301, 1, 0, 0, 0, 301, 302, 1, 0, 0, 0, 302, 325, 3, 184, 92, 0, 303, 313, 5, 121, 0, 0, 304, 305, 5, 137, 0, 0, 305, 314, 3, 188, 94, 0, 306, 308, 5, 46, 0, 0, 307, 306, 1, 0, 0, 0, 307, 308, 1, 0, 0, 0, 308, 309, 1, 0, 0, 0, 309, 310, 3, 190, 95, 0, 310, 311, 5, 137, 0, 0, 311, 312, 3, 190, 95, 0, 312, 314, 1, 0, 0, 0, 313, 304, 1, 0, 0, 0, 313, 307, 1, 0, 0, 0, 314, 326, 1, 0, 0, 0, 315, 317, 5, 27, 0, 0, 316, 318, 5, 46, 0, 0, 317, 316, 1, 0, 0, 0, 317, 318, 1, 0, 0, 0, 318, 319, 1, 0, 0, 0, 319, 326, 3, 30, 15, 0, 320, 322, 5, 63, 0, 0, 321, 323, 5, 46, 0, 0, 322, 321, 1, 0, 0, 0, 322, 323, 1, 0, 0, 0, 323, 324, 1, 0, 0, 0, 324, 326, 3, 190, 95, 0, 325, 303, 1, 0, 0, 0, 325, 315, 1, 0, 0, 0, 325, 320, 1, 0, 0, 0, 326, 7, 1, 0, 0, 0, 327, 335, 5, 31, 0, 0, 328, 336, 3, 182, 91, 0, 329, 330, 3, 182, 91, 0, 330, 331, 5, 2, 0, 0, 331, 333, 1, 0, 0, 0, 332, 329, 1, 0, 0, 0, 332, 333, 1, 0, 0, 0, 333, 334, 1, 0, 0, 0, 334, 336, 3, 186, 93, 0, 335, 328, 1, 0, 0, 0, 335, 332, 1, 0, 0, 0, 335, 336, 1, 0, 0, 0, 336, 9, 1, 0, 0, 0, 337, 339, 5, 35, 0, 0, 338, 340, 5, 55, 0, 0, 339, 338, 1, 0, 0, 0, 339, 340, 1, 0, 0, 0, 340, 341, 1, 0, 0, 0, 341, 342, 3, 68, 34, 0, 342, 343, 5, 33, 0, 0, 343, 344, 3, 182, 91, 0, 344, 11, 1, 0, 0, 0, 345, 347, 5, 38, 0, 0, 346, 348, 7, 0, 0, 0, 347, 346, 1, 0, 0, 0, 347, 348, 1, 0, 0, 0, 348, 353, 1, 0, 0, 0, 349, 351, 5, 138, 0, 0, 350, 352, 3, 212, 106, 0, 351, 350, 1, 0, 0, 0, 351, 352, 1, 0, 0, 0, 352, 354, 1, 0, 0, 0, 353, 349, 1, 0, 0, 0, 353, 354, 1, 0, 0, 0, 354, 13, 1, 0, 0, 0, 355, 357, 7, 1, 0, 0, 356, 358, 5, 138, 0, 0, 357, 356, 1, 0, 0, 0, 357, 358, 1, 0, 0, 0, 358, 15, 1, 0, 0, 0, 359, 361, 5, 126, 0, 0, 360, 362, 5, 138, 0, 0, 361, 360, 1, 0, 0, 0, 361, 362, 1, 0, 0, 0, 362, 368, 1, 0, 0, 0, 363, 365, 5, 137, 0, 0, 364, 366, 5, 129, 0, 0, 365, 364, 1, 0, 0, 0, 365, 366, 1, 0, 0, 0, 366, 367, 1, 0, 0, 0, 367, 369, 3, 206, 103, 0, 368, 363, 1, 0, 0, 0, 368, 369, 1, 0, 0, 0, 369, 17, 1, 0, 0, 0, 370, 371, 5, 129, 0, 0, 371, 372, 3, 206, 103, 0, 372, 19, 1, 0, 0, 0, 373, 375, 5, 120, 0, 0, 374, 376, 5, 129, 0, 0, 375, 374, 1, 0, 0, 0, 375, 376, 1, 0, 0, 0, 376, 377, 1, 0, 0, 0, 377, 378, 3, 206, 103, 0, 378, 21, 1, 0, 0, 0, 379, 381, 5, 50, 0, 0, 380, 382, 5, 141, 0, 0, 381, 380, 1, 0, 0, 0, 381, 382, 1, 0, 0, 0, 382, 383, 1, 0, 0, 0, 383, 387, 5, 84, 0, 0, 384, 385, 5, 80, 0, 0, 385, 386, 5, 102, 0, 0, 386, 388, 5, 70, 0, 0, 387, 384, 1, 0, 0, 0, 387, 388, 1, 0, 0, 0, 388, 392, 1, 0, 0, 0, 389, 390, 3, 182, 91, 0, 390, 391, 5, 2, 0, 0, 391, 393, 1, 0, 0, 0, 392, 389, 1, 0, 0, 0, 392, 393, 1, 0, 0, 0, 393, 394, 1, 0, 0, 0, 394, 395, 3, 196, 98, 0, 395, 396, 5, 107, 0, 0, 396, 397, 3, 184, 92, 0, 397, 398, 5, 3, 0, 0, 398, 403, 3, 24, 12, 0, 399, 400, 5, 5, 0, 0, 400, 402, 3, 24, 12, 0, 401, 399, 1, 0, 0, 0, 402, 405, 1, 0, 0, 0, 403, 401, 1, 0, 0, 0, 403, 404, 1, 0, 0, 0, 404, 406, 1, 0, 0, 0, 405, 403, 1, 0, 0, 0, 406, 409, 5, 4, 0, 0, 407, 408, 5, 149, 0, 0, 408, 410, 3, 68, 34, 0, 409, 407, 1, 0, 0, 0, 409, 410, 1, 0, 0, 0, 410, 23, 1, 0, 0, 0, 411, 414, 3, 190, 95, 0, 412, 414, 3, 68, 34, 0, 413, 411, 1, 0, 0, 0, 413, 412, 1, 0, 0, 0, 414, 417, 1, 0, 0, 0, 415, 416, 5, 45, 0, 0, 416, 418, 3, 192, 96, 0, 417, 415, 1, 0, 0, 0, 417, 418, 1, 0, 0, 0, 418, 420, 1, 0, 0, 0, 419, 421, 3, 140, 70, 0, 420, 419, 1, 0, 0, 0, 420, 421, 1, 0, 0, 0, 421, 25, 1, 0, 0, 0, 422, 423, 5, 151, 0, 0, 423, 426, 5, 186, 0, 0, 424, 426, 5, 132, 0, 0, 425, 422, 1, 0, 0, 0, 425, 424, 1, 0, 0, 0, 426, 27, 1, 0, 0, 0, 427, 429, 5, 50, 0, 0, 428, 430, 7, 2, 0, 0, 429, 428, 1, 0, 0, 0, 429, 430, 1, 0, 0, 0, 430, 431, 1, 0, 0, 0, 431, 435, 5, 133, 0, 0, 432, 433, 5, 80, 0, 0, 433, 434, 5, 102, 0, 0, 434, 436, 5, 70, 0, 0, 435, 432, 1, 0, 0, 0, 435, 436, 1, 0, 0, 0, 436, 440, 1, 0, 0, 0, 437, 438, 3, 182, 91, 0, 438, 439, 5, 2, 0, 0, 439, 441, 1, 0, 0, 0, 440, 437, 1, 0, 0, 0, 440, 441, 1, 0, 0, 0, 441, 442, 1, 0, 0, 0, 442, 472, 3, 184, 92, 0, 443, 444, 5, 3, 0, 0, 444, 449, 3, 30, 15, 0, 445, 446, 5, 5, 0, 0, 446, 448, 3, 30, 15, 0, 447, 445, 1, 0, 0, 0, 448, 451, 1, 0, 0, 0, 449, 450, 1, 0, 0, 0, 449, 447, 1, 0, 0, 0, 450, 456, 1, 0, 0, 0, 451, 449, 1, 0, 0, 0, 452, 453, 5, 5, 0, 0, 453, 455, 3, 38, 19, 0, 454, 452, 1, 0, 0, 0, 455, 458, 1, 0, 0, 0, 456, 454, 1, 0, 0, 0, 456, 457, 1, 0, 0, 0, 457, 459, 1, 0, 0, 0, 458, 456, 1, 0, 0, 0, 459, 468, 5, 4, 0, 0, 460, 465, 3, 26, 13, 0, 461, 462, 5, 5, 0, 0, 462, 464, 3, 26, 13, 0, 463, 461, 1, 0, 0, 0, 464, 467, 1, 0, 0, 0, 465, 463, 1, 0, 0, 0, 465, 466, 1, 0, 0, 0, 466, 469, 1, 0, 0, 0, 467, 465, 1, 0, 0, 0, 468, 460, 1, 0, 0, 0, 468, 469, 1, 0, 0, 0, 469, 473, 1, 0, 0, 0, 470, 471, 5, 33, 0, 0, 471, 473, 3, 84, 42, 0, 472, 443, 1, 0, 0, 0, 472, 470, 1, 0, 0, 0, 473, 29, 1, 0, 0, 0, 474, 476, 3, 190, 95, 0, 475, 477, 3, 32, 16, 0, 476, 475, 1, 0, 0, 0, 476, 477, 1, 0, 0, 0, 477, 481, 1, 0, 0, 0, 478, 480, 3, 34, 17, 0, 479, 478, 1, 0, 0, 0, 480, 483, 1, 0, 0, 0, 481, 479, 1, 0, 0, 0, 481, 482, 1, 0, 0, 0, 482, 31, 1, 0, 0, 0, 483, 481, 1, 0, 0, 0, 484, 486, 3, 176, 88, 0, 485, 484, 1, 0, 0, 0, 486, 487, 1, 0, 0, 0, 487, 488, 1, 0, 0, 0, 487, 485, 1, 0, 0, 0, 488, 499, 1, 0, 0, 0, 489, 490, 5, 3, 0, 0, 490, 491, 3, 36, 18, 0, 491, 492, 5, 4, 0, 0, 492, 500, 1, 0, 0, 0, 493, 494, 5, 3, 0, 0, 494, 495, 3, 36, 18, 0, 495, 496, 5, 5, 0, 0, 496, 497, 3, 36, 18, 0, 497, 498, 5, 4, 0, 0, 498, 500, 1, 0, 0, 0, 499, 489, 1, 0, 0, 0, 499, 493, 1, 0, 0, 0, 499, 500, 1, 0, 0, 0, 500, 33, 1, 0, 0, 0, 501, 502, 5, 49, 0, 0, 502, 504, 3, 176, 88, 0, 503, 501, 1, 0, 0, 0, 503, 504, 1, 0, 0, 0, 504, 552, 1, 0, 0, 0, 505, 506, 5, 113, 0, 0, 506, 508, 5, 95, 0, 0, 507, 509, 3, 140, 70, 0, 508, 507, 1, 0, 0, 0, 508, 509, 1, 0, 0, 0, 509, 511, 1, 0, 0, 0, 510, 512, 3, 42, 21, 0, 511, 510, 1, 0, 0, 0, 511, 512, 1, 0, 0, 0, 512, 514, 1, 0, 0, 0, 513, 515, 5, 36, 0, 0, 514, 513, 1, 0, 0, 0, 514, 515, 1, 0, 0, 0, 515, 553, 1, 0, 0, 0, 516, 517, 5, 102, 0, 0, 517, 520, 5, 104, 0, 0, 518, 520, 5, 141, 0, 0, 519, 516, 1, 0, 0, 0, 519, 518, 1, 0, 0, 0, 520, 522, 1, 0, 0, 0, 521, 523, 3, 42, 21, 0, 522, 521, 1, 0, 0, 0, 522, 523, 1, 0, 0, 0, 523, 553, 1, 0, 0, 0, 524, 525, 5, 44, 0, 0, 525, 526, 5, 3, 0, 0, 526, 527, 3, 68, 34, 0, 527, 528, 5, 4, 0, 0, 528, 553, 1, 0, 0, 0, 529, 536, 5, 56, 0, 0, 530, 537, 3, 36, 18, 0, 531, 537, 3, 72, 36, 0, 532, 533, 5, 3, 0, 0, 533, 534, 3, 68, 34, 0, 534, 535, 5, 4, 0, 0, 535, 537, 1, 0, 0, 0, 536, 530, 1, 0, 0, 0, 536, 531, 1, 0, 0, 0, 536, 532, 1, 0, 0, 0, 537, 553, 1, 0, 0, 0, 538, 539, 5, 45, 0, 0, 539, 553, 3, 192, 96, 0, 540, 553, 3, 40, 20, 0, 541, 542, 5, 170, 0, 0, 542, 544, 5, 171, 0, 0, 543, 541, 1, 0, 0, 0, 543, 544, 1, 0, 0, 0, 544, 545, 1, 0, 0, 0, 545, 546, 5, 33, 0, 0, 546, 547, 5, 3, 0, 0, 547, 548, 3, 68, 34, 0, 548, 550, 5, 4, 0, 0, 549, 551, 7, 3, 0, 0, 550, 549, 1, 0, 0, 0, 550, 551, 1, 0, 0, 0, 551, 553, 1, 0, 0, 0, 552, 505, 1, 0, 0, 0, 552, 519, 1, 0, 0, 0, 552, 524, 1, 0, 0, 0, 552, 529, 1, 0, 0, 0, 552, 538, 1, 0, 0, 0, 552, 540, 1, 0, 0, 0, 552, 543, 1, 0, 0, 0, 553, 35, 1, 0, 0, 0, 554, 556, 7, 4, 0, 0, 555, 554, 1, 0, 0, 0, 555, 556, 1, 0, 0, 0, 556, 557, 1, 0, 0, 0, 557, 558, 5, 187, 0, 0, 558, 37, 1, 0, 0, 0, 559, 560, 5, 49, 0, 0, 560, 562, 3, 176, 88, 0, 561, 559, 1, 0, 0, 0, 561, 562, 1, 0, 0, 0, 562, 600, 1, 0, 0, 0, 563, 564, 5, 113, 0, 0, 564, 567, 5, 95, 0, 0, 565, 567, 5, 141, 0, 0, 566, 563, 1, 0, 0, 0, 566, 565, 1, 0, 0, 0, 567, 568, 1, 0, 0, 0, 568, 569, 5, 3, 0, 0, 569, 574, 3, 24, 12, 0, 570, 571, 5, 5, 0, 0, 571, 573, 3, 24, 12, 0, 572, 570, 1, 0, 0, 0, 573, 576, 1, 0, 0, 0, 574, 572, 1, 0, 0, 0, 574, 575, 1, 0, 0, 0, 575, 577, 1, 0, 0, 0, 576, 574, 1, 0, 0, 0, 577, 579, 5, 4, 0, 0, 578, 580, 3, 42, 21, 0, 579, 578, 1, 0, 0, 0, 579, 580, 1, 0, 0, 0, 580, 601, 1, 0, 0, 0, 581, 582, 5, 44, 0, 0, 582, 583, 5, 3, 0, 0, 583, 584, 3, 68, 34, 0, 584, 585, 5, 4, 0, 0, 585, 601, 1, 0, 0, 0, 586, 587, 5, 74, 0, 0, 587, 588, 5, 95, 0, 0, 588, 589, 5, 3, 0, 0, 589, 594, 3, 190, 95, 0, 590, 591, 5, 5, 0, 0, 591, 593, 3, 190, 95, 0, 592, 590, 1, 0, 0, 0, 593, 596, 1, 0, 0, 0, 594, 592, 1, 0, 0, 0, 594, 595, 1, 0, 0, 0, 595, 597, 1, 0, 0, 0, 596, 594, 1, 0, 0, 0, 597, 598, 5, 4, 0, 0, 598, 599, 3, 40, 20, 0, 599, 601, 1, 0, 0, 0, 600, 566, 1, 0, 0, 0, 600, 581, 1, 0, 0, 0, 600, 586, 1, 0, 0, 0, 601, 39, 1, 0, 0, 0, 602, 603, 5, 117, 0, 0, 603, 615, 3, 194, 97, 0, 604, 605, 5, 3, 0, 0, 605, 610, 3, 190, 95, 0, 606, 607, 5, 5, 0, 0, 607, 609, 3, 190, 95, 0, 608, 606, 1, 0, 0, 0, 609, 612, 1, 0, 0, 0, 610, 608, 1, 0, 0, 0, 610, 611, 1, 0, 0, 0, 611, 613, 1, 0, 0, 0, 612, 610, 1, 0, 0, 0, 613, 614, 5, 4, 0, 0, 614, 616, 1, 0, 0, 0, 615, 604, 1, 0, 0, 0, 615, 616, 1, 0, 0, 0, 616, 631, 1, 0, 0, 0, 617, 618, 5, 107, 0, 0, 618, 625, 7, 5, 0, 0, 619, 620, 5, 131, 0, 0, 620, 626, 7, 6, 0, 0, 621, 626, 5, 41, 0, 0, 622, 626, 5, 123, 0, 0, 623, 624, 5, 101, 0, 0, 624, 626, 5, 26, 0, 0, 625, 619, 1, 0, 0, 0, 625, 621, 1, 0, 0, 0, 625, 622, 1, 0, 0, 0, 625, 623, 1, 0, 0, 0, 626, 630, 1, 0, 0, 0, 627, 628, 5, 99, 0, 0, 628, 630, 3, 176, 88, 0, 629, 617, 1, 0, 0, 0, 629, 627, 1, 0, 0, 0, 630, 633, 1, 0, 0, 0, 631, 629, 1, 0, 0, 0, 631, 632, 1, 0, 0, 0, 632, 642, 1, 0, 0, 0, 633, 631, 1, 0, 0, 0, 634, 636, 5, 102, 0, 0, 635, 634, 1, 0, 0, 0, 635, 636, 1, 0, 0, 0, 636, 637, 1, 0, 0, 0, 637, 640, 5, 57, 0, 0, 638, 639, 5, 86, 0, 0, 639, 641, 7, 7, 0, 0, 640, 638, 1, 0, 0, 0, 640, 641, 1, 0, 0, 0, 641, 643, 1, 0, 0, 0, 642, 635, 1, 0, 0, 0, 642, 643, 1, 0, 0, 0, 643, 41, 1, 0, 0, 0, 644, 645, 5, 107, 0, 0, 645, 646, 5, 48, 0, 0, 646, 647, 7, 8, 0, 0, 647, 43, 1, 0, 0, 0, 648, 650, 5, 50, 0, 0, 649, 651, 7, 2, 0, 0, 650, 649, 1, 0, 0, 0, 650, 651, 1, 0, 0, 0, 651, 652, 1, 0, 0, 0, 652, 656, 5, 139, 0, 0, 653, 654, 5, 80, 0, 0, 654, 655, 5, 102, 0, 0, 655, 657, 5, 70, 0, 0, 656, 653, 1, 0, 0, 0, 656, 657, 1, 0, 0, 0, 657, 661, 1, 0, 0, 0, 658, 659, 3, 182, 91, 0, 659, 660, 5, 2, 0, 0, 660, 662, 1, 0, 0, 0, 661, 658, 1, 0, 0, 0, 661, 662, 1, 0, 0, 0, 662, 663, 1, 0, 0, 0, 663, 668, 3, 198, 99, 0, 664, 669, 5, 37, 0, 0, 665, 669, 5, 28, 0, 0, 666, 667, 5, 89, 0, 0, 667, 669, 5, 105, 0, 0, 668, 664, 1, 0, 0, 0, 668, 665, 1, 0, 0, 0, 668, 666, 1, 0, 0, 0, 668, 669, 1, 0, 0, 0, 669, 684, 1, 0, 0, 0, 670, 685, 5, 59, 0, 0, 671, 685, 5, 88, 0, 0, 672, 682, 5, 142, 0, 0, 673, 674, 5, 105, 0, 0, 674, 679, 3, 190, 95, 0, 675, 676, 5, 5, 0, 0, 676, 678, 3, 190, 95, 0, 677, 675, 1, 0, 0, 0, 678, 681, 1, 0, 0, 0, 679, 677, 1, 0, 0, 0, 679, 680, 1, 0, 0, 0, 680, 683, 1, 0, 0, 0, 681, 679, 1, 0, 0, 0, 682, 673, 1, 0, 0, 0, 682, 683, 1, 0, 0, 0, 683, 685, 1, 0, 0, 0, 684, 670, 1, 0, 0, 0, 684, 671, 1, 0, 0, 0, 684, 672, 1, 0, 0, 0, 685, 686, 1, 0, 0, 0, 686, 687, 5, 107, 0, 0, 687, 691, 3, 184, 92, 0, 688, 689, 5, 73, 0, 0, 689, 690, 5, 64, 0, 0, 690, 692, 5, 127, 0, 0, 691, 688, 1, 0, 0, 0, 691, 692, 1, 0, 0, 0, 692, 695, 1, 0, 0, 0, 693, 694, 5, 148, 0, 0, 694, 696, 3, 68, 34, 0, 695, 693, 1, 0, 0, 0, 695, 696, 1, 0, 0, 0, 696, 697, 1, 0, 0, 0, 697, 706, 5, 38, 0, 0, 698, 703, 3, 106, 53, 0, 699, 703, 3, 74, 37, 0, 700, 703, 3, 60, 30, 0, 701, 703, 3, 84, 42, 0, 702, 698, 1, 0, 0, 0, 702, 699, 1, 0, 0, 0, 702, 700, 1, 0, 0, 0, 702, 701, 1, 0, 0, 0, 703, 704, 1, 0, 0, 0, 704, 705, 5, 1, 0, 0, 705, 707, 1, 0, 0, 0, 706, 702, 1, 0, 0, 0, 707, 708, 1, 0, 0, 0, 708, 706, 1, 0, 0, 0, 708, 709, 1, 0, 0, 0, 709, 710, 1, 0, 0, 0, 710, 711, 5, 66, 0, 0, 711, 45, 1, 0, 0, 0, 712, 714, 5, 50, 0, 0, 713, 715, 7, 2, 0, 0, 714, 713, 1, 0, 0, 0, 714, 715, 1, 0, 0, 0, 715, 716, 1, 0, 0, 0, 716, 720, 5, 146, 0, 0, 717, 718, 5, 80, 0, 0, 718, 719, 5, 102, 0, 0, 719, 721, 5, 70, 0, 0, 720, 717, 1, 0, 0, 0, 720, 721, 1, 0, 0, 0, 721, 725, 1, 0, 0, 0, 722, 723, 3, 182, 91, 0, 723, 724, 5, 2, 0, 0, 724, 726, 1, 0, 0, 0, 725, 722, 1, 0, 0, 0, 725, 726, 1, 0, 0, 0, 726, 727, 1, 0, 0, 0, 727, 739, 3, 200, 100, 0, 728, 729, 5, 3, 0, 0, 729, 734, 3, 190, 95, 0, 730, 731, 5, 5, 0, 0, 731, 733, 3, 190, 95, 0, 732, 730, 1, 0, 0, 0, 733, 736, 1, 0, 0, 0, 734, 732, 1, 0, 0, 0, 734, 735, 1, 0, 0, 0, 735, 737, 1, 0, 0, 0, 736, 734, 1, 0, 0, 0, 737, 738, 5, 4, 0, 0, 738, 740, 1, 0, 0, 0, 739, 728, 1, 0, 0, 0, 739, 740, 1, 0, 0, 0, 740, 741, 1, 0, 0, 0, 741, 742, 5, 33, 0, 0, 742, 743, 3, 84, 42, 0, 743, 47, 1, 0, 0, 0, 744, 745, 5, 50, 0, 0, 745, 746, 5, 147, 0, 0, 746, 750, 5, 133, 0, 0, 747, 748, 5, 80, 0, 0, 748, 749, 5, 102, 0, 0, 749, 751, 5, 70, 0, 0, 750, 747, 1, 0, 0, 0, 750, 751, 1, 0, 0, 0, 751, 755, 1, 0, 0, 0, 752, 753, 3, 182, 91, 0, 753, 754, 5, 2, 0, 0, 754, 756, 1, 0, 0, 0, 755, 752, 1, 0, 0, 0, 755, 756, 1, 0, 0, 0, 756, 757, 1, 0, 0, 0, 757, 758, 3, 184, 92, 0, 758, 759, 5, 143, 0, 0, 759, 771, 3, 202, 101, 0, 760, 761, 5, 3, 0, 0, 761, 766, 3, 170, 85, 0, 762, 763, 5, 5, 0, 0, 763, 765, 3, 170, 85, 0, 764, 762, 1, 0, 0, 0, 765, 768, 1, 0, 0, 0, 766, 764, 1, 0, 0, 0, 766, 767, 1, 0, 0, 0, 767, 769, 1, 0, 0, 0, 768, 766, 1, 0, 0, 0, 769, 770, 5, 4, 0, 0, 770, 772, 1, 0, 0, 0, 771, 760, 1, 0, 0, 0, 771, 772, 1, 0, 0, 0, 772, 49, 1, 0, 0, 0, 773, 775, 5, 150, 0, 0, 774, 776, 5, 116, 0, 0, 775, 774, 1, 0, 0, 0, 775, 776, 1, 0, 0, 0, 776, 777, 1, 0, 0, 0, 777, 778, 3, 52, 26, 0, 778, 779, 5, 33, 0, 0, 779, 780, 5, 3, 0, 0, 780, 781, 3, 84, 42, 0, 781, 791, 5, 4, 0, 0, 782, 783, 5, 5, 0, 0, 783, 784, 3, 52, 26, 0, 784, 785, 5, 33, 0, 0, 785, 786, 5, 3, 0, 0, 786, 787, 3, 84, 42, 0, 787, 788, 5, 4, 0, 0, 788, 790, 1, 0, 0, 0, 789, 782, 1, 0, 0, 0, 790, 793, 1, 0, 0, 0, 791, 789, 1, 0, 0, 0, 791, 792, 1, 0, 0, 0, 792, 51, 1, 0, 0, 0, 793, 791, 1, 0, 0, 0, 794, 806, 3, 184, 92, 0, 795, 796, 5, 3, 0, 0, 796, 801, 3, 190, 95, 0, 797, 798, 5, 5, 0, 0, 798, 800, 3, 190, 95, 0, 799, 797, 1, 0, 0, 0, 800, 803, 1, 0, 0, 0, 801, 799, 1, 0, 0, 0, 801, 802, 1, 0, 0, 0, 802, 804, 1, 0, 0, 0, 803, 801, 1, 0, 0, 0, 804, 805, 5, 4, 0, 0, 805, 807, 1, 0, 0, 0, 806, 795, 1, 0, 0, 0, 806, 807, 1, 0, 0, 0, 807, 53, 1, 0, 0, 0, 808, 809, 3, 52, 26, 0, 809, 810, 5, 33, 0, 0, 810, 811, 5, 3, 0, 0, 811, 812, 3, 162, 81, 0, 812, 814, 5, 140, 0, 0, 813, 815, 5, 29, 0, 0, 814, 813, 1, 0, 0, 0, 814, 815, 1, 0, 0, 0, 815, 816, 1, 0, 0, 0, 816, 817, 3, 164, 82, 0, 817, 818, 5, 4, 0, 0, 818, 55, 1, 0, 0, 0, 819, 831, 3, 184, 92, 0, 820, 821, 5, 3, 0, 0, 821, 826, 3, 190, 95, 0, 822, 823, 5, 5, 0, 0, 823, 825, 3, 190, 95, 0, 824, 822, 1, 0, 0, 0, 825, 828, 1, 0, 0, 0, 826, 824, 1, 0, 0, 0, 826, 827, 1, 0, 0, 0, 827, 829, 1, 0, 0, 0, 828, 826, 1, 0, 0, 0, 829, 830, 5, 4, 0, 0, 830, 832, 1, 0, 0, 0, 831, 820, 1, 0, 0, 0, 831, 832, 1, 0, 0, 0, 832, 833, 1, 0, 0, 0, 833, 834, 5, 33, 0, 0, 834, 835, 5, 3, 0, 0, 835, 836, 3, 84, 42, 0, 836, 837, 5, 4, 0, 0, 837, 57, 1, 0, 0, 0, 838, 847, 5, 124, 0, 0, 839, 848, 5, 7, 0, 0, 840, 845, 3, 68, 34, 0, 841, 843, 5, 33, 0, 0, 842, 841, 1, 0, 0, 0, 842, 843, 1, 0, 0, 0, 843, 844, 1, 0, 0, 0, 844, 846, 3, 172, 86, 0, 845, 842, 1, 0, 0, 0, 845, 846, 1, 0, 0, 0, 846, 848, 1, 0, 0, 0, 847, 839, 1, 0, 0, 0, 847, 840, 1, 0, 0, 0, 848, 862, 1, 0, 0, 0, 849, 858, 5, 5, 0, 0, 850, 859, 5, 7, 0, 0, 851, 856, 3, 68, 34, 0, 852, 854, 5, 33, 0, 0, 853, 852, 1, 0, 0, 0, 853, 854, 1, 0, 0, 0, 854, 855, 1, 0, 0, 0, 855, 857, 3, 172, 86, 0, 856, 853, 1, 0, 0, 0, 856, 857, 1, 0, 0, 0, 857, 859, 1, 0, 0, 0, 858, 850, 1, 0, 0, 0, 858, 851, 1, 0, 0, 0, 859, 861, 1, 0, 0, 0, 860, 849, 1, 0, 0, 0, 861, 864, 1, 0, 0, 0, 862, 860, 1, 0, 0, 0, 862, 863, 1, 0, 0, 0, 863, 59, 1, 0, 0, 0, 864, 862, 1, 0, 0, 0, 865, 867, 3, 50, 25, 0, 866, 865, 1, 0, 0, 0, 866, 867, 1, 0, 0, 0, 867, 868, 1, 0, 0, 0, 868, 869, 5, 59, 0, 0, 869, 870, 5, 75, 0, 0, 870, 873, 3, 112, 56, 0, 871, 872, 5, 149, 0, 0, 872, 874, 3, 68, 34, 0, 873, 871, 1, 0, 0, 0, 873, 874, 1, 0, 0, 0, 874, 876, 1, 0, 0, 0, 875, 877, 3, 58, 29, 0, 876, 875, 1, 0, 0, 0, 876, 877, 1, 0, 0, 0, 877, 61, 1, 0, 0, 0, 878, 880, 3, 50, 25, 0, 879, 878, 1, 0, 0, 0, 879, 880, 1, 0, 0, 0, 880, 881, 1, 0, 0, 0, 881, 882, 5, 59, 0, 0, 882, 883, 5, 75, 0, 0, 883, 886, 3, 112, 56, 0, 884, 885, 5, 149, 0, 0, 885, 887, 3, 68, 34, 0, 886, 884, 1, 0, 0, 0, 886, 887, 1, 0, 0, 0, 887, 892, 1, 0, 0, 0, 888, 890, 3, 134, 67, 0, 889, 888, 1, 0, 0, 0, 889, 890, 1, 0, 0, 0, 890, 891, 1, 0, 0, 0, 891, 893, 3, 136, 68, 0, 892, 889, 1, 0, 0, 0, 892, 893, 1, 0, 0, 0, 893, 895, 1, 0, 0, 0, 894, 896, 3, 58, 29, 0, 895, 894, 1, 0, 0, 0, 895, 896, 1, 0, 0, 0, 896, 63, 1, 0, 0, 0, 897, 899, 5, 61, 0, 0, 898, 900, 5, 55, 0, 0, 899, 898, 1, 0, 0, 0, 899, 900, 1, 0, 0, 0, 900, 901, 1, 0, 0, 0, 901, 902, 3, 182, 91, 0, 902, 65, 1, 0, 0, 0, 903, 904, 5, 63, 0, 0, 904, 907, 7, 9, 0, 0, 905, 906, 5, 80, 0, 0, 906, 908, 5, 70, 0, 0, 907, 905, 1, 0, 0, 0, 907, 908, 1, 0, 0, 0, 908, 912, 1, 0, 0, 0, 909, 910, 3, 182, 91, 0, 910, 911, 5, 2, 0, 0, 911, 913, 1, 0, 0, 0, 912, 909, 1, 0, 0, 0, 912, 913, 1, 0, 0, 0, 913, 914, 1, 0, 0, 0, 914, 915, 3, 228, 114, 0, 915, 67, 1, 0, 0, 0, 916, 917, 6, 34, -1, 0, 917, 1006, 3, 72, 36, 0, 918, 1006, 5, 188, 0, 0, 919, 1006, 5, 189, 0, 0, 920, 921, 3, 182, 91, 0, 921, 922, 5, 2, 0, 0, 922, 924, 1, 0, 0, 0, 923, 920, 1, 0, 0, 0, 923, 924, 1, 0, 0, 0, 924, 925, 1, 0, 0, 0, 925, 926, 3, 184, 92, 0, 926, 927, 5, 2, 0, 0, 927, 929, 1, 0, 0, 0, 928, 923, 1, 0, 0, 0, 928, 929, 1, 0, 0, 0, 929, 930, 1, 0, 0, 0, 930, 1006, 3, 190, 95, 0, 931, 932, 3, 166, 83, 0, 932, 933, 3, 68, 34, 20, 933, 1006, 1, 0, 0, 0, 934, 935, 3, 180, 90, 0, 935, 948, 5, 3, 0, 0, 936, 938, 5, 62, 0, 0, 937, 936, 1, 0, 0, 0, 937, 938, 1, 0, 0, 0, 938, 939, 1, 0, 0, 0, 939, 944, 3, 68, 34, 0, 940, 941, 5, 5, 0, 0, 941, 943, 3, 68, 34, 0, 942, 940, 1, 0, 0, 0, 943, 946, 1, 0, 0, 0, 944, 942, 1, 0, 0, 0, 944, 945, 1, 0, 0, 0, 945, 949, 1, 0, 0, 0, 946, 944, 1, 0, 0, 0, 947, 949, 5, 7, 0, 0, 948, 937, 1, 0, 0, 0, 948, 947, 1, 0, 0, 0, 948, 949, 1, 0, 0, 0, 949, 950, 1, 0, 0, 0, 950, 952, 5, 4, 0, 0, 951, 953, 3, 116, 58, 0, 952, 951, 1, 0, 0, 0, 952, 953, 1, 0, 0, 0, 953, 955, 1, 0, 0, 0, 954, 956, 3, 120, 60, 0, 955, 954, 1, 0, 0, 0, 955, 956, 1, 0, 0, 0, 956, 1006, 1, 0, 0, 0, 957, 958, 5, 3, 0, 0, 958, 963, 3, 68, 34, 0, 959, 960, 5, 5, 0, 0, 960, 962, 3, 68, 34, 0, 961, 959, 1, 0, 0, 0, 962, 965, 1, 0, 0, 0, 963, 961, 1, 0, 0, 0, 963, 964, 1, 0, 0, 0, 964, 966, 1, 0, 0, 0, 965, 963, 1, 0, 0, 0, 966, 967, 5, 4, 0, 0, 967, 1006, 1, 0, 0, 0, 968, 969, 5, 43, 0, 0, 969, 970, 5, 3, 0, 0, 970, 971, 3, 68, 34, 0, 971, 972, 5, 33, 0, 0, 972, 973, 3, 32, 16, 0, 973, 974, 5, 4, 0, 0, 974, 1006, 1, 0, 0, 0, 975, 977, 5, 102, 0, 0, 976, 975, 1, 0, 0, 0, 976, 977, 1, 0, 0, 0, 977, 978, 1, 0, 0, 0, 978, 980, 5, 70, 0, 0, 979, 976, 1, 0, 0, 0, 979, 980, 1, 0, 0, 0, 980, 981, 1, 0, 0, 0, 981, 982, 5, 3, 0, 0, 982, 983, 3, 84, 42, 0, 983, 984, 5, 4, 0, 0, 984, 1006, 1, 0, 0, 0, 985, 987, 5, 42, 0, 0, 986, 988, 3, 68, 34, 0, 987, 986, 1, 0, 0, 0, 987, 988, 1, 0, 0, 0, 988, 994, 1, 0, 0, 0, 989, 990, 5, 148, 0, 0, 990, 991, 3, 68, 34, 0, 991, 992, 5, 136, 0, 0, 992, 993, 3, 68, 34, 0, 993, 995, 1, 0, 0, 0, 994, 989, 1, 0, 0, 0, 995, 996, 1, 0, 0, 0, 996, 994, 1, 0, 0, 0, 996, 997, 1, 0, 0, 0, 997, 1000, 1, 0, 0, 0, 998, 999, 5, 65, 0, 0, 999, 1001, 3, 68, 34, 0, 1000, 998, 1, 0, 0, 0, 1000, 1001, 1, 0, 0, 0, 1001, 1002, 1, 0, 0, 0, 1002, 1003, 5, 66, 0, 0, 1003, 1006, 1, 0, 0, 0, 1004, 1006, 3, 70, 35, 0, 1005, 916, 1, 0, 0, 0, 1005, 918, 1, 0, 0, 0, 1005, 919, 1, 0, 0, 0, 1005, 928, 1, 0, 0, 0, 1005, 931, 1, 0, 0, 0, 1005, 934, 1, 0, 0, 0, 1005, 957, 1, 0, 0, 0, 1005, 968, 1, 0, 0, 0, 1005, 979, 1, 0, 0, 0, 1005, 985, 1, 0, 0, 0, 1005, 1004, 1, 0, 0, 0, 1006, 1123, 1, 0, 0, 0, 1007, 1008, 10, 19, 0, 0, 1008, 1009, 5, 11, 0, 0, 1009, 1122, 3, 68, 34, 20, 1010, 1011, 10, 18, 0, 0, 1011, 1012, 7, 10, 0, 0, 1012, 1122, 3, 68, 34, 19, 1013, 1014, 10, 17, 0, 0, 1014, 1015, 7, 4, 0, 0, 1015, 1122, 3, 68, 34, 18, 1016, 1017, 10, 16, 0, 0, 1017, 1018, 7, 11, 0, 0, 1018, 1122, 3, 68, 34, 17, 1019, 1020, 10, 15, 0, 0, 1020, 1021, 7, 12, 0, 0, 1021, 1122, 3, 68, 34, 16, 1022, 1038, 10, 14, 0, 0, 1023, 1039, 5, 6, 0, 0, 1024, 1039, 5, 22, 0, 0, 1025, 1039, 5, 23, 0, 0, 1026, 1039, 5, 24, 0, 0, 1027, 1039, 5, 92, 0, 0, 1028, 1029, 5, 92, 0, 0, 1029, 1039, 5, 102, 0, 0, 1030, 1032, 5, 102, 0, 0, 1031, 1030, 1, 0, 0, 0, 1031, 1032, 1, 0, 0, 0, 1032, 1033, 1, 0, 0, 0, 1033, 1039, 5, 83, 0, 0, 1034, 1039, 5, 97, 0, 0, 1035, 1039, 5, 77, 0, 0, 1036, 1039, 5, 99, 0, 0, 1037, 1039, 5, 118, 0, 0, 1038, 1023, 1, 0, 0, 0, 1038, 1024, 1, 0, 0, 0, 1038, 1025, 1, 0, 0, 0, 1038, 1026, 1, 0, 0, 0, 1038, 1027, 1, 0, 0, 0, 1038, 1028, 1, 0, 0, 0, 1038, 1031, 1, 0, 0, 0, 1038, 1034, 1, 0, 0, 0, 1038, 1035, 1, 0, 0, 0, 1038, 1036, 1, 0, 0, 0, 1038, 1037, 1, 0, 0, 0, 1039, 1040, 1, 0, 0, 0, 1040, 1122, 3, 68, 34, 15, 1041, 1042, 10, 12, 0, 0, 1042, 1043, 5, 32, 0, 0, 1043, 1122, 3, 68, 34, 13, 1044, 1045, 10, 11, 0, 0, 1045, 1046, 5, 108, 0, 0, 1046, 1122, 3, 68, 34, 12, 1047, 1049, 10, 4, 0, 0, 1048, 1050, 5, 102, 0, 0, 1049, 1048, 1, 0, 0, 0, 1049, 1050, 1, 0, 0, 0, 1050, 1051, 1, 0, 0, 0, 1051, 1052, 5, 39, 0, 0, 1052, 1053, 3, 68, 34, 0, 1053, 1054, 5, 32, 0, 0, 1054, 1055, 3, 68, 34, 5, 1055, 1122, 1, 0, 0, 0, 1056, 1058, 10, 13, 0, 0, 1057, 1059, 5, 102, 0, 0, 1058, 1057, 1, 0, 0, 0, 1058, 1059, 1, 0, 0, 0, 1059, 1060, 1, 0, 0, 0, 1060, 1099, 5, 83, 0, 0, 1061, 1071, 5, 3, 0, 0, 1062, 1072, 3, 84, 42, 0, 1063, 1068, 3, 68, 34, 0, 1064, 1065, 5, 5, 0, 0, 1065, 1067, 3, 68, 34, 0, 1066, 1064, 1, 0, 0, 0, 1067, 1070, 1, 0, 0, 0, 1068, 1066, 1, 0, 0, 0, 1068, 1069, 1, 0, 0, 0, 1069, 1072, 1, 0, 0, 0, 1070, 1068, 1, 0, 0, 0, 1071, 1062, 1, 0, 0, 0, 1071, 1063, 1, 0, 0, 0, 1071, 1072, 1, 0, 0, 0, 1072, 1073, 1, 0, 0, 0, 1073, 1100, 5, 4, 0, 0, 1074, 1075, 3, 182, 91, 0, 1075, 1076, 5, 2, 0, 0, 1076, 1078, 1, 0, 0, 0, 1077, 1074, 1, 0, 0, 0, 1077, 1078, 1, 0, 0, 0, 1078, 1079, 1, 0, 0, 0, 1079, 1100, 3, 184, 92, 0, 1080, 1081, 3, 182, 91, 0, 1081, 1082, 5, 2, 0, 0, 1082, 1084, 1, 0, 0, 0, 1083, 1080, 1, 0, 0, 0, 1083, 1084, 1, 0, 0, 0, 1084, 1085, 1, 0, 0, 0, 1085, 1086, 3, 226, 113, 0, 1086, 1095, 5, 3, 0, 0, 1087, 1092, 3, 68, 34, 0, 1088, 1089, 5, 5, 0, 0, 1089, 1091, 3, 68, 34, 0, 1090, 1088, 1, 0, 0, 0, 1091, 1094, 1, 0, 0, 0, 1092, 1090, 1, 0, 0, 0, 1092, 1093, 1, 0, 0, 0, 1093, 1096, 1, 0, 0, 0, 1094, 1092, 1, 0, 0, 0, 1095, 1087, 1, 0, 0, 0, 1095, 1096, 1, 0, 0, 0, 1096, 1097, 1, 0, 0, 0, 1097, 1098, 5, 4, 0, 0, 1098, 1100, 1, 0, 0, 0, 1099, 1061, 1, 0, 0, 0, 1099, 1077, 1, 0, 0, 0, 1099, 1083, 1, 0, 0, 0, 1100, 1122, 1, 0, 0, 0, 1101, 1102, 10, 7, 0, 0, 1102, 1103, 5, 45, 0, 0, 1103, 1122, 3, 192, 96, 0, 1104, 1106, 10, 6, 0, 0, 1105, 1107, 5, 102, 0, 0, 1106, 1105, 1, 0, 0, 0, 1106, 1107, 1, 0, 0, 0, 1107, 1108, 1, 0, 0, 0, 1108, 1109, 7, 13, 0, 0, 1109, 1112, 3, 68, 34, 0, 1110, 1111, 5, 67, 0, 0, 1111, 1113, 3, 68, 34, 0, 1112, 1110, 1, 0, 0, 0, 1112, 1113, 1, 0, 0, 0, 1113, 1122, 1, 0, 0, 0, 1114, 1119, 10, 5, 0, 0, 1115, 1120, 5, 93, 0, 0, 1116, 1120, 5, 103, 0, 0, 1117, 1118, 5, 102, 0, 0, 1118, 1120, 5, 104, 0, 0, 1119, 1115, 1, 0, 0, 0, 1119, 1116, 1, 0, 0, 0, 1119, 1117, 1, 0, 0, 0, 1120, 1122, 1, 0, 0, 0, 1121, 1007, 1, 0, 0, 0, 1121, 1010, 1, 0, 0, 0, 1121, 1013, 1, 0, 0, 0, 1121, 1016, 1, 0, 0, 0, 1121, 1019, 1, 0, 0, 0, 1121, 1022, 1, 0, 0, 0, 1121, 1041, 1, 0, 0, 0, 1121, 1044, 1, 0, 0, 0, 1121, 1047, 1, 0, 0, 0, 1121, 1056, 1, 0, 0, 0, 1121, 1101, 1, 0, 0, 0, 1121, 1104, 1, 0, 0, 0, 1121, 1114, 1, 0, 0, 0, 1122, 1125, 1, 0, 0, 0, 1123, 1121, 1, 0, 0, 0, 1123, 1124, 1, 0, 0, 0, 1124, 69, 1, 0, 0, 0, 1125, 1123, 1, 0, 0, 0, 1126, 1127, 5, 115, 0, 0, 1127, 1132, 5, 3, 0, 0, 1128, 1133, 5, 81, 0, 0, 1129, 1130, 7, 14, 0, 0, 1130, 1131, 5, 5, 0, 0, 1131, 1133, 3, 168, 84, 0, 1132, 1128, 1, 0, 0, 0, 1132, 1129, 1, 0, 0, 0, 1133, 1134, 1, 0, 0, 0, 1134, 1135, 5, 4, 0, 0, 1135, 71, 1, 0, 0, 0, 1136, 1137, 7, 15, 0, 0, 1137, 73, 1, 0, 0, 0, 1138, 1140, 3, 50, 25, 0, 1139, 1138, 1, 0, 0, 0, 1139, 1140, 1, 0, 0, 0, 1140, 1146, 1, 0, 0, 0, 1141, 1147, 5, 88, 0, 0, 1142, 1147, 5, 122, 0, 0, 1143, 1144, 5, 88, 0, 0, 1144, 1145, 5, 108, 0, 0, 1145, 1147, 7, 8, 0, 0, 1146, 1141, 1, 0, 0, 0, 1146, 1142, 1, 0, 0, 0, 1146, 1143, 1, 0, 0, 0, 1147, 1148, 1, 0, 0, 0, 1148, 1152, 5, 91, 0, 0, 1149, 1150, 3, 182, 91, 0, 1150, 1151, 5, 2, 0, 0, 1151, 1153, 1, 0, 0, 0, 1152, 1149, 1, 0, 0, 0, 1152, 1153, 1, 0, 0, 0, 1153, 1154, 1, 0, 0, 0, 1154, 1157, 3, 184, 92, 0, 1155, 1156, 5, 33, 0, 0, 1156, 1158, 3, 208, 104, 0, 1157, 1155, 1, 0, 0, 0, 1157, 1158, 1, 0, 0, 0, 1158, 1170, 1, 0, 0, 0, 1159, 1160, 5, 3, 0, 0, 1160, 1165, 3, 190, 95, 0, 1161, 1162, 5, 5, 0, 0, 1162, 1164, 3, 190, 95, 0, 1163, 1161, 1, 0, 0, 0, 1164, 1167, 1, 0, 0, 0, 1165, 1163, 1, 0, 0, 0, 1165, 1166, 1, 0, 0, 0, 1166, 1168, 1, 0, 0, 0, 1167, 1165, 1, 0, 0, 0, 1168, 1169, 5, 4, 0, 0, 1169, 1171, 1, 0, 0, 0, 1170, 1159, 1, 0, 0, 0, 1170, 1171, 1, 0, 0, 0, 1171, 1201, 1, 0, 0, 0, 1172, 1173, 5, 145, 0, 0, 1173, 1174, 5, 3, 0, 0, 1174, 1179, 3, 68, 34, 0, 1175, 1176, 5, 5, 0, 0, 1176, 1178, 3, 68, 34, 0, 1177, 1175, 1, 0, 0, 0, 1178, 1181, 1, 0, 0, 0, 1179, 1177, 1, 0, 0, 0, 1179, 1180, 1, 0, 0, 0, 1180, 1182, 1, 0, 0, 0, 1181, 1179, 1, 0, 0, 0, 1182, 1197, 5, 4, 0, 0, 1183, 1184, 5, 5, 0, 0, 1184, 1185, 5, 3, 0, 0, 1185, 1190, 3, 68, 34, 0, 1186, 1187, 5, 5, 0, 0, 1187, 1189, 3, 68, 34, 0, 1188, 1186, 1, 0, 0, 0, 1189, 1192, 1, 0, 0, 0, 1190, 1188, 1, 0, 0, 0, 1190, 1191, 1, 0, 0, 0, 1191, 1193, 1, 0, 0, 0, 1192, 1190, 1, 0, 0, 0, 1193, 1194, 5, 4, 0, 0, 1194, 1196, 1, 0, 0, 0, 1195, 1183, 1, 0, 0, 0, 1196, 1199, 1, 0, 0, 0, 1197, 1195, 1, 0, 0, 0, 1197, 1198, 1, 0, 0, 0, 1198, 1202, 1, 0, 0, 0, 1199, 1197, 1, 0, 0, 0, 1200, 1202, 3, 84, 42, 0, 1201, 1172, 1, 0, 0, 0, 1201, 1200, 1, 0, 0, 0, 1202, 1204, 1, 0, 0, 0, 1203, 1205, 3, 76, 38, 0, 1204, 1203, 1, 0, 0, 0, 1204, 1205, 1, 0, 0, 0, 1205, 1207, 1, 0, 0, 0, 1206, 1208, 3, 58, 29, 0, 1207, 1206, 1, 0, 0, 0, 1207, 1208, 1, 0, 0, 0, 1208, 1212, 1, 0, 0, 0, 1209, 1210, 5, 56, 0, 0, 1210, 1212, 5, 145, 0, 0, 1211, 1139, 1, 0, 0, 0, 1211, 1209, 1, 0, 0, 0, 1212, 75, 1, 0, 0, 0, 1213, 1214, 5, 107, 0, 0, 1214, 1229, 5, 48, 0, 0, 1215, 1216, 5, 3, 0, 0, 1216, 1221, 3, 24, 12, 0, 1217, 1218, 5, 5, 0, 0, 1218, 1220, 3, 24, 12, 0, 1219, 1217, 1, 0, 0, 0, 1220, 1223, 1, 0, 0, 0, 1221, 1219, 1, 0, 0, 0, 1221, 1222, 1, 0, 0, 0, 1222, 1224, 1, 0, 0, 0, 1223, 1221, 1, 0, 0, 0, 1224, 1227, 5, 4, 0, 0, 1225, 1226, 5, 149, 0, 0, 1226, 1228, 3, 68, 34, 0, 1227, 1225, 1, 0, 0, 0, 1227, 1228, 1, 0, 0, 0, 1228, 1230, 1, 0, 0, 0, 1229, 1215, 1, 0, 0, 0, 1229, 1230, 1, 0, 0, 0, 1230, 1231, 1, 0, 0, 0, 1231, 1258, 5, 184, 0, 0, 1232, 1259, 5, 185, 0, 0, 1233, 1234, 5, 142, 0, 0, 1234, 1237, 5, 131, 0, 0, 1235, 1238, 3, 190, 95, 0, 1236, 1238, 3, 108, 54, 0, 1237, 1235, 1, 0, 0, 0, 1237, 1236, 1, 0, 0, 0, 1238, 1239, 1, 0, 0, 0, 1239, 1240, 5, 6, 0, 0, 1240, 1251, 3, 68, 34, 0, 1241, 1244, 5, 5, 0, 0, 1242, 1245, 3, 190, 95, 0, 1243, 1245, 3, 108, 54, 0, 1244, 1242, 1, 0, 0, 0, 1244, 1243, 1, 0, 0, 0, 1245, 1246, 1, 0, 0, 0, 1246, 1247, 5, 6, 0, 0, 1247, 1248, 3, 68, 34, 0, 1248, 1250, 1, 0, 0, 0, 1249, 1241, 1, 0, 0, 0, 1250, 1253, 1, 0, 0, 0, 1251, 1249, 1, 0, 0, 0, 1251, 1252, 1, 0, 0, 0, 1252, 1256, 1, 0, 0, 0, 1253, 1251, 1, 0, 0, 0, 1254, 1255, 5, 149, 0, 0, 1255, 1257, 3, 68, 34, 0, 1256, 1254, 1, 0, 0, 0, 1256, 1257, 1, 0, 0, 0, 1257, 1259, 1, 0, 0, 0, 1258, 1232, 1, 0, 0, 0, 1258, 1233, 1, 0, 0, 0, 1259, 77, 1, 0, 0, 0, 1260, 1264, 5, 112, 0, 0, 1261, 1262, 3, 182, 91, 0, 1262, 1263, 5, 2, 0, 0, 1263, 1265, 1, 0, 0, 0, 1264, 1261, 1, 0, 0, 0, 1264, 1265, 1, 0, 0, 0, 1265, 1266, 1, 0, 0, 0, 1266, 1273, 3, 204, 102, 0, 1267, 1268, 5, 6, 0, 0, 1268, 1274, 3, 80, 40, 0, 1269, 1270, 5, 3, 0, 0, 1270, 1271, 3, 80, 40, 0, 1271, 1272, 5, 4, 0, 0, 1272, 1274, 1, 0, 0, 0, 1273, 1267, 1, 0, 0, 0, 1273, 1269, 1, 0, 0, 0, 1273, 1274, 1, 0, 0, 0, 1274, 79, 1, 0, 0, 0, 1275, 1279, 3, 36, 18, 0, 1276, 1279, 3, 176, 88, 0, 1277, 1279, 5, 190, 0, 0, 1278, 1275, 1, 0, 0, 0, 1278, 1276, 1, 0, 0, 0, 1278, 1277, 1, 0, 0, 0, 1279, 81, 1, 0, 0, 0, 1280, 1291, 5, 119, 0, 0, 1281, 1292, 3, 192, 96, 0, 1282, 1283, 3, 182, 91, 0, 1283, 1284, 5, 2, 0, 0, 1284, 1286, 1, 0, 0, 0, 1285, 1282, 1, 0, 0, 0, 1285, 1286, 1, 0, 0, 0, 1286, 1289, 1, 0, 0, 0, 1287, 1290, 3, 184, 92, 0, 1288, 1290, 3, 196, 98, 0, 1289, 1287, 1, 0, 0, 0, 1289, 1288, 1, 0, 0, 0, 1290, 1292, 1, 0, 0, 0, 1291, 1281, 1, 0, 0, 0, 1291, 1285, 1, 0, 0, 0, 1291, 1292, 1, 0, 0, 0, 1292, 83, 1, 0, 0, 0, 1293, 1295, 3, 132, 66, 0, 1294, 1293, 1, 0, 0, 0, 1294, 1295, 1, 0, 0, 0, 1295, 1296, 1, 0, 0, 0, 1296, 1302, 3, 88, 44, 0, 1297, 1298, 3, 104, 52, 0, 1298, 1299, 3, 88, 44, 0, 1299, 1301, 1, 0, 0, 0, 1300, 1297, 1, 0, 0, 0, 1301, 1304, 1, 0, 0, 0, 1302, 1300, 1, 0, 0, 0, 1302, 1303, 1, 0, 0, 0, 1303, 1306, 1, 0, 0, 0, 1304, 1302, 1, 0, 0, 0, 1305, 1307, 3, 134, 67, 0, 1306, 1305, 1, 0, 0, 0, 1306, 1307, 1, 0, 0, 0, 1307, 1309, 1, 0, 0, 0, 1308, 1310, 3, 136, 68, 0, 1309, 1308, 1, 0, 0, 0, 1309, 1310, 1, 0, 0, 0, 1310, 85, 1, 0, 0, 0, 1311, 1318, 3, 96, 48, 0, 1312, 1313, 3, 100, 50, 0, 1313, 1314, 3, 96, 48, 0, 1314, 1315, 3, 102, 51, 0, 1315, 1317, 1, 0, 0, 0, 1316, 1312, 1, 0, 0, 0, 1317, 1320, 1, 0, 0, 0, 1318, 1316, 1, 0, 0, 0, 1318, 1319, 1, 0, 0, 0, 1319, 87, 1, 0, 0, 0, 1320, 1318, 1, 0, 0, 0, 1321, 1323, 5, 130, 0, 0, 1322, 1324, 7, 16, 0, 0, 1323, 1322, 1, 0, 0, 0, 1323, 1324, 1, 0, 0, 0, 1324, 1325, 1, 0, 0, 0, 1325, 1330, 3, 98, 49, 0, 1326, 1327, 5, 5, 0, 0, 1327, 1329, 3, 98, 49, 0, 1328, 1326, 1, 0, 0, 0, 1329, 1332, 1, 0, 0, 0, 1330, 1328, 1, 0, 0, 0, 1330, 1331, 1, 0, 0, 0, 1331, 1345, 1, 0, 0, 0, 1332, 1330, 1, 0, 0, 0, 1333, 1343, 5, 75, 0, 0, 1334, 1339, 3, 96, 48, 0, 1335, 1336, 5, 5, 0, 0, 1336, 1338, 3, 96, 48, 0, 1337, 1335, 1, 0, 0, 0, 1338, 1341, 1, 0, 0, 0, 1339, 1337, 1, 0, 0, 0, 1339, 1340, 1, 0, 0, 0, 1340, 1344, 1, 0, 0, 0, 1341, 1339, 1, 0, 0, 0, 1342, 1344, 3, 86, 43, 0, 1343, 1334, 1, 0, 0, 0, 1343, 1342, 1, 0, 0, 0, 1344, 1346, 1, 0, 0, 0, 1345, 1333, 1, 0, 0, 0, 1345, 1346, 1, 0, 0, 0, 1346, 1349, 1, 0, 0, 0, 1347, 1348, 5, 149, 0, 0, 1348, 1350, 3, 68, 34, 0, 1349, 1347, 1, 0, 0, 0, 1349, 1350, 1, 0, 0, 0, 1350, 1365, 1, 0, 0, 0, 1351, 1352, 5, 78, 0, 0, 1352, 1353, 5, 40, 0, 0, 1353, 1358, 3, 68, 34, 0, 1354, 1355, 5, 5, 0, 0, 1355, 1357, 3, 68, 34, 0, 1356, 1354, 1, 0, 0, 0, 1357, 1360, 1, 0, 0, 0, 1358, 1356, 1, 0, 0, 0, 1358, 1359, 1, 0, 0, 0, 1359, 1363, 1, 0, 0, 0, 1360, 1358, 1, 0, 0, 0, 1361, 1362, 5, 79, 0, 0, 1362, 1364, 3, 68, 34, 0, 1363, 1361, 1, 0, 0, 0, 1363, 1364, 1, 0, 0, 0, 1364, 1366, 1, 0, 0, 0, 1365, 1351, 1, 0, 0, 0, 1365, 1366, 1, 0, 0, 0, 1366, 1381, 1, 0, 0, 0, 1367, 1368, 5, 175, 0, 0, 1368, 1369, 3, 214, 107, 0, 1369, 1370, 5, 33, 0, 0, 1370, 1378, 3, 118, 59, 0, 1371, 1372, 5, 5, 0, 0, 1372, 1373, 3, 214, 107, 0, 1373, 1374, 5, 33, 0, 0, 1374, 1375, 3, 118, 59, 0, 1375, 1377, 1, 0, 0, 0, 1376, 1371, 1, 0, 0, 0, 1377, 1380, 1, 0, 0, 0, 1378, 1376, 1, 0, 0, 0, 1378, 1379, 1, 0, 0, 0, 1379, 1382, 1, 0, 0, 0, 1380, 1378, 1, 0, 0, 0, 1381, 1367, 1, 0, 0, 0, 1381, 1382, 1, 0, 0, 0, 1382, 1412, 1, 0, 0, 0, 1383, 1384, 5, 145, 0, 0, 1384, 1385, 5, 3, 0, 0, 1385, 1390, 3, 68, 34, 0, 1386, 1387, 5, 5, 0, 0, 1387, 1389, 3, 68, 34, 0, 1388, 1386, 1, 0, 0, 0, 1389, 1392, 1, 0, 0, 0, 1390, 1388, 1, 0, 0, 0, 1390, 1391, 1, 0, 0, 0, 1391, 1393, 1, 0, 0, 0, 1392, 1390, 1, 0, 0, 0, 1393, 1408, 5, 4, 0, 0, 1394, 1395, 5, 5, 0, 0, 1395, 1396, 5, 3, 0, 0, 1396, 1401, 3, 68, 34, 0, 1397, 1398, 5, 5, 0, 0, 1398, 1400, 3, 68, 34, 0, 1399, 1397, 1, 0, 0, 0, 1400, 1403, 1, 0, 0, 0, 1401, 1399, 1, 0, 0, 0, 1401, 1402, 1, 0, 0, 0, 1402, 1404, 1, 0, 0, 0, 1403, 1401, 1, 0, 0, 0, 1404, 1405, 5, 4, 0, 0, 1405, 1407, 1, 0, 0, 0, 1406, 1394, 1, 0, 0, 0, 1407, 1410, 1, 0, 0, 0, 1408, 1406, 1, 0, 0, 0, 1408, 1409, 1, 0, 0, 0, 1409, 1412, 1, 0, 0, 0, 1410, 1408, 1, 0, 0, 0, 1411, 1321, 1, 0, 0, 0, 1411, 1383, 1, 0, 0, 0, 1412, 89, 1, 0, 0, 0, 1413, 1414, 3, 84, 42, 0, 1414, 91, 1, 0, 0, 0, 1415, 1417, 3, 132, 66, 0, 1416, 1415, 1, 0, 0, 0, 1416, 1417, 1, 0, 0, 0, 1417, 1418, 1, 0, 0, 0, 1418, 1420, 3, 88, 44, 0, 1419, 1421, 3, 134, 67, 0, 1420, 1419, 1, 0, 0, 0, 1420, 1421, 1, 0, 0, 0, 1421, 1423, 1, 0, 0, 0, 1422, 1424, 3, 136, 68, 0, 1423, 1422, 1, 0, 0, 0, 1423, 1424, 1, 0, 0, 0, 1424, 93, 1, 0, 0, 0, 1425, 1427, 3, 132, 66, 0, 1426, 1425, 1, 0, 0, 0, 1426, 1427, 1, 0, 0, 0, 1427, 1428, 1, 0, 0, 0, 1428, 1438, 3, 88, 44, 0, 1429, 1431, 5, 140, 0, 0, 1430, 1432, 5, 29, 0, 0, 1431, 1430, 1, 0, 0, 0, 1431, 1432, 1, 0, 0, 0, 1432, 1436, 1, 0, 0, 0, 1433, 1436, 5, 90, 0, 0, 1434, 1436, 5, 68, 0, 0, 1435, 1429, 1, 0, 0, 0, 1435, 1433, 1, 0, 0, 0, 1435, 1434, 1, 0, 0, 0, 1436, 1437, 1, 0, 0, 0, 1437, 1439, 3, 88, 44, 0, 1438, 1435, 1, 0, 0, 0, 1439, 1440, 1, 0, 0, 0, 1440, 1438, 1, 0, 0, 0, 1440, 1441, 1, 0, 0, 0, 1441, 1443, 1, 0, 0, 0, 1442, 1444, 3, 134, 67, 0, 1443, 1442, 1, 0, 0, 0, 1443, 1444, 1, 0, 0, 0, 1444, 1446, 1, 0, 0, 0, 1445, 1447, 3, 136, 68, 0, 1446, 1445, 1, 0, 0, 0, 1446, 1447, 1, 0, 0, 0, 1447, 95, 1, 0, 0, 0, 1448, 1449, 3, 182, 91, 0, 1449, 1450, 5, 2, 0, 0, 1450, 1452, 1, 0, 0, 0, 1451, 1448, 1, 0, 0, 0, 1451, 1452, 1, 0, 0, 0, 1452, 1453, 1, 0, 0, 0, 1453, 1458, 3, 184, 92, 0, 1454, 1456, 5, 33, 0, 0, 1455, 1454, 1, 0, 0, 0, 1455, 1456, 1, 0, 0, 0, 1456, 1457, 1, 0, 0, 0, 1457, 1459, 3, 208, 104, 0, 1458, 1455, 1, 0, 0, 0, 1458, 1459, 1, 0, 0, 0, 1459, 1465, 1, 0, 0, 0, 1460, 1461, 5, 85, 0, 0, 1461, 1462, 5, 40, 0, 0, 1462, 1466, 3, 196, 98, 0, 1463, 1464, 5, 102, 0, 0, 1464, 1466, 5, 85, 0, 0, 1465, 1460, 1, 0, 0, 0, 1465, 1463, 1, 0, 0, 0, 1465, 1466, 1, 0, 0, 0, 1466, 1577, 1, 0, 0, 0, 1467, 1468, 3, 182, 91, 0, 1468, 1469, 5, 2, 0, 0, 1469, 1471, 1, 0, 0, 0, 1470, 1467, 1, 0, 0, 0, 1470, 1471, 1, 0, 0, 0, 1471, 1472, 1, 0, 0, 0, 1472, 1473, 3, 226, 113, 0, 1473, 1474, 5, 3, 0, 0, 1474, 1479, 3, 68, 34, 0, 1475, 1476, 5, 5, 0, 0, 1476, 1478, 3, 68, 34, 0, 1477, 1475, 1, 0, 0, 0, 1478, 1481, 1, 0, 0, 0, 1479, 1477, 1, 0, 0, 0, 1479, 1480, 1, 0, 0, 0, 1480, 1482, 1, 0, 0, 0, 1481, 1479, 1, 0, 0, 0, 1482, 1487, 5, 4, 0, 0, 1483, 1485, 5, 33, 0, 0, 1484, 1483, 1, 0, 0, 0, 1484, 1485, 1, 0, 0, 0, 1485, 1486, 1, 0, 0, 0, 1486, 1488, 3, 208, 104, 0, 1487, 1484, 1, 0, 0, 0, 1487, 1488, 1, 0, 0, 0, 1488, 1577, 1, 0, 0, 0, 1489, 1499, 5, 3, 0, 0, 1490, 1495, 3, 96, 48, 0, 1491, 1492, 5, 5, 0, 0, 1492, 1494, 3, 96, 48, 0, 1493, 1491, 1, 0, 0, 0, 1494, 1497, 1, 0, 0, 0, 1495, 1493, 1, 0, 0, 0, 1495, 1496, 1, 0, 0, 0, 1496, 1500, 1, 0, 0, 0, 1497, 1495, 1, 0, 0, 0, 1498, 1500, 3, 86, 43, 0, 1499, 1490, 1, 0, 0, 0, 1499, 1498, 1, 0, 0, 0, 1500, 1501, 1, 0, 0, 0, 1501, 1502, 5, 4, 0, 0, 1502, 1577, 1, 0, 0, 0, 1503, 1504, 5, 3, 0, 0, 1504, 1505, 3, 84, 42, 0, 1505, 1510, 5, 4, 0, 0, 1506, 1508, 5, 33, 0, 0, 1507, 1506, 1, 0, 0, 0, 1507, 1508, 1, 0, 0, 0, 1508, 1509, 1, 0, 0, 0, 1509, 1511, 3, 208, 104, 0, 1510, 1507, 1, 0, 0, 0, 1510, 1511, 1, 0, 0, 0, 1511, 1577, 1, 0, 0, 0, 1512, 1513, 3, 182, 91, 0, 1513, 1514, 5, 2, 0, 0, 1514, 1516, 1, 0, 0, 0, 1515, 1512, 1, 0, 0, 0, 1515, 1516, 1, 0, 0, 0, 1516, 1517, 1, 0, 0, 0, 1517, 1522, 3, 184, 92, 0, 1518, 1520, 5, 33, 0, 0, 1519, 1518, 1, 0, 0, 0, 1519, 1520, 1, 0, 0, 0, 1520, 1521, 1, 0, 0, 0, 1521, 1523, 3, 210, 105, 0, 1522, 1519, 1, 0, 0, 0, 1522, 1523, 1, 0, 0, 0, 1523, 1529, 1, 0, 0, 0, 1524, 1525, 5, 85, 0, 0, 1525, 1526, 5, 40, 0, 0, 1526, 1530, 3, 196, 98, 0, 1527, 1528, 5, 102, 0, 0, 1528, 1530, 5, 85, 0, 0, 1529, 1524, 1, 0, 0, 0, 1529, 1527, 1, 0, 0, 0, 1529, 1530, 1, 0, 0, 0, 1530, 1577, 1, 0, 0, 0, 1531, 1532, 3, 182, 91, 0, 1532, 1533, 5, 2, 0, 0, 1533, 1535, 1, 0, 0, 0, 1534, 1531, 1, 0, 0, 0, 1534, 1535, 1, 0, 0, 0, 1535, 1536, 1, 0, 0, 0, 1536, 1537, 3, 226, 113, 0, 1537, 1538, 5, 3, 0, 0, 1538, 1543, 3, 68, 34, 0, 1539, 1540, 5, 5, 0, 0, 1540, 1542, 3, 68, 34, 0, 1541, 1539, 1, 0, 0, 0, 1542, 1545, 1, 0, 0, 0, 1543, 1541, 1, 0, 0, 0, 1543, 1544, 1, 0, 0, 0, 1544, 1546, 1, 0, 0, 0, 1545, 1543, 1, 0, 0, 0, 1546, 1551, 5, 4, 0, 0, 1547, 1549, 5, 33, 0, 0, 1548, 1547, 1, 0, 0, 0, 1548, 1549, 1, 0, 0, 0, 1549, 1550, 1, 0, 0, 0, 1550, 1552, 3, 210, 105, 0, 1551, 1548, 1, 0, 0, 0, 1551, 1552, 1, 0, 0, 0, 1552, 1577, 1, 0, 0, 0, 1553, 1563, 5, 3, 0, 0, 1554, 1559, 3, 96, 48, 0, 1555, 1556, 5, 5, 0, 0, 1556, 1558, 3, 96, 48, 0, 1557, 1555, 1, 0, 0, 0, 1558, 1561, 1, 0, 0, 0, 1559, 1557, 1, 0, 0, 0, 1559, 1560, 1, 0, 0, 0, 1560, 1564, 1, 0, 0, 0, 1561, 1559, 1, 0, 0, 0, 1562, 1564, 3, 86, 43, 0, 1563, 1554, 1, 0, 0, 0, 1563, 1562, 1, 0, 0, 0, 1564, 1565, 1, 0, 0, 0, 1565, 1566, 5, 4, 0, 0, 1566, 1577, 1, 0, 0, 0, 1567, 1568, 5, 3, 0, 0, 1568, 1569, 3, 84, 42, 0, 1569, 1574, 5, 4, 0, 0, 1570, 1572, 5, 33, 0, 0, 1571, 1570, 1, 0, 0, 0, 1571, 1572, 1, 0, 0, 0, 1572, 1573, 1, 0, 0, 0, 1573, 1575, 3, 210, 105, 0, 1574, 1571, 1, 0, 0, 0, 1574, 1575, 1, 0, 0, 0, 1575, 1577, 1, 0, 0, 0, 1576, 1451, 1, 0, 0, 0, 1576, 1470, 1, 0, 0, 0, 1576, 1489, 1, 0, 0, 0, 1576, 1503, 1, 0, 0, 0, 1576, 1515, 1, 0, 0, 0, 1576, 1534, 1, 0, 0, 0, 1576, 1553, 1, 0, 0, 0, 1576, 1567, 1, 0, 0, 0, 1577, 97, 1, 0, 0, 0, 1578, 1591, 5, 7, 0, 0, 1579, 1580, 3, 184, 92, 0, 1580, 1581, 5, 2, 0, 0, 1581, 1582, 5, 7, 0, 0, 1582, 1591, 1, 0, 0, 0, 1583, 1588, 3, 68, 34, 0, 1584, 1586, 5, 33, 0, 0, 1585, 1584, 1, 0, 0, 0, 1585, 1586, 1, 0, 0, 0, 1586, 1587, 1, 0, 0, 0, 1587, 1589, 3, 172, 86, 0, 1588, 1585, 1, 0, 0, 0, 1588, 1589, 1, 0, 0, 0, 1589, 1591, 1, 0, 0, 0, 1590, 1578, 1, 0, 0, 0, 1590, 1579, 1, 0, 0, 0, 1590, 1583, 1, 0, 0, 0, 1591, 99, 1, 0, 0, 0, 1592, 1607, 5, 5, 0, 0, 1593, 1595, 5, 100, 0, 0, 1594, 1593, 1, 0, 0, 0, 1594, 1595, 1, 0, 0, 0, 1595, 1601, 1, 0, 0, 0, 1596, 1598, 7, 17, 0, 0, 1597, 1599, 5, 110, 0, 0, 1598, 1597, 1, 0, 0, 0, 1598, 1599, 1, 0, 0, 0, 1599, 1602, 1, 0, 0, 0, 1600, 1602, 5, 87, 0, 0, 1601, 1596, 1, 0, 0, 0, 1601, 1600, 1, 0, 0, 0, 1601, 1602, 1, 0, 0, 0, 1602, 1603, 1, 0, 0, 0, 1603, 1607, 5, 94, 0, 0, 1604, 1605, 5, 51, 0, 0, 1605, 1607, 5, 94, 0, 0, 1606, 1592, 1, 0, 0, 0, 1606, 1594, 1, 0, 0, 0, 1606, 1604, 1, 0, 0, 0, 1607, 101, 1, 0, 0, 0, 1608, 1609, 5, 107, 0, 0, 1609, 1623, 3, 68, 34, 0, 1610, 1611, 5, 143, 0, 0, 1611, 1612, 5, 3, 0, 0, 1612, 1617, 3, 190, 95, 0, 1613, 1614, 5, 5, 0, 0, 1614, 1616, 3, 190, 95, 0, 1615, 1613, 1, 0, 0, 0, 1616, 1619, 1, 0, 0, 0, 1617, 1615, 1, 0, 0, 0, 1617, 1618, 1, 0, 0, 0, 1618, 1620, 1, 0, 0, 0, 1619, 1617, 1, 0, 0, 0, 1620, 1621, 5, 4, 0, 0, 1621, 1623, 1, 0, 0, 0, 1622, 1608, 1, 0, 0, 0, 1622, 1610, 1, 0, 0, 0, 1622, 1623, 1, 0, 0, 0, 1623, 103, 1, 0, 0, 0, 1624, 1626, 5, 140, 0, 0, 1625, 1627, 5, 29, 0, 0, 1626, 1625, 1, 0, 0, 0, 1626, 1627, 1, 0, 0, 0, 1627, 1631, 1, 0, 0, 0, 1628, 1631, 5, 90, 0, 0, 1629, 1631, 5, 68, 0, 0, 1630, 1624, 1, 0, 0, 0, 1630, 1628, 1, 0, 0, 0, 1630, 1629, 1, 0, 0, 0, 1631, 105, 1, 0, 0, 0, 1632, 1634, 3, 50, 25, 0, 1633, 1632, 1, 0, 0, 0, 1633, 1634, 1, 0, 0, 0, 1634, 1635, 1, 0, 0, 0, 1635, 1638, 5, 142, 0, 0, 1636, 1637, 5, 108, 0, 0, 1637, 1639, 7, 8, 0, 0, 1638, 1636, 1, 0, 0, 0, 1638, 1639, 1, 0, 0, 0, 1639, 1640, 1, 0, 0, 0, 1640, 1641, 3, 112, 56, 0, 1641, 1644, 5, 131, 0, 0, 1642, 1645, 3, 190, 95, 0, 1643, 1645, 3, 108, 54, 0, 1644, 1642, 1, 0, 0, 0, 1644, 1643, 1, 0, 0, 0, 1645, 1646, 1, 0, 0, 0, 1646, 1647, 5, 6, 0, 0, 1647, 1658, 3, 68, 34, 0, 1648, 1651, 5, 5, 0, 0, 1649, 1652, 3, 190, 95, 0, 1650, 1652, 3, 108, 54, 0, 1651, 1649, 1, 0, 0, 0, 1651, 1650, 1, 0, 0, 0, 1652, 1653, 1, 0, 0, 0, 1653, 1654, 5, 6, 0, 0, 1654, 1655, 3, 68, 34, 0, 1655, 1657, 1, 0, 0, 0, 1656, 1648, 1, 0, 0, 0, 1657, 1660, 1, 0, 0, 0, 1658, 1656, 1, 0, 0, 0, 1658, 1659, 1, 0, 0, 0, 1659, 1663, 1, 0, 0, 0, 1660, 1658, 1, 0, 0, 0, 1661, 1662, 5, 149, 0, 0, 1662, 1664, 3, 68, 34, 0, 1663, 1661, 1, 0, 0, 0, 1663, 1664, 1, 0, 0, 0, 1664, 1666, 1, 0, 0, 0, 1665, 1667, 3, 58, 29, 0, 1666, 1665, 1, 0, 0, 0, 1666, 1667, 1, 0, 0, 0, 1667, 107, 1, 0, 0, 0, 1668, 1669, 5, 3, 0, 0, 1669, 1674, 3, 190, 95, 0, 1670, 1671, 5, 5, 0, 0, 1671, 1673, 3, 190, 95, 0, 1672, 1670, 1, 0, 0, 0, 1673, 1676, 1, 0, 0, 0, 1674, 1672, 1, 0, 0, 0, 1674, 1675, 1, 0, 0, 0, 1675, 1677, 1, 0, 0, 0, 1676, 1674, 1, 0, 0, 0, 1677, 1678, 5, 4, 0, 0, 1678, 109, 1, 0, 0, 0, 1679, 1681, 3, 50, 25, 0, 1680, 1679, 1, 0, 0, 0, 1680, 1681, 1, 0, 0, 0, 1681, 1682, 1, 0, 0, 0, 1682, 1685, 5, 142, 0, 0, 1683, 1684, 5, 108, 0, 0, 1684, 1686, 7, 8, 0, 0, 1685, 1683, 1, 0, 0, 0, 1685, 1686, 1, 0, 0, 0, 1686, 1687, 1, 0, 0, 0, 1687, 1688, 3, 112, 56, 0, 1688, 1691, 5, 131, 0, 0, 1689, 1692, 3, 190, 95, 0, 1690, 1692, 3, 108, 54, 0, 1691, 1689, 1, 0, 0, 0, 1691, 1690, 1, 0, 0, 0, 1692, 1693, 1, 0, 0, 0, 1693, 1694, 5, 6, 0, 0, 1694, 1705, 3, 68, 34, 0, 1695, 1698, 5, 5, 0, 0, 1696, 1699, 3, 190, 95, 0, 1697, 1699, 3, 108, 54, 0, 1698, 1696, 1, 0, 0, 0, 1698, 1697, 1, 0, 0, 0, 1699, 1700, 1, 0, 0, 0, 1700, 1701, 5, 6, 0, 0, 1701, 1702, 3, 68, 34, 0, 1702, 1704, 1, 0, 0, 0, 1703, 1695, 1, 0, 0, 0, 1704, 1707, 1, 0, 0, 0, 1705, 1703, 1, 0, 0, 0, 1705, 1706, 1, 0, 0, 0, 1706, 1710, 1, 0, 0, 0, 1707, 1705, 1, 0, 0, 0, 1708, 1709, 5, 149, 0, 0, 1709, 1711, 3, 68, 34, 0, 1710, 1708, 1, 0, 0, 0, 1710, 1711, 1, 0, 0, 0, 1711, 1716, 1, 0, 0, 0, 1712, 1714, 3, 134, 67, 0, 1713, 1712, 1, 0, 0, 0, 1713, 1714, 1, 0, 0, 0, 1714, 1715, 1, 0, 0, 0, 1715, 1717, 3, 136, 68, 0, 1716, 1713, 1, 0, 0, 0, 1716, 1717, 1, 0, 0, 0, 1717, 111, 1, 0, 0, 0, 1718, 1719, 3, 182, 91, 0, 1719, 1720, 5, 2, 0, 0, 1720, 1722, 1, 0, 0, 0, 1721, 1718, 1, 0, 0, 0, 1721, 1722, 1, 0, 0, 0, 1722, 1723, 1, 0, 0, 0, 1723, 1726, 3, 184, 92, 0, 1724, 1725, 5, 33, 0, 0, 1725, 1727, 3, 216, 108, 0, 1726, 1724, 1, 0, 0, 0, 1726, 1727, 1, 0, 0, 0, 1727, 1733, 1, 0, 0, 0, 1728, 1729, 5, 85, 0, 0, 1729, 1730, 5, 40, 0, 0, 1730, 1734, 3, 196, 98, 0, 1731, 1732, 5, 102, 0, 0, 1732, 1734, 5, 85, 0, 0, 1733, 1728, 1, 0, 0, 0, 1733, 1731, 1, 0, 0, 0, 1733, 1734, 1, 0, 0, 0, 1734, 113, 1, 0, 0, 0, 1735, 1737, 5, 144, 0, 0, 1736, 1738, 3, 182, 91, 0, 1737, 1736, 1, 0, 0, 0, 1737, 1738, 1, 0, 0, 0, 1738, 1741, 1, 0, 0, 0, 1739, 1740, 5, 91, 0, 0, 1740, 1742, 3, 218, 109, 0, 1741, 1739, 1, 0, 0, 0, 1741, 1742, 1, 0, 0, 0, 1742, 115, 1, 0, 0, 0, 1743, 1744, 5, 179, 0, 0, 1744, 1745, 5, 3, 0, 0, 1745, 1746, 5, 149, 0, 0, 1746, 1747, 3, 68, 34, 0, 1747, 1748, 5, 4, 0, 0, 1748, 117, 1, 0, 0, 0, 1749, 1751, 5, 3, 0, 0, 1750, 1752, 3, 220, 110, 0, 1751, 1750, 1, 0, 0, 0, 1751, 1752, 1, 0, 0, 0, 1752, 1763, 1, 0, 0, 0, 1753, 1754, 5, 154, 0, 0, 1754, 1755, 5, 40, 0, 0, 1755, 1760, 3, 68, 34, 0, 1756, 1757, 5, 5, 0, 0, 1757, 1759, 3, 68, 34, 0, 1758, 1756, 1, 0, 0, 0, 1759, 1762, 1, 0, 0, 0, 1760, 1758, 1, 0, 0, 0, 1760, 1761, 1, 0, 0, 0, 1761, 1764, 1, 0, 0, 0, 1762, 1760, 1, 0, 0, 0, 1763, 1753, 1, 0, 0, 0, 1763, 1764, 1, 0, 0, 0, 1764, 1765, 1, 0, 0, 0, 1765, 1766, 5, 109, 0, 0, 1766, 1767, 5, 40, 0, 0, 1767, 1772, 3, 138, 69, 0, 1768, 1769, 5, 5, 0, 0, 1769, 1771, 3, 138, 69, 0, 1770, 1768, 1, 0, 0, 0, 1771, 1774, 1, 0, 0, 0, 1772, 1770, 1, 0, 0, 0, 1772, 1773, 1, 0, 0, 0, 1773, 1776, 1, 0, 0, 0, 1774, 1772, 1, 0, 0, 0, 1775, 1777, 3, 122, 61, 0, 1776, 1775, 1, 0, 0, 0, 1776, 1777, 1, 0, 0, 0, 1777, 1778, 1, 0, 0, 0, 1778, 1779, 5, 4, 0, 0, 1779, 119, 1, 0, 0, 0, 1780, 1814, 5, 153, 0, 0, 1781, 1815, 3, 214, 107, 0, 1782, 1784, 5, 3, 0, 0, 1783, 1785, 3, 220, 110, 0, 1784, 1783, 1, 0, 0, 0, 1784, 1785, 1, 0, 0, 0, 1785, 1796, 1, 0, 0, 0, 1786, 1787, 5, 154, 0, 0, 1787, 1788, 5, 40, 0, 0, 1788, 1793, 3, 68, 34, 0, 1789, 1790, 5, 5, 0, 0, 1790, 1792, 3, 68, 34, 0, 1791, 1789, 1, 0, 0, 0, 1792, 1795, 1, 0, 0, 0, 1793, 1791, 1, 0, 0, 0, 1793, 1794, 1, 0, 0, 0, 1794, 1797, 1, 0, 0, 0, 1795, 1793, 1, 0, 0, 0, 1796, 1786, 1, 0, 0, 0, 1796, 1797, 1, 0, 0, 0, 1797, 1808, 1, 0, 0, 0, 1798, 1799, 5, 109, 0, 0, 1799, 1800, 5, 40, 0, 0, 1800, 1805, 3, 138, 69, 0, 1801, 1802, 5, 5, 0, 0, 1802, 1804, 3, 138, 69, 0, 1803, 1801, 1, 0, 0, 0, 1804, 1807, 1, 0, 0, 0, 1805, 1803, 1, 0, 0, 0, 1805, 1806, 1, 0, 0, 0, 1806, 1809, 1, 0, 0, 0, 1807, 1805, 1, 0, 0, 0, 1808, 1798, 1, 0, 0, 0, 1808, 1809, 1, 0, 0, 0, 1809, 1811, 1, 0, 0, 0, 1810, 1812, 3, 122, 61, 0, 1811, 1810, 1, 0, 0, 0, 1811, 1812, 1, 0, 0, 0, 1812, 1813, 1, 0, 0, 0, 1813, 1815, 5, 4, 0, 0, 1814, 1781, 1, 0, 0, 0, 1814, 1782, 1, 0, 0, 0, 1815, 121, 1, 0, 0, 0, 1816, 1824, 3, 124, 62, 0, 1817, 1818, 5, 181, 0, 0, 1818, 1819, 5, 101, 0, 0, 1819, 1825, 5, 183, 0, 0, 1820, 1821, 5, 158, 0, 0, 1821, 1825, 5, 127, 0, 0, 1822, 1825, 5, 78, 0, 0, 1823, 1825, 5, 182, 0, 0, 1824, 1817, 1, 0, 0, 0, 1824, 1820, 1, 0, 0, 0, 1824, 1822, 1, 0, 0, 0, 1824, 1823, 1, 0, 0, 0, 1824, 1825, 1, 0, 0, 0, 1825, 123, 1, 0, 0, 0, 1826, 1833, 7, 18, 0, 0, 1827, 1834, 3, 146, 73, 0, 1828, 1829, 5, 39, 0, 0, 1829, 1830, 3, 142, 71, 0, 1830, 1831, 5, 32, 0, 0, 1831, 1832, 3, 144, 72, 0, 1832, 1834, 1, 0, 0, 0, 1833, 1827, 1, 0, 0, 0, 1833, 1828, 1, 0, 0, 0, 1834, 125, 1, 0, 0, 0, 1835, 1836, 3, 222, 111, 0, 1836, 1846, 5, 3, 0, 0, 1837, 1842, 3, 68, 34, 0, 1838, 1839, 5, 5, 0, 0, 1839, 1841, 3, 68, 34, 0, 1840, 1838, 1, 0, 0, 0, 1841, 1844, 1, 0, 0, 0, 1842, 1840, 1, 0, 0, 0, 1842, 1843, 1, 0, 0, 0, 1843, 1847, 1, 0, 0, 0, 1844, 1842, 1, 0, 0, 0, 1845, 1847, 5, 7, 0, 0, 1846, 1837, 1, 0, 0, 0, 1846, 1845, 1, 0, 0, 0, 1847, 1848, 1, 0, 0, 0, 1848, 1849, 5, 4, 0, 0, 1849, 127, 1, 0, 0, 0, 1850, 1851, 3, 224, 112, 0, 1851, 1864, 5, 3, 0, 0, 1852, 1854, 5, 62, 0, 0, 1853, 1852, 1, 0, 0, 0, 1853, 1854, 1, 0, 0, 0, 1854, 1855, 1, 0, 0, 0, 1855, 1860, 3, 68, 34, 0, 1856, 1857, 5, 5, 0, 0, 1857, 1859, 3, 68, 34, 0, 1858, 1856, 1, 0, 0, 0, 1859, 1862, 1, 0, 0, 0, 1860, 1858, 1, 0, 0, 0, 1860, 1861, 1, 0, 0, 0, 1861, 1865, 1, 0, 0, 0, 1862, 1860, 1, 0, 0, 0, 1863, 1865, 5, 7, 0, 0, 1864, 1853, 1, 0, 0, 0, 1864, 1863, 1, 0, 0, 0, 1864, 1865, 1, 0, 0, 0, 1865, 1866, 1, 0, 0, 0, 1866, 1868, 5, 4, 0, 0, 1867, 1869, 3, 116, 58, 0, 1868, 1867, 1, 0, 0, 0, 1868, 1869, 1, 0, 0, 0, 1869, 129, 1, 0, 0, 0, 1870, 1871, 3, 148, 74, 0, 1871, 1881, 5, 3, 0, 0, 1872, 1877, 3, 68, 34, 0, 1873, 1874, 5, 5, 0, 0, 1874, 1876, 3, 68, 34, 0, 1875, 1873, 1, 0, 0, 0, 1876, 1879, 1, 0, 0, 0, 1877, 1875, 1, 0, 0, 0, 1877, 1878, 1, 0, 0, 0, 1878, 1882, 1, 0, 0, 0, 1879, 1877, 1, 0, 0, 0, 1880, 1882, 5, 7, 0, 0, 1881, 1872, 1, 0, 0, 0, 1881, 1880, 1, 0, 0, 0, 1881, 1882, 1, 0, 0, 0, 1882, 1883, 1, 0, 0, 0, 1883, 1885, 5, 4, 0, 0, 1884, 1886, 3, 116, 58, 0, 1885, 1884, 1, 0, 0, 0, 1885, 1886, 1, 0, 0, 0, 1886, 1887, 1, 0, 0, 0, 1887, 1890, 5, 153, 0, 0, 1888, 1891, 3, 118, 59, 0, 1889, 1891, 3, 214, 107, 0, 1890, 1888, 1, 0, 0, 0, 1890, 1889, 1, 0, 0, 0, 1891, 131, 1, 0, 0, 0, 1892, 1894, 5, 150, 0, 0, 1893, 1895, 5, 116, 0, 0, 1894, 1893, 1, 0, 0, 0, 1894, 1895, 1, 0, 0, 0, 1895, 1896, 1, 0, 0, 0, 1896, 1901, 3, 56, 28, 0, 1897, 1898, 5, 5, 0, 0, 1898, 1900, 3, 56, 28, 0, 1899, 1897, 1, 0, 0, 0, 1900, 1903, 1, 0, 0, 0, 1901, 1899, 1, 0, 0, 0, 1901, 1902, 1, 0, 0, 0, 1902, 133, 1, 0, 0, 0, 1903, 1901, 1, 0, 0, 0, 1904, 1905, 5, 109, 0, 0, 1905, 1906, 5, 40, 0, 0, 1906, 1911, 3, 138, 69, 0, 1907, 1908, 5, 5, 0, 0, 1908, 1910, 3, 138, 69, 0, 1909, 1907, 1, 0, 0, 0, 1910, 1913, 1, 0, 0, 0, 1911, 1909, 1, 0, 0, 0, 1911, 1912, 1, 0, 0, 0, 1912, 135, 1, 0, 0, 0, 1913, 1911, 1, 0, 0, 0, 1914, 1915, 5, 98, 0, 0, 1915, 1918, 3, 68, 34, 0, 1916, 1917, 7, 19, 0, 0, 1917, 1919, 3, 68, 34, 0, 1918, 1916, 1, 0, 0, 0, 1918, 1919, 1, 0, 0, 0, 1919, 137, 1, 0, 0, 0, 1920, 1923, 3, 68, 34, 0, 1921, 1922, 5, 45, 0, 0, 1922, 1924, 3, 192, 96, 0, 1923, 1921, 1, 0, 0, 0, 1923, 1924, 1, 0, 0, 0, 1924, 1926, 1, 0, 0, 0, 1925, 1927, 3, 140, 70, 0, 1926, 1925, 1, 0, 0, 0, 1926, 1927, 1, 0, 0, 0, 1927, 1930, 1, 0, 0, 0, 1928, 1929, 5, 176, 0, 0, 1929, 1931, 7, 20, 0, 0, 1930, 1928, 1, 0, 0, 0, 1930, 1931, 1, 0, 0, 0, 1931, 139, 1, 0, 0, 0, 1932, 1933, 7, 21, 0, 0, 1933, 141, 1, 0, 0, 0, 1934, 1935, 3, 68, 34, 0, 1935, 1936, 5, 156, 0, 0, 1936, 1945, 1, 0, 0, 0, 1937, 1938, 3, 68, 34, 0, 1938, 1939, 5, 159, 0, 0, 1939, 1945, 1, 0, 0, 0, 1940, 1941, 5, 158, 0, 0, 1941, 1945, 5, 127, 0, 0, 1942, 1943, 5, 157, 0, 0, 1943, 1945, 5, 156, 0, 0, 1944, 1934, 1, 0, 0, 0, 1944, 1937, 1, 0, 0, 0, 1944, 1940, 1, 0, 0, 0, 1944, 1942, 1, 0, 0, 0, 1945, 143, 1, 0, 0, 0, 1946, 1947, 3, 68, 34, 0, 1947, 1948, 5, 156, 0, 0, 1948, 1957, 1, 0, 0, 0, 1949, 1950, 3, 68, 34, 0, 1950, 1951, 5, 159, 0, 0, 1951, 1957, 1, 0, 0, 0, 1952, 1953, 5, 158, 0, 0, 1953, 1957, 5, 127, 0, 0, 1954, 1955, 5, 157, 0, 0, 1955, 1957, 5, 159, 0, 0, 1956, 1946, 1, 0, 0, 0, 1956, 1949, 1, 0, 0, 0, 1956, 1952, 1, 0, 0, 0, 1956, 1954, 1, 0, 0, 0, 1957, 145, 1, 0, 0, 0, 1958, 1959, 3, 68, 34, 0, 1959, 1960, 5, 156, 0, 0, 1960, 1966, 1, 0, 0, 0, 1961, 1962, 5, 157, 0, 0, 1962, 1966, 5, 156, 0, 0, 1963, 1964, 5, 158, 0, 0, 1964, 1966, 5, 127, 0, 0, 1965, 1958, 1, 0, 0, 0, 1965, 1961, 1, 0, 0, 0, 1965, 1963, 1, 0, 0, 0, 1966, 147, 1, 0, 0, 0, 1967, 1968, 7, 22, 0, 0, 1968, 1969, 5, 3, 0, 0, 1969, 1970, 3, 68, 34, 0, 1970, 1971, 5, 4, 0, 0, 1971, 1972, 5, 153, 0, 0, 1972, 1974, 5, 3, 0, 0, 1973, 1975, 3, 154, 77, 0, 1974, 1973, 1, 0, 0, 0, 1974, 1975, 1, 0, 0, 0, 1975, 1976, 1, 0, 0, 0, 1976, 1978, 3, 158, 79, 0, 1977, 1979, 3, 124, 62, 0, 1978, 1977, 1, 0, 0, 0, 1978, 1979, 1, 0, 0, 0, 1979, 1980, 1, 0, 0, 0, 1980, 1981, 5, 4, 0, 0, 1981, 2053, 1, 0, 0, 0, 1982, 1983, 7, 23, 0, 0, 1983, 1984, 5, 3, 0, 0, 1984, 1985, 5, 4, 0, 0, 1985, 1986, 5, 153, 0, 0, 1986, 1988, 5, 3, 0, 0, 1987, 1989, 3, 154, 77, 0, 1988, 1987, 1, 0, 0, 0, 1988, 1989, 1, 0, 0, 0, 1989, 1991, 1, 0, 0, 0, 1990, 1992, 3, 156, 78, 0, 1991, 1990, 1, 0, 0, 0, 1991, 1992, 1, 0, 0, 0, 1992, 1993, 1, 0, 0, 0, 1993, 2053, 5, 4, 0, 0, 1994, 1995, 7, 24, 0, 0, 1995, 1996, 5, 3, 0, 0, 1996, 1997, 5, 4, 0, 0, 1997, 1998, 5, 153, 0, 0, 1998, 2000, 5, 3, 0, 0, 1999, 2001, 3, 154, 77, 0, 2000, 1999, 1, 0, 0, 0, 2000, 2001, 1, 0, 0, 0, 2001, 2002, 1, 0, 0, 0, 2002, 2003, 3, 158, 79, 0, 2003, 2004, 5, 4, 0, 0, 2004, 2053, 1, 0, 0, 0, 2005, 2006, 7, 25, 0, 0, 2006, 2007, 5, 3, 0, 0, 2007, 2009, 3, 68, 34, 0, 2008, 2010, 3, 150, 75, 0, 2009, 2008, 1, 0, 0, 0, 2009, 2010, 1, 0, 0, 0, 2010, 2012, 1, 0, 0, 0, 2011, 2013, 3, 152, 76, 0, 2012, 2011, 1, 0, 0, 0, 2012, 2013, 1, 0, 0, 0, 2013, 2014, 1, 0, 0, 0, 2014, 2015, 5, 4, 0, 0, 2015, 2016, 5, 153, 0, 0, 2016, 2018, 5, 3, 0, 0, 2017, 2019, 3, 154, 77, 0, 2018, 2017, 1, 0, 0, 0, 2018, 2019, 1, 0, 0, 0, 2019, 2020, 1, 0, 0, 0, 2020, 2021, 3, 158, 79, 0, 2021, 2022, 5, 4, 0, 0, 2022, 2053, 1, 0, 0, 0, 2023, 2024, 5, 165, 0, 0, 2024, 2025, 5, 3, 0, 0, 2025, 2026, 3, 68, 34, 0, 2026, 2027, 5, 5, 0, 0, 2027, 2028, 3, 36, 18, 0, 2028, 2029, 5, 4, 0, 0, 2029, 2030, 5, 153, 0, 0, 2030, 2032, 5, 3, 0, 0, 2031, 2033, 3, 154, 77, 0, 2032, 2031, 1, 0, 0, 0, 2032, 2033, 1, 0, 0, 0, 2033, 2034, 1, 0, 0, 0, 2034, 2036, 3, 158, 79, 0, 2035, 2037, 3, 124, 62, 0, 2036, 2035, 1, 0, 0, 0, 2036, 2037, 1, 0, 0, 0, 2037, 2038, 1, 0, 0, 0, 2038, 2039, 5, 4, 0, 0, 2039, 2053, 1, 0, 0, 0, 2040, 2041, 5, 166, 0, 0, 2041, 2042, 5, 3, 0, 0, 2042, 2043, 3, 68, 34, 0, 2043, 2044, 5, 4, 0, 0, 2044, 2045, 5, 153, 0, 0, 2045, 2047, 5, 3, 0, 0, 2046, 2048, 3, 154, 77, 0, 2047, 2046, 1, 0, 0, 0, 2047, 2048, 1, 0, 0, 0, 2048, 2049, 1, 0, 0, 0, 2049, 2050, 3, 158, 79, 0, 2050, 2051, 5, 4, 0, 0, 2051, 2053, 1, 0, 0, 0, 2052, 1967, 1, 0, 0, 0, 2052, 1982, 1, 0, 0, 0, 2052, 1994, 1, 0, 0, 0, 2052, 2005, 1, 0, 0, 0, 2052, 2023, 1, 0, 0, 0, 2052, 2040, 1, 0, 0, 0, 2053, 149, 1, 0, 0, 0, 2054, 2055, 5, 5, 0, 0, 2055, 2056, 3, 36, 18, 0, 2056, 151, 1, 0, 0, 0, 2057, 2058, 5, 5, 0, 0, 2058, 2059, 3, 36, 18, 0, 2059, 153, 1, 0, 0, 0, 2060, 2061, 5, 154, 0, 0, 2061, 2063, 5, 40, 0, 0, 2062, 2064, 3, 68, 34, 0, 2063, 2062, 1, 0, 0, 0, 2064, 2065, 1, 0, 0, 0, 2065, 2063, 1, 0, 0, 0, 2065, 2066, 1, 0, 0, 0, 2066, 155, 1, 0, 0, 0, 2067, 2068, 5, 109, 0, 0, 2068, 2070, 5, 40, 0, 0, 2069, 2071, 3, 68, 34, 0, 2070, 2069, 1, 0, 0, 0, 2071, 2072, 1, 0, 0, 0, 2072, 2070, 1, 0, 0, 0, 2072, 2073, 1, 0, 0, 0, 2073, 157, 1, 0, 0, 0, 2074, 2075, 5, 109, 0, 0, 2075, 2076, 5, 40, 0, 0, 2076, 2077, 3, 158, 79, 0, 2077, 159, 1, 0, 0, 0, 2078, 2080, 3, 68, 34, 0, 2079, 2081, 3, 140, 70, 0, 2080, 2079, 1, 0, 0, 0, 2080, 2081, 1, 0, 0, 0, 2081, 2089, 1, 0, 0, 0, 2082, 2083, 5, 5, 0, 0, 2083, 2085, 3, 68, 34, 0, 2084, 2086, 3, 140, 70, 0, 2085, 2084, 1, 0, 0, 0, 2085, 2086, 1, 0, 0, 0, 2086, 2088, 1, 0, 0, 0, 2087, 2082, 1, 0, 0, 0, 2088, 2091, 1, 0, 0, 0, 2089, 2087, 1, 0, 0, 0, 2089, 2090, 1, 0, 0, 0, 2090, 161, 1, 0, 0, 0, 2091, 2089, 1, 0, 0, 0, 2092, 2093, 3, 84, 42, 0, 2093, 163, 1, 0, 0, 0, 2094, 2095, 3, 84, 42, 0, 2095, 165, 1, 0, 0, 0, 2096, 2097, 7, 26, 0, 0, 2097, 167, 1, 0, 0, 0, 2098, 2099, 5, 190, 0, 0, 2099, 169, 1, 0, 0, 0, 2100, 2103, 3, 68, 34, 0, 2101, 2103, 3, 30, 15, 0, 2102, 2100, 1, 0, 0, 0, 2102, 2101, 1, 0, 0, 0, 2103, 171, 1, 0, 0, 0, 2104, 2105, 7, 27, 0, 0, 2105, 173, 1, 0, 0, 0, 2106, 2107, 7, 28, 0, 0, 2107, 175, 1, 0, 0, 0, 2108, 2109, 3, 228, 114, 0, 2109, 177, 1, 0, 0, 0, 2110, 2111, 3, 228, 114, 0, 2111, 179, 1, 0, 0, 0, 2112, 2113, 3, 182, 91, 0, 2113, 2114, 5, 2, 0, 0, 2114, 2116, 1, 0, 0, 0, 2115, 2112, 1, 0, 0, 0, 2115, 2116, 1, 0, 0, 0, 2116, 2117, 1, 0, 0, 0, 2117, 2118, 3, 178, 89, 0, 2118, 181, 1, 0, 0, 0, 2119, 2120, 3, 228, 114, 0, 2120, 183, 1, 0, 0, 0, 2121, 2122, 3, 228, 114, 0, 2122, 185, 1, 0, 0, 0, 2123, 2124, 3, 228, 114, 0, 2124, 187, 1, 0, 0, 0, 2125, 2126, 3, 228, 114, 0, 2126, 189, 1, 0, 0, 0, 2127, 2128, 3, 228, 114, 0, 2128, 191, 1, 0, 0, 0, 2129, 2130, 3, 228, 114, 0, 2130, 193, 1, 0, 0, 0, 2131, 2132, 3, 228, 114, 0, 2132, 195, 1, 0, 0, 0, 2133, 2134, 3, 228, 114, 0, 2134, 197, 1, 0, 0, 0, 2135, 2136, 3, 228, 114, 0, 2136, 199, 1, 0, 0, 0, 2137, 2138, 3, 228, 114, 0, 2138, 201, 1, 0, 0, 0, 2139, 2140, 3, 228, 114, 0, 2140, 203, 1, 0, 0, 0, 2141, 2142, 3, 228, 114, 0, 2142, 205, 1, 0, 0, 0, 2143, 2144, 3, 228, 114, 0, 2144, 207, 1, 0, 0, 0, 2145, 2146, 7, 27, 0, 0, 2146, 209, 1, 0, 0, 0, 2147, 2148, 3, 228, 114, 0, 2148, 211, 1, 0, 0, 0, 2149, 2150, 3, 228, 114, 0, 2150, 213, 1, 0, 0, 0, 2151, 2152, 3, 228, 114, 0, 2152, 215, 1, 0, 0, 0, 2153, 2154, 3, 228, 114, 0, 2154, 217, 1, 0, 0, 0, 2155, 2156, 3, 228, 114, 0, 2156, 219, 1, 0, 0, 0, 2157, 2158, 3, 228, 114, 0, 2158, 221, 1, 0, 0, 0, 2159, 2160, 3, 228, 114, 0, 2160, 223, 1, 0, 0, 0, 2161, 2162, 3, 228, 114, 0, 2162, 225, 1, 0, 0, 0, 2163, 2164, 3, 228, 114, 0, 2164, 227, 1, 0, 0, 0, 2165, 2173, 5, 186, 0, 0, 2166, 2173, 3, 174, 87, 0, 2167, 2173, 5, 190, 0, 0, 2168, 2169, 5, 3, 0, 0, 2169, 2170, 3, 228, 114, 0, 2170, 2171, 5, 4, 0, 0, 2171, 2173, 1, 0, 0, 0, 2172, 2165, 1, 0, 0, 0, 2172, 2166, 1, 0, 0, 0, 2172, 2167, 1, 0, 0, 0, 2172, 2168, 1, 0, 0, 0, 2173, 229, 1, 0, 0, 0, 314, 233, 241, 248, 253, 259, 265, 267, 293, 300, 307, 313, 317, 322, 325, 332, 335, 339, 347, 351, 353, 357, 361, 365, 368, 375, 381, 387, 392, 403, 409, 413, 417, 420, 425, 429, 435, 440, 449, 456, 465, 468, 472, 476, 481, 487, 499, 503, 508, 511, 514, 519, 522, 536, 543, 550, 552, 555, 561, 566, 574, 579, 594, 600, 610, 615, 625, 629, 631, 635, 640, 642, 650, 656, 661, 668, 679, 682, 684, 691, 695, 702, 708, 714, 720, 725, 734, 739, 750, 755, 766, 771, 775, 791, 801, 806, 814, 826, 831, 842, 845, 847, 853, 856, 858, 862, 866, 873, 876, 879, 886, 889, 892, 895, 899, 907, 912, 923, 928, 937, 944, 948, 952, 955, 963, 976, 979, 987, 996, 1000, 1005, 1031, 1038, 1049, 1058, 1068, 1071, 1077, 1083, 1092, 1095, 1099, 1106, 1112, 1119, 1121, 1123, 1132, 1139, 1146, 1152, 1157, 1165, 1170, 1179, 1190, 1197, 1201, 1204, 1207, 1211, 1221, 1227, 1229, 1237, 1244, 1251, 1256, 1258, 1264, 1273, 1278, 1285, 1289, 1291, 1294, 1302, 1306, 1309, 1318, 1323, 1330, 1339, 1343, 1345, 1349, 1358, 1363, 1365, 1378, 1381, 1390, 1401, 1408, 1411, 1416, 1420, 1423, 1426, 1431, 1435, 1440, 1443, 1446, 1451, 1455, 1458, 1465, 1470, 1479, 1484, 1487, 1495, 1499, 1507, 1510, 1515, 1519, 1522, 1529, 1534, 1543, 1548, 1551, 1559, 1563, 1571, 1574, 1576, 1585, 1588, 1590, 1594, 1598, 1601, 1606, 1617, 1622, 1626, 1630, 1633, 1638, 1644, 1651, 1658, 1663, 1666, 1674, 1680, 1685, 1691, 1698, 1705, 1710, 1713, 1716, 1721, 1726, 1733, 1737, 1741, 1751, 1760, 1763, 1772, 1776, 1784, 1793, 1796, 1805, 1808, 1811, 1814, 1824, 1833, 1842, 1846, 1853, 1860, 1864, 1868, 1877, 1881, 1885, 1890, 1894, 1901, 1911, 1918, 1923, 1926, 1930, 1944, 1956, 1965, 1974, 1978, 1988, 1991, 2000, 2009, 2012, 2018, 2032, 2036, 2047, 2052, 2065, 2072, 2080, 2085, 2089, 2102, 2115, 2172] \ No newline at end of file +[4, 1, 197, 2176, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, 7, 83, 2, 84, 7, 84, 2, 85, 7, 85, 2, 86, 7, 86, 2, 87, 7, 87, 2, 88, 7, 88, 2, 89, 7, 89, 2, 90, 7, 90, 2, 91, 7, 91, 2, 92, 7, 92, 2, 93, 7, 93, 2, 94, 7, 94, 2, 95, 7, 95, 2, 96, 7, 96, 2, 97, 7, 97, 2, 98, 7, 98, 2, 99, 7, 99, 2, 100, 7, 100, 2, 101, 7, 101, 2, 102, 7, 102, 2, 103, 7, 103, 2, 104, 7, 104, 2, 105, 7, 105, 2, 106, 7, 106, 2, 107, 7, 107, 2, 108, 7, 108, 2, 109, 7, 109, 2, 110, 7, 110, 2, 111, 7, 111, 2, 112, 7, 112, 2, 113, 7, 113, 2, 114, 7, 114, 1, 0, 5, 0, 232, 8, 0, 10, 0, 12, 0, 235, 9, 0, 1, 0, 1, 0, 1, 1, 5, 1, 240, 8, 1, 10, 1, 12, 1, 243, 9, 1, 1, 1, 1, 1, 4, 1, 247, 8, 1, 11, 1, 12, 1, 248, 1, 1, 5, 1, 252, 8, 1, 10, 1, 12, 1, 255, 9, 1, 1, 1, 5, 1, 258, 8, 1, 10, 1, 12, 1, 261, 9, 1, 1, 2, 1, 2, 1, 2, 3, 2, 266, 8, 2, 3, 2, 268, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 294, 8, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 301, 8, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 308, 8, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 314, 8, 3, 1, 3, 1, 3, 3, 3, 318, 8, 3, 1, 3, 1, 3, 1, 3, 3, 3, 323, 8, 3, 1, 3, 3, 3, 326, 8, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 333, 8, 4, 1, 4, 3, 4, 336, 8, 4, 1, 5, 1, 5, 3, 5, 340, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 3, 6, 348, 8, 6, 1, 6, 1, 6, 3, 6, 352, 8, 6, 3, 6, 354, 8, 6, 1, 7, 1, 7, 3, 7, 358, 8, 7, 1, 8, 1, 8, 3, 8, 362, 8, 8, 1, 8, 1, 8, 3, 8, 366, 8, 8, 1, 8, 3, 8, 369, 8, 8, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 3, 10, 376, 8, 10, 1, 10, 1, 10, 1, 11, 1, 11, 3, 11, 382, 8, 11, 1, 11, 1, 11, 1, 11, 1, 11, 3, 11, 388, 8, 11, 1, 11, 1, 11, 1, 11, 3, 11, 393, 8, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 5, 11, 402, 8, 11, 10, 11, 12, 11, 405, 9, 11, 1, 11, 1, 11, 1, 11, 3, 11, 410, 8, 11, 1, 12, 1, 12, 3, 12, 414, 8, 12, 1, 12, 1, 12, 3, 12, 418, 8, 12, 1, 12, 3, 12, 421, 8, 12, 1, 13, 1, 13, 1, 13, 3, 13, 426, 8, 13, 1, 14, 1, 14, 3, 14, 430, 8, 14, 1, 14, 1, 14, 1, 14, 1, 14, 3, 14, 436, 8, 14, 1, 14, 1, 14, 1, 14, 3, 14, 441, 8, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 5, 14, 448, 8, 14, 10, 14, 12, 14, 451, 9, 14, 1, 14, 1, 14, 5, 14, 455, 8, 14, 10, 14, 12, 14, 458, 9, 14, 1, 14, 1, 14, 1, 14, 1, 14, 5, 14, 464, 8, 14, 10, 14, 12, 14, 467, 9, 14, 3, 14, 469, 8, 14, 1, 14, 1, 14, 3, 14, 473, 8, 14, 1, 15, 1, 15, 3, 15, 477, 8, 15, 1, 15, 5, 15, 480, 8, 15, 10, 15, 12, 15, 483, 9, 15, 1, 16, 4, 16, 486, 8, 16, 11, 16, 12, 16, 487, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 3, 16, 500, 8, 16, 1, 17, 1, 17, 3, 17, 504, 8, 17, 1, 17, 1, 17, 1, 17, 3, 17, 509, 8, 17, 1, 17, 3, 17, 512, 8, 17, 1, 17, 3, 17, 515, 8, 17, 1, 17, 1, 17, 1, 17, 3, 17, 520, 8, 17, 1, 17, 3, 17, 523, 8, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 537, 8, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 544, 8, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 551, 8, 17, 3, 17, 553, 8, 17, 1, 18, 3, 18, 556, 8, 18, 1, 18, 1, 18, 1, 19, 1, 19, 3, 19, 562, 8, 19, 1, 19, 1, 19, 1, 19, 3, 19, 567, 8, 19, 1, 19, 1, 19, 1, 19, 1, 19, 5, 19, 573, 8, 19, 10, 19, 12, 19, 576, 9, 19, 1, 19, 1, 19, 3, 19, 580, 8, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 5, 19, 593, 8, 19, 10, 19, 12, 19, 596, 9, 19, 1, 19, 1, 19, 1, 19, 3, 19, 601, 8, 19, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 5, 20, 609, 8, 20, 10, 20, 12, 20, 612, 9, 20, 1, 20, 1, 20, 3, 20, 616, 8, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 3, 20, 626, 8, 20, 1, 20, 1, 20, 5, 20, 630, 8, 20, 10, 20, 12, 20, 633, 9, 20, 1, 20, 3, 20, 636, 8, 20, 1, 20, 1, 20, 1, 20, 3, 20, 641, 8, 20, 3, 20, 643, 8, 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 22, 1, 22, 3, 22, 651, 8, 22, 1, 22, 1, 22, 1, 22, 1, 22, 3, 22, 657, 8, 22, 1, 22, 1, 22, 1, 22, 3, 22, 662, 8, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 3, 22, 669, 8, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 5, 22, 678, 8, 22, 10, 22, 12, 22, 681, 9, 22, 3, 22, 683, 8, 22, 3, 22, 685, 8, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 3, 22, 692, 8, 22, 1, 22, 1, 22, 3, 22, 696, 8, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 3, 22, 703, 8, 22, 1, 22, 1, 22, 4, 22, 707, 8, 22, 11, 22, 12, 22, 708, 1, 22, 1, 22, 1, 23, 1, 23, 3, 23, 715, 8, 23, 1, 23, 1, 23, 1, 23, 1, 23, 3, 23, 721, 8, 23, 1, 23, 1, 23, 1, 23, 3, 23, 726, 8, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 5, 23, 733, 8, 23, 10, 23, 12, 23, 736, 9, 23, 1, 23, 1, 23, 3, 23, 740, 8, 23, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 3, 24, 751, 8, 24, 1, 24, 1, 24, 1, 24, 3, 24, 756, 8, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 5, 24, 765, 8, 24, 10, 24, 12, 24, 768, 9, 24, 1, 24, 1, 24, 3, 24, 772, 8, 24, 1, 25, 1, 25, 3, 25, 776, 8, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 5, 25, 790, 8, 25, 10, 25, 12, 25, 793, 9, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 5, 26, 800, 8, 26, 10, 26, 12, 26, 803, 9, 26, 1, 26, 1, 26, 3, 26, 807, 8, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 3, 27, 815, 8, 27, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 5, 28, 825, 8, 28, 10, 28, 12, 28, 828, 9, 28, 1, 28, 1, 28, 3, 28, 832, 8, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 29, 1, 29, 1, 29, 1, 29, 3, 29, 843, 8, 29, 1, 29, 3, 29, 846, 8, 29, 3, 29, 848, 8, 29, 1, 29, 1, 29, 1, 29, 1, 29, 3, 29, 854, 8, 29, 1, 29, 3, 29, 857, 8, 29, 3, 29, 859, 8, 29, 5, 29, 861, 8, 29, 10, 29, 12, 29, 864, 9, 29, 1, 30, 3, 30, 867, 8, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 3, 30, 874, 8, 30, 1, 30, 3, 30, 877, 8, 30, 1, 31, 3, 31, 880, 8, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 3, 31, 887, 8, 31, 1, 31, 3, 31, 890, 8, 31, 1, 31, 3, 31, 893, 8, 31, 1, 31, 3, 31, 896, 8, 31, 1, 32, 1, 32, 3, 32, 900, 8, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 33, 3, 33, 908, 8, 33, 1, 33, 1, 33, 1, 33, 3, 33, 913, 8, 33, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 924, 8, 34, 1, 34, 1, 34, 1, 34, 3, 34, 929, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 938, 8, 34, 1, 34, 1, 34, 1, 34, 5, 34, 943, 8, 34, 10, 34, 12, 34, 946, 9, 34, 1, 34, 3, 34, 949, 8, 34, 1, 34, 1, 34, 3, 34, 953, 8, 34, 1, 34, 3, 34, 956, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 5, 34, 962, 8, 34, 10, 34, 12, 34, 965, 9, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 977, 8, 34, 1, 34, 3, 34, 980, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 988, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 4, 34, 995, 8, 34, 11, 34, 12, 34, 996, 1, 34, 1, 34, 3, 34, 1001, 8, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1006, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1035, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1042, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1053, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1062, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 5, 34, 1070, 8, 34, 10, 34, 12, 34, 1073, 9, 34, 3, 34, 1075, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1081, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1087, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 5, 34, 1094, 8, 34, 10, 34, 12, 34, 1097, 9, 34, 3, 34, 1099, 8, 34, 1, 34, 1, 34, 3, 34, 1103, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1110, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1116, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1123, 8, 34, 5, 34, 1125, 8, 34, 10, 34, 12, 34, 1128, 9, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 3, 35, 1136, 8, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 37, 3, 37, 1143, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 1150, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 1156, 8, 37, 1, 37, 1, 37, 1, 37, 3, 37, 1161, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 5, 37, 1167, 8, 37, 10, 37, 12, 37, 1170, 9, 37, 1, 37, 1, 37, 3, 37, 1174, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 5, 37, 1181, 8, 37, 10, 37, 12, 37, 1184, 9, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 5, 37, 1192, 8, 37, 10, 37, 12, 37, 1195, 9, 37, 1, 37, 1, 37, 5, 37, 1199, 8, 37, 10, 37, 12, 37, 1202, 9, 37, 1, 37, 1, 37, 1, 37, 3, 37, 1207, 8, 37, 1, 37, 3, 37, 1210, 8, 37, 1, 37, 3, 37, 1213, 8, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 5, 38, 1221, 8, 38, 10, 38, 12, 38, 1224, 9, 38, 1, 38, 1, 38, 1, 38, 3, 38, 1229, 8, 38, 3, 38, 1231, 8, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 1239, 8, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 1246, 8, 38, 1, 38, 1, 38, 1, 38, 5, 38, 1251, 8, 38, 10, 38, 12, 38, 1254, 9, 38, 1, 38, 1, 38, 3, 38, 1258, 8, 38, 3, 38, 1260, 8, 38, 1, 39, 1, 39, 1, 39, 1, 39, 3, 39, 1266, 8, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 3, 39, 1275, 8, 39, 1, 40, 1, 40, 1, 40, 3, 40, 1280, 8, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 3, 41, 1287, 8, 41, 1, 41, 1, 41, 3, 41, 1291, 8, 41, 3, 41, 1293, 8, 41, 1, 42, 3, 42, 1296, 8, 42, 1, 42, 1, 42, 1, 42, 1, 42, 5, 42, 1302, 8, 42, 10, 42, 12, 42, 1305, 9, 42, 1, 42, 3, 42, 1308, 8, 42, 1, 42, 3, 42, 1311, 8, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 5, 43, 1318, 8, 43, 10, 43, 12, 43, 1321, 9, 43, 1, 44, 1, 44, 3, 44, 1325, 8, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1330, 8, 44, 10, 44, 12, 44, 1333, 9, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1339, 8, 44, 10, 44, 12, 44, 1342, 9, 44, 1, 44, 3, 44, 1345, 8, 44, 3, 44, 1347, 8, 44, 1, 44, 1, 44, 3, 44, 1351, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1358, 8, 44, 10, 44, 12, 44, 1361, 9, 44, 1, 44, 1, 44, 3, 44, 1365, 8, 44, 3, 44, 1367, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1378, 8, 44, 10, 44, 12, 44, 1381, 9, 44, 3, 44, 1383, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1390, 8, 44, 10, 44, 12, 44, 1393, 9, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1401, 8, 44, 10, 44, 12, 44, 1404, 9, 44, 1, 44, 1, 44, 5, 44, 1408, 8, 44, 10, 44, 12, 44, 1411, 9, 44, 3, 44, 1413, 8, 44, 1, 45, 1, 45, 1, 46, 3, 46, 1418, 8, 46, 1, 46, 1, 46, 3, 46, 1422, 8, 46, 1, 46, 3, 46, 1425, 8, 46, 1, 47, 3, 47, 1428, 8, 47, 1, 47, 1, 47, 1, 47, 3, 47, 1433, 8, 47, 1, 47, 1, 47, 3, 47, 1437, 8, 47, 1, 47, 4, 47, 1440, 8, 47, 11, 47, 12, 47, 1441, 1, 47, 3, 47, 1445, 8, 47, 1, 47, 3, 47, 1448, 8, 47, 1, 48, 1, 48, 1, 48, 3, 48, 1453, 8, 48, 1, 48, 1, 48, 3, 48, 1457, 8, 48, 1, 48, 3, 48, 1460, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1467, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1472, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1479, 8, 48, 10, 48, 12, 48, 1482, 9, 48, 1, 48, 1, 48, 3, 48, 1486, 8, 48, 1, 48, 3, 48, 1489, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1495, 8, 48, 10, 48, 12, 48, 1498, 9, 48, 1, 48, 3, 48, 1501, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1509, 8, 48, 1, 48, 3, 48, 1512, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1517, 8, 48, 1, 48, 1, 48, 3, 48, 1521, 8, 48, 1, 48, 3, 48, 1524, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1531, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1536, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1543, 8, 48, 10, 48, 12, 48, 1546, 9, 48, 1, 48, 1, 48, 3, 48, 1550, 8, 48, 1, 48, 3, 48, 1553, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1559, 8, 48, 10, 48, 12, 48, 1562, 9, 48, 1, 48, 3, 48, 1565, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1573, 8, 48, 1, 48, 3, 48, 1576, 8, 48, 3, 48, 1578, 8, 48, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 3, 49, 1587, 8, 49, 1, 49, 3, 49, 1590, 8, 49, 3, 49, 1592, 8, 49, 1, 50, 1, 50, 3, 50, 1596, 8, 50, 1, 50, 1, 50, 3, 50, 1600, 8, 50, 1, 50, 3, 50, 1603, 8, 50, 1, 50, 1, 50, 1, 50, 3, 50, 1608, 8, 50, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 5, 51, 1617, 8, 51, 10, 51, 12, 51, 1620, 9, 51, 1, 51, 1, 51, 3, 51, 1624, 8, 51, 1, 52, 1, 52, 3, 52, 1628, 8, 52, 1, 52, 1, 52, 3, 52, 1632, 8, 52, 1, 53, 3, 53, 1635, 8, 53, 1, 53, 1, 53, 1, 53, 3, 53, 1640, 8, 53, 1, 53, 1, 53, 1, 53, 1, 53, 3, 53, 1646, 8, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 3, 53, 1653, 8, 53, 1, 53, 1, 53, 1, 53, 5, 53, 1658, 8, 53, 10, 53, 12, 53, 1661, 9, 53, 1, 53, 1, 53, 3, 53, 1665, 8, 53, 1, 53, 3, 53, 1668, 8, 53, 1, 54, 1, 54, 1, 54, 1, 54, 5, 54, 1674, 8, 54, 10, 54, 12, 54, 1677, 9, 54, 1, 54, 1, 54, 1, 55, 3, 55, 1682, 8, 55, 1, 55, 1, 55, 1, 55, 3, 55, 1687, 8, 55, 1, 55, 1, 55, 1, 55, 1, 55, 3, 55, 1693, 8, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 3, 55, 1700, 8, 55, 1, 55, 1, 55, 1, 55, 5, 55, 1705, 8, 55, 10, 55, 12, 55, 1708, 9, 55, 1, 55, 1, 55, 3, 55, 1712, 8, 55, 1, 55, 3, 55, 1715, 8, 55, 1, 55, 3, 55, 1718, 8, 55, 1, 56, 1, 56, 1, 56, 3, 56, 1723, 8, 56, 1, 56, 1, 56, 1, 56, 3, 56, 1728, 8, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 3, 56, 1735, 8, 56, 1, 57, 1, 57, 3, 57, 1739, 8, 57, 1, 57, 1, 57, 3, 57, 1743, 8, 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 3, 59, 1753, 8, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 5, 59, 1760, 8, 59, 10, 59, 12, 59, 1763, 9, 59, 3, 59, 1765, 8, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 5, 59, 1772, 8, 59, 10, 59, 12, 59, 1775, 9, 59, 1, 59, 3, 59, 1778, 8, 59, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 60, 3, 60, 1786, 8, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 5, 60, 1793, 8, 60, 10, 60, 12, 60, 1796, 9, 60, 3, 60, 1798, 8, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 5, 60, 1805, 8, 60, 10, 60, 12, 60, 1808, 9, 60, 3, 60, 1810, 8, 60, 1, 60, 3, 60, 1813, 8, 60, 1, 60, 3, 60, 1816, 8, 60, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 3, 61, 1826, 8, 61, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 3, 62, 1835, 8, 62, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 5, 63, 1842, 8, 63, 10, 63, 12, 63, 1845, 9, 63, 1, 63, 3, 63, 1848, 8, 63, 1, 63, 1, 63, 1, 64, 1, 64, 1, 64, 3, 64, 1855, 8, 64, 1, 64, 1, 64, 1, 64, 5, 64, 1860, 8, 64, 10, 64, 12, 64, 1863, 9, 64, 1, 64, 3, 64, 1866, 8, 64, 1, 64, 1, 64, 3, 64, 1870, 8, 64, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 5, 65, 1877, 8, 65, 10, 65, 12, 65, 1880, 9, 65, 1, 65, 3, 65, 1883, 8, 65, 1, 65, 1, 65, 3, 65, 1887, 8, 65, 1, 65, 1, 65, 1, 65, 3, 65, 1892, 8, 65, 1, 66, 1, 66, 3, 66, 1896, 8, 66, 1, 66, 1, 66, 1, 66, 5, 66, 1901, 8, 66, 10, 66, 12, 66, 1904, 9, 66, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 5, 67, 1911, 8, 67, 10, 67, 12, 67, 1914, 9, 67, 1, 68, 1, 68, 1, 68, 1, 68, 3, 68, 1920, 8, 68, 1, 69, 1, 69, 1, 69, 3, 69, 1925, 8, 69, 1, 69, 3, 69, 1928, 8, 69, 1, 69, 1, 69, 3, 69, 1932, 8, 69, 1, 70, 1, 70, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 3, 71, 1946, 8, 71, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 3, 72, 1958, 8, 72, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 3, 73, 1967, 8, 73, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 1976, 8, 74, 1, 74, 1, 74, 3, 74, 1980, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 1990, 8, 74, 1, 74, 3, 74, 1993, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2002, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2011, 8, 74, 1, 74, 3, 74, 2014, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2020, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2034, 8, 74, 1, 74, 1, 74, 3, 74, 2038, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2049, 8, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2054, 8, 74, 1, 75, 1, 75, 1, 75, 1, 76, 1, 76, 1, 76, 1, 77, 1, 77, 1, 77, 4, 77, 2065, 8, 77, 11, 77, 12, 77, 2066, 1, 78, 1, 78, 1, 78, 4, 78, 2072, 8, 78, 11, 78, 12, 78, 2073, 1, 79, 1, 79, 1, 79, 1, 79, 1, 80, 1, 80, 3, 80, 2082, 8, 80, 1, 80, 1, 80, 1, 80, 3, 80, 2087, 8, 80, 5, 80, 2089, 8, 80, 10, 80, 12, 80, 2092, 9, 80, 1, 81, 1, 81, 1, 82, 1, 82, 1, 83, 1, 83, 1, 84, 1, 84, 1, 85, 1, 85, 3, 85, 2104, 8, 85, 1, 86, 1, 86, 1, 87, 1, 87, 1, 88, 1, 88, 1, 89, 1, 89, 1, 90, 1, 90, 1, 90, 3, 90, 2117, 8, 90, 1, 90, 1, 90, 1, 91, 1, 91, 1, 92, 1, 92, 1, 93, 1, 93, 1, 94, 1, 94, 1, 95, 1, 95, 1, 96, 1, 96, 1, 97, 1, 97, 1, 98, 1, 98, 1, 99, 1, 99, 1, 100, 1, 100, 1, 101, 1, 101, 1, 102, 1, 102, 1, 103, 1, 103, 1, 104, 1, 104, 1, 105, 1, 105, 1, 106, 1, 106, 1, 107, 1, 107, 1, 108, 1, 108, 1, 109, 1, 109, 1, 110, 1, 110, 1, 111, 1, 111, 1, 112, 1, 112, 1, 113, 1, 113, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 3, 114, 2174, 8, 114, 1, 114, 2, 449, 487, 1, 68, 115, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 0, 30, 3, 0, 60, 60, 71, 71, 84, 84, 2, 0, 49, 49, 68, 68, 1, 0, 136, 137, 2, 0, 149, 149, 174, 174, 2, 0, 8, 8, 11, 11, 2, 0, 61, 61, 144, 144, 2, 0, 58, 58, 106, 106, 2, 0, 60, 60, 84, 84, 5, 0, 27, 27, 74, 74, 83, 83, 124, 124, 128, 128, 4, 0, 86, 86, 135, 135, 141, 141, 148, 148, 1, 0, 9, 10, 2, 0, 7, 7, 14, 15, 1, 0, 16, 19, 1, 0, 20, 23, 4, 0, 79, 79, 99, 99, 101, 101, 120, 120, 3, 0, 27, 27, 74, 74, 128, 128, 5, 0, 54, 56, 106, 106, 175, 176, 189, 189, 192, 193, 2, 0, 31, 31, 64, 64, 3, 0, 78, 78, 98, 98, 127, 127, 3, 0, 130, 130, 157, 157, 182, 182, 2, 0, 5, 5, 108, 108, 1, 0, 179, 180, 2, 0, 36, 36, 62, 62, 2, 0, 154, 154, 165, 165, 2, 0, 162, 162, 169, 169, 2, 0, 163, 163, 170, 171, 2, 0, 164, 164, 166, 166, 3, 0, 8, 8, 11, 12, 104, 104, 2, 0, 188, 188, 192, 192, 1, 0, 27, 183, 2482, 0, 233, 1, 0, 0, 0, 2, 241, 1, 0, 0, 0, 4, 267, 1, 0, 0, 0, 6, 295, 1, 0, 0, 0, 8, 327, 1, 0, 0, 0, 10, 337, 1, 0, 0, 0, 12, 345, 1, 0, 0, 0, 14, 355, 1, 0, 0, 0, 16, 359, 1, 0, 0, 0, 18, 370, 1, 0, 0, 0, 20, 373, 1, 0, 0, 0, 22, 379, 1, 0, 0, 0, 24, 413, 1, 0, 0, 0, 26, 425, 1, 0, 0, 0, 28, 427, 1, 0, 0, 0, 30, 474, 1, 0, 0, 0, 32, 485, 1, 0, 0, 0, 34, 503, 1, 0, 0, 0, 36, 555, 1, 0, 0, 0, 38, 561, 1, 0, 0, 0, 40, 602, 1, 0, 0, 0, 42, 644, 1, 0, 0, 0, 44, 648, 1, 0, 0, 0, 46, 712, 1, 0, 0, 0, 48, 744, 1, 0, 0, 0, 50, 773, 1, 0, 0, 0, 52, 794, 1, 0, 0, 0, 54, 808, 1, 0, 0, 0, 56, 819, 1, 0, 0, 0, 58, 838, 1, 0, 0, 0, 60, 866, 1, 0, 0, 0, 62, 879, 1, 0, 0, 0, 64, 897, 1, 0, 0, 0, 66, 903, 1, 0, 0, 0, 68, 1005, 1, 0, 0, 0, 70, 1129, 1, 0, 0, 0, 72, 1139, 1, 0, 0, 0, 74, 1142, 1, 0, 0, 0, 76, 1214, 1, 0, 0, 0, 78, 1261, 1, 0, 0, 0, 80, 1279, 1, 0, 0, 0, 82, 1281, 1, 0, 0, 0, 84, 1295, 1, 0, 0, 0, 86, 1312, 1, 0, 0, 0, 88, 1412, 1, 0, 0, 0, 90, 1414, 1, 0, 0, 0, 92, 1417, 1, 0, 0, 0, 94, 1427, 1, 0, 0, 0, 96, 1577, 1, 0, 0, 0, 98, 1591, 1, 0, 0, 0, 100, 1607, 1, 0, 0, 0, 102, 1623, 1, 0, 0, 0, 104, 1631, 1, 0, 0, 0, 106, 1634, 1, 0, 0, 0, 108, 1669, 1, 0, 0, 0, 110, 1681, 1, 0, 0, 0, 112, 1722, 1, 0, 0, 0, 114, 1736, 1, 0, 0, 0, 116, 1744, 1, 0, 0, 0, 118, 1750, 1, 0, 0, 0, 120, 1781, 1, 0, 0, 0, 122, 1817, 1, 0, 0, 0, 124, 1827, 1, 0, 0, 0, 126, 1836, 1, 0, 0, 0, 128, 1851, 1, 0, 0, 0, 130, 1871, 1, 0, 0, 0, 132, 1893, 1, 0, 0, 0, 134, 1905, 1, 0, 0, 0, 136, 1915, 1, 0, 0, 0, 138, 1921, 1, 0, 0, 0, 140, 1933, 1, 0, 0, 0, 142, 1945, 1, 0, 0, 0, 144, 1957, 1, 0, 0, 0, 146, 1966, 1, 0, 0, 0, 148, 2053, 1, 0, 0, 0, 150, 2055, 1, 0, 0, 0, 152, 2058, 1, 0, 0, 0, 154, 2061, 1, 0, 0, 0, 156, 2068, 1, 0, 0, 0, 158, 2075, 1, 0, 0, 0, 160, 2079, 1, 0, 0, 0, 162, 2093, 1, 0, 0, 0, 164, 2095, 1, 0, 0, 0, 166, 2097, 1, 0, 0, 0, 168, 2099, 1, 0, 0, 0, 170, 2103, 1, 0, 0, 0, 172, 2105, 1, 0, 0, 0, 174, 2107, 1, 0, 0, 0, 176, 2109, 1, 0, 0, 0, 178, 2111, 1, 0, 0, 0, 180, 2116, 1, 0, 0, 0, 182, 2120, 1, 0, 0, 0, 184, 2122, 1, 0, 0, 0, 186, 2124, 1, 0, 0, 0, 188, 2126, 1, 0, 0, 0, 190, 2128, 1, 0, 0, 0, 192, 2130, 1, 0, 0, 0, 194, 2132, 1, 0, 0, 0, 196, 2134, 1, 0, 0, 0, 198, 2136, 1, 0, 0, 0, 200, 2138, 1, 0, 0, 0, 202, 2140, 1, 0, 0, 0, 204, 2142, 1, 0, 0, 0, 206, 2144, 1, 0, 0, 0, 208, 2146, 1, 0, 0, 0, 210, 2148, 1, 0, 0, 0, 212, 2150, 1, 0, 0, 0, 214, 2152, 1, 0, 0, 0, 216, 2154, 1, 0, 0, 0, 218, 2156, 1, 0, 0, 0, 220, 2158, 1, 0, 0, 0, 222, 2160, 1, 0, 0, 0, 224, 2162, 1, 0, 0, 0, 226, 2164, 1, 0, 0, 0, 228, 2173, 1, 0, 0, 0, 230, 232, 3, 2, 1, 0, 231, 230, 1, 0, 0, 0, 232, 235, 1, 0, 0, 0, 233, 231, 1, 0, 0, 0, 233, 234, 1, 0, 0, 0, 234, 236, 1, 0, 0, 0, 235, 233, 1, 0, 0, 0, 236, 237, 5, 0, 0, 1, 237, 1, 1, 0, 0, 0, 238, 240, 5, 1, 0, 0, 239, 238, 1, 0, 0, 0, 240, 243, 1, 0, 0, 0, 241, 239, 1, 0, 0, 0, 241, 242, 1, 0, 0, 0, 242, 244, 1, 0, 0, 0, 243, 241, 1, 0, 0, 0, 244, 253, 3, 4, 2, 0, 245, 247, 5, 1, 0, 0, 246, 245, 1, 0, 0, 0, 247, 248, 1, 0, 0, 0, 248, 246, 1, 0, 0, 0, 248, 249, 1, 0, 0, 0, 249, 250, 1, 0, 0, 0, 250, 252, 3, 4, 2, 0, 251, 246, 1, 0, 0, 0, 252, 255, 1, 0, 0, 0, 253, 251, 1, 0, 0, 0, 253, 254, 1, 0, 0, 0, 254, 259, 1, 0, 0, 0, 255, 253, 1, 0, 0, 0, 256, 258, 5, 1, 0, 0, 257, 256, 1, 0, 0, 0, 258, 261, 1, 0, 0, 0, 259, 257, 1, 0, 0, 0, 259, 260, 1, 0, 0, 0, 260, 3, 1, 0, 0, 0, 261, 259, 1, 0, 0, 0, 262, 265, 5, 73, 0, 0, 263, 264, 5, 116, 0, 0, 264, 266, 5, 113, 0, 0, 265, 263, 1, 0, 0, 0, 265, 266, 1, 0, 0, 0, 266, 268, 1, 0, 0, 0, 267, 262, 1, 0, 0, 0, 267, 268, 1, 0, 0, 0, 268, 293, 1, 0, 0, 0, 269, 294, 3, 6, 3, 0, 270, 294, 3, 8, 4, 0, 271, 294, 3, 10, 5, 0, 272, 294, 3, 12, 6, 0, 273, 294, 3, 14, 7, 0, 274, 294, 3, 22, 11, 0, 275, 294, 3, 28, 14, 0, 276, 294, 3, 44, 22, 0, 277, 294, 3, 46, 23, 0, 278, 294, 3, 48, 24, 0, 279, 294, 3, 60, 30, 0, 280, 294, 3, 62, 31, 0, 281, 294, 3, 64, 32, 0, 282, 294, 3, 66, 33, 0, 283, 294, 3, 74, 37, 0, 284, 294, 3, 78, 39, 0, 285, 294, 3, 82, 41, 0, 286, 294, 3, 20, 10, 0, 287, 294, 3, 16, 8, 0, 288, 294, 3, 18, 9, 0, 289, 294, 3, 84, 42, 0, 290, 294, 3, 106, 53, 0, 291, 294, 3, 110, 55, 0, 292, 294, 3, 114, 57, 0, 293, 269, 1, 0, 0, 0, 293, 270, 1, 0, 0, 0, 293, 271, 1, 0, 0, 0, 293, 272, 1, 0, 0, 0, 293, 273, 1, 0, 0, 0, 293, 274, 1, 0, 0, 0, 293, 275, 1, 0, 0, 0, 293, 276, 1, 0, 0, 0, 293, 277, 1, 0, 0, 0, 293, 278, 1, 0, 0, 0, 293, 279, 1, 0, 0, 0, 293, 280, 1, 0, 0, 0, 293, 281, 1, 0, 0, 0, 293, 282, 1, 0, 0, 0, 293, 283, 1, 0, 0, 0, 293, 284, 1, 0, 0, 0, 293, 285, 1, 0, 0, 0, 293, 286, 1, 0, 0, 0, 293, 287, 1, 0, 0, 0, 293, 288, 1, 0, 0, 0, 293, 289, 1, 0, 0, 0, 293, 290, 1, 0, 0, 0, 293, 291, 1, 0, 0, 0, 293, 292, 1, 0, 0, 0, 294, 5, 1, 0, 0, 0, 295, 296, 5, 32, 0, 0, 296, 300, 5, 135, 0, 0, 297, 298, 3, 182, 91, 0, 298, 299, 5, 2, 0, 0, 299, 301, 1, 0, 0, 0, 300, 297, 1, 0, 0, 0, 300, 301, 1, 0, 0, 0, 301, 302, 1, 0, 0, 0, 302, 325, 3, 184, 92, 0, 303, 313, 5, 123, 0, 0, 304, 305, 5, 139, 0, 0, 305, 314, 3, 188, 94, 0, 306, 308, 5, 48, 0, 0, 307, 306, 1, 0, 0, 0, 307, 308, 1, 0, 0, 0, 308, 309, 1, 0, 0, 0, 309, 310, 3, 190, 95, 0, 310, 311, 5, 139, 0, 0, 311, 312, 3, 190, 95, 0, 312, 314, 1, 0, 0, 0, 313, 304, 1, 0, 0, 0, 313, 307, 1, 0, 0, 0, 314, 326, 1, 0, 0, 0, 315, 317, 5, 29, 0, 0, 316, 318, 5, 48, 0, 0, 317, 316, 1, 0, 0, 0, 317, 318, 1, 0, 0, 0, 318, 319, 1, 0, 0, 0, 319, 326, 3, 30, 15, 0, 320, 322, 5, 65, 0, 0, 321, 323, 5, 48, 0, 0, 322, 321, 1, 0, 0, 0, 322, 323, 1, 0, 0, 0, 323, 324, 1, 0, 0, 0, 324, 326, 3, 190, 95, 0, 325, 303, 1, 0, 0, 0, 325, 315, 1, 0, 0, 0, 325, 320, 1, 0, 0, 0, 326, 7, 1, 0, 0, 0, 327, 335, 5, 33, 0, 0, 328, 336, 3, 182, 91, 0, 329, 330, 3, 182, 91, 0, 330, 331, 5, 2, 0, 0, 331, 333, 1, 0, 0, 0, 332, 329, 1, 0, 0, 0, 332, 333, 1, 0, 0, 0, 333, 334, 1, 0, 0, 0, 334, 336, 3, 186, 93, 0, 335, 328, 1, 0, 0, 0, 335, 332, 1, 0, 0, 0, 335, 336, 1, 0, 0, 0, 336, 9, 1, 0, 0, 0, 337, 339, 5, 37, 0, 0, 338, 340, 5, 57, 0, 0, 339, 338, 1, 0, 0, 0, 339, 340, 1, 0, 0, 0, 340, 341, 1, 0, 0, 0, 341, 342, 3, 68, 34, 0, 342, 343, 5, 35, 0, 0, 343, 344, 3, 182, 91, 0, 344, 11, 1, 0, 0, 0, 345, 347, 5, 40, 0, 0, 346, 348, 7, 0, 0, 0, 347, 346, 1, 0, 0, 0, 347, 348, 1, 0, 0, 0, 348, 353, 1, 0, 0, 0, 349, 351, 5, 140, 0, 0, 350, 352, 3, 212, 106, 0, 351, 350, 1, 0, 0, 0, 351, 352, 1, 0, 0, 0, 352, 354, 1, 0, 0, 0, 353, 349, 1, 0, 0, 0, 353, 354, 1, 0, 0, 0, 354, 13, 1, 0, 0, 0, 355, 357, 7, 1, 0, 0, 356, 358, 5, 140, 0, 0, 357, 356, 1, 0, 0, 0, 357, 358, 1, 0, 0, 0, 358, 15, 1, 0, 0, 0, 359, 361, 5, 128, 0, 0, 360, 362, 5, 140, 0, 0, 361, 360, 1, 0, 0, 0, 361, 362, 1, 0, 0, 0, 362, 368, 1, 0, 0, 0, 363, 365, 5, 139, 0, 0, 364, 366, 5, 131, 0, 0, 365, 364, 1, 0, 0, 0, 365, 366, 1, 0, 0, 0, 366, 367, 1, 0, 0, 0, 367, 369, 3, 206, 103, 0, 368, 363, 1, 0, 0, 0, 368, 369, 1, 0, 0, 0, 369, 17, 1, 0, 0, 0, 370, 371, 5, 131, 0, 0, 371, 372, 3, 206, 103, 0, 372, 19, 1, 0, 0, 0, 373, 375, 5, 122, 0, 0, 374, 376, 5, 131, 0, 0, 375, 374, 1, 0, 0, 0, 375, 376, 1, 0, 0, 0, 376, 377, 1, 0, 0, 0, 377, 378, 3, 206, 103, 0, 378, 21, 1, 0, 0, 0, 379, 381, 5, 52, 0, 0, 380, 382, 5, 143, 0, 0, 381, 380, 1, 0, 0, 0, 381, 382, 1, 0, 0, 0, 382, 383, 1, 0, 0, 0, 383, 387, 5, 86, 0, 0, 384, 385, 5, 82, 0, 0, 385, 386, 5, 104, 0, 0, 386, 388, 5, 72, 0, 0, 387, 384, 1, 0, 0, 0, 387, 388, 1, 0, 0, 0, 388, 392, 1, 0, 0, 0, 389, 390, 3, 182, 91, 0, 390, 391, 5, 2, 0, 0, 391, 393, 1, 0, 0, 0, 392, 389, 1, 0, 0, 0, 392, 393, 1, 0, 0, 0, 393, 394, 1, 0, 0, 0, 394, 395, 3, 196, 98, 0, 395, 396, 5, 109, 0, 0, 396, 397, 3, 184, 92, 0, 397, 398, 5, 3, 0, 0, 398, 403, 3, 24, 12, 0, 399, 400, 5, 5, 0, 0, 400, 402, 3, 24, 12, 0, 401, 399, 1, 0, 0, 0, 402, 405, 1, 0, 0, 0, 403, 401, 1, 0, 0, 0, 403, 404, 1, 0, 0, 0, 404, 406, 1, 0, 0, 0, 405, 403, 1, 0, 0, 0, 406, 409, 5, 4, 0, 0, 407, 408, 5, 151, 0, 0, 408, 410, 3, 68, 34, 0, 409, 407, 1, 0, 0, 0, 409, 410, 1, 0, 0, 0, 410, 23, 1, 0, 0, 0, 411, 414, 3, 190, 95, 0, 412, 414, 3, 68, 34, 0, 413, 411, 1, 0, 0, 0, 413, 412, 1, 0, 0, 0, 414, 417, 1, 0, 0, 0, 415, 416, 5, 47, 0, 0, 416, 418, 3, 192, 96, 0, 417, 415, 1, 0, 0, 0, 417, 418, 1, 0, 0, 0, 418, 420, 1, 0, 0, 0, 419, 421, 3, 140, 70, 0, 420, 419, 1, 0, 0, 0, 420, 421, 1, 0, 0, 0, 421, 25, 1, 0, 0, 0, 422, 423, 5, 153, 0, 0, 423, 426, 5, 188, 0, 0, 424, 426, 5, 134, 0, 0, 425, 422, 1, 0, 0, 0, 425, 424, 1, 0, 0, 0, 426, 27, 1, 0, 0, 0, 427, 429, 5, 52, 0, 0, 428, 430, 7, 2, 0, 0, 429, 428, 1, 0, 0, 0, 429, 430, 1, 0, 0, 0, 430, 431, 1, 0, 0, 0, 431, 435, 5, 135, 0, 0, 432, 433, 5, 82, 0, 0, 433, 434, 5, 104, 0, 0, 434, 436, 5, 72, 0, 0, 435, 432, 1, 0, 0, 0, 435, 436, 1, 0, 0, 0, 436, 440, 1, 0, 0, 0, 437, 438, 3, 182, 91, 0, 438, 439, 5, 2, 0, 0, 439, 441, 1, 0, 0, 0, 440, 437, 1, 0, 0, 0, 440, 441, 1, 0, 0, 0, 441, 442, 1, 0, 0, 0, 442, 472, 3, 184, 92, 0, 443, 444, 5, 3, 0, 0, 444, 449, 3, 30, 15, 0, 445, 446, 5, 5, 0, 0, 446, 448, 3, 30, 15, 0, 447, 445, 1, 0, 0, 0, 448, 451, 1, 0, 0, 0, 449, 450, 1, 0, 0, 0, 449, 447, 1, 0, 0, 0, 450, 456, 1, 0, 0, 0, 451, 449, 1, 0, 0, 0, 452, 453, 5, 5, 0, 0, 453, 455, 3, 38, 19, 0, 454, 452, 1, 0, 0, 0, 455, 458, 1, 0, 0, 0, 456, 454, 1, 0, 0, 0, 456, 457, 1, 0, 0, 0, 457, 459, 1, 0, 0, 0, 458, 456, 1, 0, 0, 0, 459, 468, 5, 4, 0, 0, 460, 465, 3, 26, 13, 0, 461, 462, 5, 5, 0, 0, 462, 464, 3, 26, 13, 0, 463, 461, 1, 0, 0, 0, 464, 467, 1, 0, 0, 0, 465, 463, 1, 0, 0, 0, 465, 466, 1, 0, 0, 0, 466, 469, 1, 0, 0, 0, 467, 465, 1, 0, 0, 0, 468, 460, 1, 0, 0, 0, 468, 469, 1, 0, 0, 0, 469, 473, 1, 0, 0, 0, 470, 471, 5, 35, 0, 0, 471, 473, 3, 84, 42, 0, 472, 443, 1, 0, 0, 0, 472, 470, 1, 0, 0, 0, 473, 29, 1, 0, 0, 0, 474, 476, 3, 190, 95, 0, 475, 477, 3, 32, 16, 0, 476, 475, 1, 0, 0, 0, 476, 477, 1, 0, 0, 0, 477, 481, 1, 0, 0, 0, 478, 480, 3, 34, 17, 0, 479, 478, 1, 0, 0, 0, 480, 483, 1, 0, 0, 0, 481, 479, 1, 0, 0, 0, 481, 482, 1, 0, 0, 0, 482, 31, 1, 0, 0, 0, 483, 481, 1, 0, 0, 0, 484, 486, 3, 176, 88, 0, 485, 484, 1, 0, 0, 0, 486, 487, 1, 0, 0, 0, 487, 488, 1, 0, 0, 0, 487, 485, 1, 0, 0, 0, 488, 499, 1, 0, 0, 0, 489, 490, 5, 3, 0, 0, 490, 491, 3, 36, 18, 0, 491, 492, 5, 4, 0, 0, 492, 500, 1, 0, 0, 0, 493, 494, 5, 3, 0, 0, 494, 495, 3, 36, 18, 0, 495, 496, 5, 5, 0, 0, 496, 497, 3, 36, 18, 0, 497, 498, 5, 4, 0, 0, 498, 500, 1, 0, 0, 0, 499, 489, 1, 0, 0, 0, 499, 493, 1, 0, 0, 0, 499, 500, 1, 0, 0, 0, 500, 33, 1, 0, 0, 0, 501, 502, 5, 51, 0, 0, 502, 504, 3, 176, 88, 0, 503, 501, 1, 0, 0, 0, 503, 504, 1, 0, 0, 0, 504, 552, 1, 0, 0, 0, 505, 506, 5, 115, 0, 0, 506, 508, 5, 97, 0, 0, 507, 509, 3, 140, 70, 0, 508, 507, 1, 0, 0, 0, 508, 509, 1, 0, 0, 0, 509, 511, 1, 0, 0, 0, 510, 512, 3, 42, 21, 0, 511, 510, 1, 0, 0, 0, 511, 512, 1, 0, 0, 0, 512, 514, 1, 0, 0, 0, 513, 515, 5, 38, 0, 0, 514, 513, 1, 0, 0, 0, 514, 515, 1, 0, 0, 0, 515, 553, 1, 0, 0, 0, 516, 517, 5, 104, 0, 0, 517, 520, 5, 106, 0, 0, 518, 520, 5, 143, 0, 0, 519, 516, 1, 0, 0, 0, 519, 518, 1, 0, 0, 0, 520, 522, 1, 0, 0, 0, 521, 523, 3, 42, 21, 0, 522, 521, 1, 0, 0, 0, 522, 523, 1, 0, 0, 0, 523, 553, 1, 0, 0, 0, 524, 525, 5, 46, 0, 0, 525, 526, 5, 3, 0, 0, 526, 527, 3, 68, 34, 0, 527, 528, 5, 4, 0, 0, 528, 553, 1, 0, 0, 0, 529, 536, 5, 58, 0, 0, 530, 537, 3, 36, 18, 0, 531, 537, 3, 72, 36, 0, 532, 533, 5, 3, 0, 0, 533, 534, 3, 68, 34, 0, 534, 535, 5, 4, 0, 0, 535, 537, 1, 0, 0, 0, 536, 530, 1, 0, 0, 0, 536, 531, 1, 0, 0, 0, 536, 532, 1, 0, 0, 0, 537, 553, 1, 0, 0, 0, 538, 539, 5, 47, 0, 0, 539, 553, 3, 192, 96, 0, 540, 553, 3, 40, 20, 0, 541, 542, 5, 172, 0, 0, 542, 544, 5, 173, 0, 0, 543, 541, 1, 0, 0, 0, 543, 544, 1, 0, 0, 0, 544, 545, 1, 0, 0, 0, 545, 546, 5, 35, 0, 0, 546, 547, 5, 3, 0, 0, 547, 548, 3, 68, 34, 0, 548, 550, 5, 4, 0, 0, 549, 551, 7, 3, 0, 0, 550, 549, 1, 0, 0, 0, 550, 551, 1, 0, 0, 0, 551, 553, 1, 0, 0, 0, 552, 505, 1, 0, 0, 0, 552, 519, 1, 0, 0, 0, 552, 524, 1, 0, 0, 0, 552, 529, 1, 0, 0, 0, 552, 538, 1, 0, 0, 0, 552, 540, 1, 0, 0, 0, 552, 543, 1, 0, 0, 0, 553, 35, 1, 0, 0, 0, 554, 556, 7, 4, 0, 0, 555, 554, 1, 0, 0, 0, 555, 556, 1, 0, 0, 0, 556, 557, 1, 0, 0, 0, 557, 558, 5, 189, 0, 0, 558, 37, 1, 0, 0, 0, 559, 560, 5, 51, 0, 0, 560, 562, 3, 176, 88, 0, 561, 559, 1, 0, 0, 0, 561, 562, 1, 0, 0, 0, 562, 600, 1, 0, 0, 0, 563, 564, 5, 115, 0, 0, 564, 567, 5, 97, 0, 0, 565, 567, 5, 143, 0, 0, 566, 563, 1, 0, 0, 0, 566, 565, 1, 0, 0, 0, 567, 568, 1, 0, 0, 0, 568, 569, 5, 3, 0, 0, 569, 574, 3, 24, 12, 0, 570, 571, 5, 5, 0, 0, 571, 573, 3, 24, 12, 0, 572, 570, 1, 0, 0, 0, 573, 576, 1, 0, 0, 0, 574, 572, 1, 0, 0, 0, 574, 575, 1, 0, 0, 0, 575, 577, 1, 0, 0, 0, 576, 574, 1, 0, 0, 0, 577, 579, 5, 4, 0, 0, 578, 580, 3, 42, 21, 0, 579, 578, 1, 0, 0, 0, 579, 580, 1, 0, 0, 0, 580, 601, 1, 0, 0, 0, 581, 582, 5, 46, 0, 0, 582, 583, 5, 3, 0, 0, 583, 584, 3, 68, 34, 0, 584, 585, 5, 4, 0, 0, 585, 601, 1, 0, 0, 0, 586, 587, 5, 76, 0, 0, 587, 588, 5, 97, 0, 0, 588, 589, 5, 3, 0, 0, 589, 594, 3, 190, 95, 0, 590, 591, 5, 5, 0, 0, 591, 593, 3, 190, 95, 0, 592, 590, 1, 0, 0, 0, 593, 596, 1, 0, 0, 0, 594, 592, 1, 0, 0, 0, 594, 595, 1, 0, 0, 0, 595, 597, 1, 0, 0, 0, 596, 594, 1, 0, 0, 0, 597, 598, 5, 4, 0, 0, 598, 599, 3, 40, 20, 0, 599, 601, 1, 0, 0, 0, 600, 566, 1, 0, 0, 0, 600, 581, 1, 0, 0, 0, 600, 586, 1, 0, 0, 0, 601, 39, 1, 0, 0, 0, 602, 603, 5, 119, 0, 0, 603, 615, 3, 194, 97, 0, 604, 605, 5, 3, 0, 0, 605, 610, 3, 190, 95, 0, 606, 607, 5, 5, 0, 0, 607, 609, 3, 190, 95, 0, 608, 606, 1, 0, 0, 0, 609, 612, 1, 0, 0, 0, 610, 608, 1, 0, 0, 0, 610, 611, 1, 0, 0, 0, 611, 613, 1, 0, 0, 0, 612, 610, 1, 0, 0, 0, 613, 614, 5, 4, 0, 0, 614, 616, 1, 0, 0, 0, 615, 604, 1, 0, 0, 0, 615, 616, 1, 0, 0, 0, 616, 631, 1, 0, 0, 0, 617, 618, 5, 109, 0, 0, 618, 625, 7, 5, 0, 0, 619, 620, 5, 133, 0, 0, 620, 626, 7, 6, 0, 0, 621, 626, 5, 43, 0, 0, 622, 626, 5, 125, 0, 0, 623, 624, 5, 103, 0, 0, 624, 626, 5, 28, 0, 0, 625, 619, 1, 0, 0, 0, 625, 621, 1, 0, 0, 0, 625, 622, 1, 0, 0, 0, 625, 623, 1, 0, 0, 0, 626, 630, 1, 0, 0, 0, 627, 628, 5, 101, 0, 0, 628, 630, 3, 176, 88, 0, 629, 617, 1, 0, 0, 0, 629, 627, 1, 0, 0, 0, 630, 633, 1, 0, 0, 0, 631, 629, 1, 0, 0, 0, 631, 632, 1, 0, 0, 0, 632, 642, 1, 0, 0, 0, 633, 631, 1, 0, 0, 0, 634, 636, 5, 104, 0, 0, 635, 634, 1, 0, 0, 0, 635, 636, 1, 0, 0, 0, 636, 637, 1, 0, 0, 0, 637, 640, 5, 59, 0, 0, 638, 639, 5, 88, 0, 0, 639, 641, 7, 7, 0, 0, 640, 638, 1, 0, 0, 0, 640, 641, 1, 0, 0, 0, 641, 643, 1, 0, 0, 0, 642, 635, 1, 0, 0, 0, 642, 643, 1, 0, 0, 0, 643, 41, 1, 0, 0, 0, 644, 645, 5, 109, 0, 0, 645, 646, 5, 50, 0, 0, 646, 647, 7, 8, 0, 0, 647, 43, 1, 0, 0, 0, 648, 650, 5, 52, 0, 0, 649, 651, 7, 2, 0, 0, 650, 649, 1, 0, 0, 0, 650, 651, 1, 0, 0, 0, 651, 652, 1, 0, 0, 0, 652, 656, 5, 141, 0, 0, 653, 654, 5, 82, 0, 0, 654, 655, 5, 104, 0, 0, 655, 657, 5, 72, 0, 0, 656, 653, 1, 0, 0, 0, 656, 657, 1, 0, 0, 0, 657, 661, 1, 0, 0, 0, 658, 659, 3, 182, 91, 0, 659, 660, 5, 2, 0, 0, 660, 662, 1, 0, 0, 0, 661, 658, 1, 0, 0, 0, 661, 662, 1, 0, 0, 0, 662, 663, 1, 0, 0, 0, 663, 668, 3, 198, 99, 0, 664, 669, 5, 39, 0, 0, 665, 669, 5, 30, 0, 0, 666, 667, 5, 91, 0, 0, 667, 669, 5, 107, 0, 0, 668, 664, 1, 0, 0, 0, 668, 665, 1, 0, 0, 0, 668, 666, 1, 0, 0, 0, 668, 669, 1, 0, 0, 0, 669, 684, 1, 0, 0, 0, 670, 685, 5, 61, 0, 0, 671, 685, 5, 90, 0, 0, 672, 682, 5, 144, 0, 0, 673, 674, 5, 107, 0, 0, 674, 679, 3, 190, 95, 0, 675, 676, 5, 5, 0, 0, 676, 678, 3, 190, 95, 0, 677, 675, 1, 0, 0, 0, 678, 681, 1, 0, 0, 0, 679, 677, 1, 0, 0, 0, 679, 680, 1, 0, 0, 0, 680, 683, 1, 0, 0, 0, 681, 679, 1, 0, 0, 0, 682, 673, 1, 0, 0, 0, 682, 683, 1, 0, 0, 0, 683, 685, 1, 0, 0, 0, 684, 670, 1, 0, 0, 0, 684, 671, 1, 0, 0, 0, 684, 672, 1, 0, 0, 0, 685, 686, 1, 0, 0, 0, 686, 687, 5, 109, 0, 0, 687, 691, 3, 184, 92, 0, 688, 689, 5, 75, 0, 0, 689, 690, 5, 66, 0, 0, 690, 692, 5, 129, 0, 0, 691, 688, 1, 0, 0, 0, 691, 692, 1, 0, 0, 0, 692, 695, 1, 0, 0, 0, 693, 694, 5, 150, 0, 0, 694, 696, 3, 68, 34, 0, 695, 693, 1, 0, 0, 0, 695, 696, 1, 0, 0, 0, 696, 697, 1, 0, 0, 0, 697, 706, 5, 40, 0, 0, 698, 703, 3, 106, 53, 0, 699, 703, 3, 74, 37, 0, 700, 703, 3, 60, 30, 0, 701, 703, 3, 84, 42, 0, 702, 698, 1, 0, 0, 0, 702, 699, 1, 0, 0, 0, 702, 700, 1, 0, 0, 0, 702, 701, 1, 0, 0, 0, 703, 704, 1, 0, 0, 0, 704, 705, 5, 1, 0, 0, 705, 707, 1, 0, 0, 0, 706, 702, 1, 0, 0, 0, 707, 708, 1, 0, 0, 0, 708, 706, 1, 0, 0, 0, 708, 709, 1, 0, 0, 0, 709, 710, 1, 0, 0, 0, 710, 711, 5, 68, 0, 0, 711, 45, 1, 0, 0, 0, 712, 714, 5, 52, 0, 0, 713, 715, 7, 2, 0, 0, 714, 713, 1, 0, 0, 0, 714, 715, 1, 0, 0, 0, 715, 716, 1, 0, 0, 0, 716, 720, 5, 148, 0, 0, 717, 718, 5, 82, 0, 0, 718, 719, 5, 104, 0, 0, 719, 721, 5, 72, 0, 0, 720, 717, 1, 0, 0, 0, 720, 721, 1, 0, 0, 0, 721, 725, 1, 0, 0, 0, 722, 723, 3, 182, 91, 0, 723, 724, 5, 2, 0, 0, 724, 726, 1, 0, 0, 0, 725, 722, 1, 0, 0, 0, 725, 726, 1, 0, 0, 0, 726, 727, 1, 0, 0, 0, 727, 739, 3, 200, 100, 0, 728, 729, 5, 3, 0, 0, 729, 734, 3, 190, 95, 0, 730, 731, 5, 5, 0, 0, 731, 733, 3, 190, 95, 0, 732, 730, 1, 0, 0, 0, 733, 736, 1, 0, 0, 0, 734, 732, 1, 0, 0, 0, 734, 735, 1, 0, 0, 0, 735, 737, 1, 0, 0, 0, 736, 734, 1, 0, 0, 0, 737, 738, 5, 4, 0, 0, 738, 740, 1, 0, 0, 0, 739, 728, 1, 0, 0, 0, 739, 740, 1, 0, 0, 0, 740, 741, 1, 0, 0, 0, 741, 742, 5, 35, 0, 0, 742, 743, 3, 84, 42, 0, 743, 47, 1, 0, 0, 0, 744, 745, 5, 52, 0, 0, 745, 746, 5, 149, 0, 0, 746, 750, 5, 135, 0, 0, 747, 748, 5, 82, 0, 0, 748, 749, 5, 104, 0, 0, 749, 751, 5, 72, 0, 0, 750, 747, 1, 0, 0, 0, 750, 751, 1, 0, 0, 0, 751, 755, 1, 0, 0, 0, 752, 753, 3, 182, 91, 0, 753, 754, 5, 2, 0, 0, 754, 756, 1, 0, 0, 0, 755, 752, 1, 0, 0, 0, 755, 756, 1, 0, 0, 0, 756, 757, 1, 0, 0, 0, 757, 758, 3, 184, 92, 0, 758, 759, 5, 145, 0, 0, 759, 771, 3, 202, 101, 0, 760, 761, 5, 3, 0, 0, 761, 766, 3, 170, 85, 0, 762, 763, 5, 5, 0, 0, 763, 765, 3, 170, 85, 0, 764, 762, 1, 0, 0, 0, 765, 768, 1, 0, 0, 0, 766, 764, 1, 0, 0, 0, 766, 767, 1, 0, 0, 0, 767, 769, 1, 0, 0, 0, 768, 766, 1, 0, 0, 0, 769, 770, 5, 4, 0, 0, 770, 772, 1, 0, 0, 0, 771, 760, 1, 0, 0, 0, 771, 772, 1, 0, 0, 0, 772, 49, 1, 0, 0, 0, 773, 775, 5, 152, 0, 0, 774, 776, 5, 118, 0, 0, 775, 774, 1, 0, 0, 0, 775, 776, 1, 0, 0, 0, 776, 777, 1, 0, 0, 0, 777, 778, 3, 52, 26, 0, 778, 779, 5, 35, 0, 0, 779, 780, 5, 3, 0, 0, 780, 781, 3, 84, 42, 0, 781, 791, 5, 4, 0, 0, 782, 783, 5, 5, 0, 0, 783, 784, 3, 52, 26, 0, 784, 785, 5, 35, 0, 0, 785, 786, 5, 3, 0, 0, 786, 787, 3, 84, 42, 0, 787, 788, 5, 4, 0, 0, 788, 790, 1, 0, 0, 0, 789, 782, 1, 0, 0, 0, 790, 793, 1, 0, 0, 0, 791, 789, 1, 0, 0, 0, 791, 792, 1, 0, 0, 0, 792, 51, 1, 0, 0, 0, 793, 791, 1, 0, 0, 0, 794, 806, 3, 184, 92, 0, 795, 796, 5, 3, 0, 0, 796, 801, 3, 190, 95, 0, 797, 798, 5, 5, 0, 0, 798, 800, 3, 190, 95, 0, 799, 797, 1, 0, 0, 0, 800, 803, 1, 0, 0, 0, 801, 799, 1, 0, 0, 0, 801, 802, 1, 0, 0, 0, 802, 804, 1, 0, 0, 0, 803, 801, 1, 0, 0, 0, 804, 805, 5, 4, 0, 0, 805, 807, 1, 0, 0, 0, 806, 795, 1, 0, 0, 0, 806, 807, 1, 0, 0, 0, 807, 53, 1, 0, 0, 0, 808, 809, 3, 52, 26, 0, 809, 810, 5, 35, 0, 0, 810, 811, 5, 3, 0, 0, 811, 812, 3, 162, 81, 0, 812, 814, 5, 142, 0, 0, 813, 815, 5, 31, 0, 0, 814, 813, 1, 0, 0, 0, 814, 815, 1, 0, 0, 0, 815, 816, 1, 0, 0, 0, 816, 817, 3, 164, 82, 0, 817, 818, 5, 4, 0, 0, 818, 55, 1, 0, 0, 0, 819, 831, 3, 184, 92, 0, 820, 821, 5, 3, 0, 0, 821, 826, 3, 190, 95, 0, 822, 823, 5, 5, 0, 0, 823, 825, 3, 190, 95, 0, 824, 822, 1, 0, 0, 0, 825, 828, 1, 0, 0, 0, 826, 824, 1, 0, 0, 0, 826, 827, 1, 0, 0, 0, 827, 829, 1, 0, 0, 0, 828, 826, 1, 0, 0, 0, 829, 830, 5, 4, 0, 0, 830, 832, 1, 0, 0, 0, 831, 820, 1, 0, 0, 0, 831, 832, 1, 0, 0, 0, 832, 833, 1, 0, 0, 0, 833, 834, 5, 35, 0, 0, 834, 835, 5, 3, 0, 0, 835, 836, 3, 84, 42, 0, 836, 837, 5, 4, 0, 0, 837, 57, 1, 0, 0, 0, 838, 847, 5, 126, 0, 0, 839, 848, 5, 7, 0, 0, 840, 845, 3, 68, 34, 0, 841, 843, 5, 35, 0, 0, 842, 841, 1, 0, 0, 0, 842, 843, 1, 0, 0, 0, 843, 844, 1, 0, 0, 0, 844, 846, 3, 172, 86, 0, 845, 842, 1, 0, 0, 0, 845, 846, 1, 0, 0, 0, 846, 848, 1, 0, 0, 0, 847, 839, 1, 0, 0, 0, 847, 840, 1, 0, 0, 0, 848, 862, 1, 0, 0, 0, 849, 858, 5, 5, 0, 0, 850, 859, 5, 7, 0, 0, 851, 856, 3, 68, 34, 0, 852, 854, 5, 35, 0, 0, 853, 852, 1, 0, 0, 0, 853, 854, 1, 0, 0, 0, 854, 855, 1, 0, 0, 0, 855, 857, 3, 172, 86, 0, 856, 853, 1, 0, 0, 0, 856, 857, 1, 0, 0, 0, 857, 859, 1, 0, 0, 0, 858, 850, 1, 0, 0, 0, 858, 851, 1, 0, 0, 0, 859, 861, 1, 0, 0, 0, 860, 849, 1, 0, 0, 0, 861, 864, 1, 0, 0, 0, 862, 860, 1, 0, 0, 0, 862, 863, 1, 0, 0, 0, 863, 59, 1, 0, 0, 0, 864, 862, 1, 0, 0, 0, 865, 867, 3, 50, 25, 0, 866, 865, 1, 0, 0, 0, 866, 867, 1, 0, 0, 0, 867, 868, 1, 0, 0, 0, 868, 869, 5, 61, 0, 0, 869, 870, 5, 77, 0, 0, 870, 873, 3, 112, 56, 0, 871, 872, 5, 151, 0, 0, 872, 874, 3, 68, 34, 0, 873, 871, 1, 0, 0, 0, 873, 874, 1, 0, 0, 0, 874, 876, 1, 0, 0, 0, 875, 877, 3, 58, 29, 0, 876, 875, 1, 0, 0, 0, 876, 877, 1, 0, 0, 0, 877, 61, 1, 0, 0, 0, 878, 880, 3, 50, 25, 0, 879, 878, 1, 0, 0, 0, 879, 880, 1, 0, 0, 0, 880, 881, 1, 0, 0, 0, 881, 882, 5, 61, 0, 0, 882, 883, 5, 77, 0, 0, 883, 886, 3, 112, 56, 0, 884, 885, 5, 151, 0, 0, 885, 887, 3, 68, 34, 0, 886, 884, 1, 0, 0, 0, 886, 887, 1, 0, 0, 0, 887, 892, 1, 0, 0, 0, 888, 890, 3, 134, 67, 0, 889, 888, 1, 0, 0, 0, 889, 890, 1, 0, 0, 0, 890, 891, 1, 0, 0, 0, 891, 893, 3, 136, 68, 0, 892, 889, 1, 0, 0, 0, 892, 893, 1, 0, 0, 0, 893, 895, 1, 0, 0, 0, 894, 896, 3, 58, 29, 0, 895, 894, 1, 0, 0, 0, 895, 896, 1, 0, 0, 0, 896, 63, 1, 0, 0, 0, 897, 899, 5, 63, 0, 0, 898, 900, 5, 57, 0, 0, 899, 898, 1, 0, 0, 0, 899, 900, 1, 0, 0, 0, 900, 901, 1, 0, 0, 0, 901, 902, 3, 182, 91, 0, 902, 65, 1, 0, 0, 0, 903, 904, 5, 65, 0, 0, 904, 907, 7, 9, 0, 0, 905, 906, 5, 82, 0, 0, 906, 908, 5, 72, 0, 0, 907, 905, 1, 0, 0, 0, 907, 908, 1, 0, 0, 0, 908, 912, 1, 0, 0, 0, 909, 910, 3, 182, 91, 0, 910, 911, 5, 2, 0, 0, 911, 913, 1, 0, 0, 0, 912, 909, 1, 0, 0, 0, 912, 913, 1, 0, 0, 0, 913, 914, 1, 0, 0, 0, 914, 915, 3, 228, 114, 0, 915, 67, 1, 0, 0, 0, 916, 917, 6, 34, -1, 0, 917, 1006, 3, 72, 36, 0, 918, 1006, 5, 190, 0, 0, 919, 1006, 5, 191, 0, 0, 920, 921, 3, 182, 91, 0, 921, 922, 5, 2, 0, 0, 922, 924, 1, 0, 0, 0, 923, 920, 1, 0, 0, 0, 923, 924, 1, 0, 0, 0, 924, 925, 1, 0, 0, 0, 925, 926, 3, 184, 92, 0, 926, 927, 5, 2, 0, 0, 927, 929, 1, 0, 0, 0, 928, 923, 1, 0, 0, 0, 928, 929, 1, 0, 0, 0, 929, 930, 1, 0, 0, 0, 930, 1006, 3, 190, 95, 0, 931, 932, 3, 166, 83, 0, 932, 933, 3, 68, 34, 21, 933, 1006, 1, 0, 0, 0, 934, 935, 3, 180, 90, 0, 935, 948, 5, 3, 0, 0, 936, 938, 5, 64, 0, 0, 937, 936, 1, 0, 0, 0, 937, 938, 1, 0, 0, 0, 938, 939, 1, 0, 0, 0, 939, 944, 3, 68, 34, 0, 940, 941, 5, 5, 0, 0, 941, 943, 3, 68, 34, 0, 942, 940, 1, 0, 0, 0, 943, 946, 1, 0, 0, 0, 944, 942, 1, 0, 0, 0, 944, 945, 1, 0, 0, 0, 945, 949, 1, 0, 0, 0, 946, 944, 1, 0, 0, 0, 947, 949, 5, 7, 0, 0, 948, 937, 1, 0, 0, 0, 948, 947, 1, 0, 0, 0, 948, 949, 1, 0, 0, 0, 949, 950, 1, 0, 0, 0, 950, 952, 5, 4, 0, 0, 951, 953, 3, 116, 58, 0, 952, 951, 1, 0, 0, 0, 952, 953, 1, 0, 0, 0, 953, 955, 1, 0, 0, 0, 954, 956, 3, 120, 60, 0, 955, 954, 1, 0, 0, 0, 955, 956, 1, 0, 0, 0, 956, 1006, 1, 0, 0, 0, 957, 958, 5, 3, 0, 0, 958, 963, 3, 68, 34, 0, 959, 960, 5, 5, 0, 0, 960, 962, 3, 68, 34, 0, 961, 959, 1, 0, 0, 0, 962, 965, 1, 0, 0, 0, 963, 961, 1, 0, 0, 0, 963, 964, 1, 0, 0, 0, 964, 966, 1, 0, 0, 0, 965, 963, 1, 0, 0, 0, 966, 967, 5, 4, 0, 0, 967, 1006, 1, 0, 0, 0, 968, 969, 5, 45, 0, 0, 969, 970, 5, 3, 0, 0, 970, 971, 3, 68, 34, 0, 971, 972, 5, 35, 0, 0, 972, 973, 3, 32, 16, 0, 973, 974, 5, 4, 0, 0, 974, 1006, 1, 0, 0, 0, 975, 977, 5, 104, 0, 0, 976, 975, 1, 0, 0, 0, 976, 977, 1, 0, 0, 0, 977, 978, 1, 0, 0, 0, 978, 980, 5, 72, 0, 0, 979, 976, 1, 0, 0, 0, 979, 980, 1, 0, 0, 0, 980, 981, 1, 0, 0, 0, 981, 982, 5, 3, 0, 0, 982, 983, 3, 84, 42, 0, 983, 984, 5, 4, 0, 0, 984, 1006, 1, 0, 0, 0, 985, 987, 5, 44, 0, 0, 986, 988, 3, 68, 34, 0, 987, 986, 1, 0, 0, 0, 987, 988, 1, 0, 0, 0, 988, 994, 1, 0, 0, 0, 989, 990, 5, 150, 0, 0, 990, 991, 3, 68, 34, 0, 991, 992, 5, 138, 0, 0, 992, 993, 3, 68, 34, 0, 993, 995, 1, 0, 0, 0, 994, 989, 1, 0, 0, 0, 995, 996, 1, 0, 0, 0, 996, 994, 1, 0, 0, 0, 996, 997, 1, 0, 0, 0, 997, 1000, 1, 0, 0, 0, 998, 999, 5, 67, 0, 0, 999, 1001, 3, 68, 34, 0, 1000, 998, 1, 0, 0, 0, 1000, 1001, 1, 0, 0, 0, 1001, 1002, 1, 0, 0, 0, 1002, 1003, 5, 68, 0, 0, 1003, 1006, 1, 0, 0, 0, 1004, 1006, 3, 70, 35, 0, 1005, 916, 1, 0, 0, 0, 1005, 918, 1, 0, 0, 0, 1005, 919, 1, 0, 0, 0, 1005, 928, 1, 0, 0, 0, 1005, 931, 1, 0, 0, 0, 1005, 934, 1, 0, 0, 0, 1005, 957, 1, 0, 0, 0, 1005, 968, 1, 0, 0, 0, 1005, 979, 1, 0, 0, 0, 1005, 985, 1, 0, 0, 0, 1005, 1004, 1, 0, 0, 0, 1006, 1126, 1, 0, 0, 0, 1007, 1008, 10, 20, 0, 0, 1008, 1009, 5, 13, 0, 0, 1009, 1125, 3, 68, 34, 21, 1010, 1011, 10, 19, 0, 0, 1011, 1012, 7, 10, 0, 0, 1012, 1125, 3, 68, 34, 20, 1013, 1014, 10, 18, 0, 0, 1014, 1015, 7, 11, 0, 0, 1015, 1125, 3, 68, 34, 19, 1016, 1017, 10, 17, 0, 0, 1017, 1018, 7, 4, 0, 0, 1018, 1125, 3, 68, 34, 18, 1019, 1020, 10, 16, 0, 0, 1020, 1021, 7, 12, 0, 0, 1021, 1125, 3, 68, 34, 17, 1022, 1023, 10, 15, 0, 0, 1023, 1024, 7, 13, 0, 0, 1024, 1125, 3, 68, 34, 16, 1025, 1041, 10, 14, 0, 0, 1026, 1042, 5, 6, 0, 0, 1027, 1042, 5, 24, 0, 0, 1028, 1042, 5, 25, 0, 0, 1029, 1042, 5, 26, 0, 0, 1030, 1042, 5, 94, 0, 0, 1031, 1032, 5, 94, 0, 0, 1032, 1042, 5, 104, 0, 0, 1033, 1035, 5, 104, 0, 0, 1034, 1033, 1, 0, 0, 0, 1034, 1035, 1, 0, 0, 0, 1035, 1036, 1, 0, 0, 0, 1036, 1042, 5, 85, 0, 0, 1037, 1042, 5, 99, 0, 0, 1038, 1042, 5, 79, 0, 0, 1039, 1042, 5, 101, 0, 0, 1040, 1042, 5, 120, 0, 0, 1041, 1026, 1, 0, 0, 0, 1041, 1027, 1, 0, 0, 0, 1041, 1028, 1, 0, 0, 0, 1041, 1029, 1, 0, 0, 0, 1041, 1030, 1, 0, 0, 0, 1041, 1031, 1, 0, 0, 0, 1041, 1034, 1, 0, 0, 0, 1041, 1037, 1, 0, 0, 0, 1041, 1038, 1, 0, 0, 0, 1041, 1039, 1, 0, 0, 0, 1041, 1040, 1, 0, 0, 0, 1042, 1043, 1, 0, 0, 0, 1043, 1125, 3, 68, 34, 15, 1044, 1045, 10, 12, 0, 0, 1045, 1046, 5, 34, 0, 0, 1046, 1125, 3, 68, 34, 13, 1047, 1048, 10, 11, 0, 0, 1048, 1049, 5, 110, 0, 0, 1049, 1125, 3, 68, 34, 12, 1050, 1052, 10, 4, 0, 0, 1051, 1053, 5, 104, 0, 0, 1052, 1051, 1, 0, 0, 0, 1052, 1053, 1, 0, 0, 0, 1053, 1054, 1, 0, 0, 0, 1054, 1055, 5, 41, 0, 0, 1055, 1056, 3, 68, 34, 0, 1056, 1057, 5, 34, 0, 0, 1057, 1058, 3, 68, 34, 5, 1058, 1125, 1, 0, 0, 0, 1059, 1061, 10, 13, 0, 0, 1060, 1062, 5, 104, 0, 0, 1061, 1060, 1, 0, 0, 0, 1061, 1062, 1, 0, 0, 0, 1062, 1063, 1, 0, 0, 0, 1063, 1102, 5, 85, 0, 0, 1064, 1074, 5, 3, 0, 0, 1065, 1075, 3, 84, 42, 0, 1066, 1071, 3, 68, 34, 0, 1067, 1068, 5, 5, 0, 0, 1068, 1070, 3, 68, 34, 0, 1069, 1067, 1, 0, 0, 0, 1070, 1073, 1, 0, 0, 0, 1071, 1069, 1, 0, 0, 0, 1071, 1072, 1, 0, 0, 0, 1072, 1075, 1, 0, 0, 0, 1073, 1071, 1, 0, 0, 0, 1074, 1065, 1, 0, 0, 0, 1074, 1066, 1, 0, 0, 0, 1074, 1075, 1, 0, 0, 0, 1075, 1076, 1, 0, 0, 0, 1076, 1103, 5, 4, 0, 0, 1077, 1078, 3, 182, 91, 0, 1078, 1079, 5, 2, 0, 0, 1079, 1081, 1, 0, 0, 0, 1080, 1077, 1, 0, 0, 0, 1080, 1081, 1, 0, 0, 0, 1081, 1082, 1, 0, 0, 0, 1082, 1103, 3, 184, 92, 0, 1083, 1084, 3, 182, 91, 0, 1084, 1085, 5, 2, 0, 0, 1085, 1087, 1, 0, 0, 0, 1086, 1083, 1, 0, 0, 0, 1086, 1087, 1, 0, 0, 0, 1087, 1088, 1, 0, 0, 0, 1088, 1089, 3, 226, 113, 0, 1089, 1098, 5, 3, 0, 0, 1090, 1095, 3, 68, 34, 0, 1091, 1092, 5, 5, 0, 0, 1092, 1094, 3, 68, 34, 0, 1093, 1091, 1, 0, 0, 0, 1094, 1097, 1, 0, 0, 0, 1095, 1093, 1, 0, 0, 0, 1095, 1096, 1, 0, 0, 0, 1096, 1099, 1, 0, 0, 0, 1097, 1095, 1, 0, 0, 0, 1098, 1090, 1, 0, 0, 0, 1098, 1099, 1, 0, 0, 0, 1099, 1100, 1, 0, 0, 0, 1100, 1101, 5, 4, 0, 0, 1101, 1103, 1, 0, 0, 0, 1102, 1064, 1, 0, 0, 0, 1102, 1080, 1, 0, 0, 0, 1102, 1086, 1, 0, 0, 0, 1103, 1125, 1, 0, 0, 0, 1104, 1105, 10, 7, 0, 0, 1105, 1106, 5, 47, 0, 0, 1106, 1125, 3, 192, 96, 0, 1107, 1109, 10, 6, 0, 0, 1108, 1110, 5, 104, 0, 0, 1109, 1108, 1, 0, 0, 0, 1109, 1110, 1, 0, 0, 0, 1110, 1111, 1, 0, 0, 0, 1111, 1112, 7, 14, 0, 0, 1112, 1115, 3, 68, 34, 0, 1113, 1114, 5, 69, 0, 0, 1114, 1116, 3, 68, 34, 0, 1115, 1113, 1, 0, 0, 0, 1115, 1116, 1, 0, 0, 0, 1116, 1125, 1, 0, 0, 0, 1117, 1122, 10, 5, 0, 0, 1118, 1123, 5, 95, 0, 0, 1119, 1123, 5, 105, 0, 0, 1120, 1121, 5, 104, 0, 0, 1121, 1123, 5, 106, 0, 0, 1122, 1118, 1, 0, 0, 0, 1122, 1119, 1, 0, 0, 0, 1122, 1120, 1, 0, 0, 0, 1123, 1125, 1, 0, 0, 0, 1124, 1007, 1, 0, 0, 0, 1124, 1010, 1, 0, 0, 0, 1124, 1013, 1, 0, 0, 0, 1124, 1016, 1, 0, 0, 0, 1124, 1019, 1, 0, 0, 0, 1124, 1022, 1, 0, 0, 0, 1124, 1025, 1, 0, 0, 0, 1124, 1044, 1, 0, 0, 0, 1124, 1047, 1, 0, 0, 0, 1124, 1050, 1, 0, 0, 0, 1124, 1059, 1, 0, 0, 0, 1124, 1104, 1, 0, 0, 0, 1124, 1107, 1, 0, 0, 0, 1124, 1117, 1, 0, 0, 0, 1125, 1128, 1, 0, 0, 0, 1126, 1124, 1, 0, 0, 0, 1126, 1127, 1, 0, 0, 0, 1127, 69, 1, 0, 0, 0, 1128, 1126, 1, 0, 0, 0, 1129, 1130, 5, 117, 0, 0, 1130, 1135, 5, 3, 0, 0, 1131, 1136, 5, 83, 0, 0, 1132, 1133, 7, 15, 0, 0, 1133, 1134, 5, 5, 0, 0, 1134, 1136, 3, 168, 84, 0, 1135, 1131, 1, 0, 0, 0, 1135, 1132, 1, 0, 0, 0, 1136, 1137, 1, 0, 0, 0, 1137, 1138, 5, 4, 0, 0, 1138, 71, 1, 0, 0, 0, 1139, 1140, 7, 16, 0, 0, 1140, 73, 1, 0, 0, 0, 1141, 1143, 3, 50, 25, 0, 1142, 1141, 1, 0, 0, 0, 1142, 1143, 1, 0, 0, 0, 1143, 1149, 1, 0, 0, 0, 1144, 1150, 5, 90, 0, 0, 1145, 1150, 5, 124, 0, 0, 1146, 1147, 5, 90, 0, 0, 1147, 1148, 5, 110, 0, 0, 1148, 1150, 7, 8, 0, 0, 1149, 1144, 1, 0, 0, 0, 1149, 1145, 1, 0, 0, 0, 1149, 1146, 1, 0, 0, 0, 1150, 1151, 1, 0, 0, 0, 1151, 1155, 5, 93, 0, 0, 1152, 1153, 3, 182, 91, 0, 1153, 1154, 5, 2, 0, 0, 1154, 1156, 1, 0, 0, 0, 1155, 1152, 1, 0, 0, 0, 1155, 1156, 1, 0, 0, 0, 1156, 1157, 1, 0, 0, 0, 1157, 1160, 3, 184, 92, 0, 1158, 1159, 5, 35, 0, 0, 1159, 1161, 3, 208, 104, 0, 1160, 1158, 1, 0, 0, 0, 1160, 1161, 1, 0, 0, 0, 1161, 1173, 1, 0, 0, 0, 1162, 1163, 5, 3, 0, 0, 1163, 1168, 3, 190, 95, 0, 1164, 1165, 5, 5, 0, 0, 1165, 1167, 3, 190, 95, 0, 1166, 1164, 1, 0, 0, 0, 1167, 1170, 1, 0, 0, 0, 1168, 1166, 1, 0, 0, 0, 1168, 1169, 1, 0, 0, 0, 1169, 1171, 1, 0, 0, 0, 1170, 1168, 1, 0, 0, 0, 1171, 1172, 5, 4, 0, 0, 1172, 1174, 1, 0, 0, 0, 1173, 1162, 1, 0, 0, 0, 1173, 1174, 1, 0, 0, 0, 1174, 1206, 1, 0, 0, 0, 1175, 1176, 5, 147, 0, 0, 1176, 1177, 5, 3, 0, 0, 1177, 1182, 3, 68, 34, 0, 1178, 1179, 5, 5, 0, 0, 1179, 1181, 3, 68, 34, 0, 1180, 1178, 1, 0, 0, 0, 1181, 1184, 1, 0, 0, 0, 1182, 1180, 1, 0, 0, 0, 1182, 1183, 1, 0, 0, 0, 1183, 1185, 1, 0, 0, 0, 1184, 1182, 1, 0, 0, 0, 1185, 1200, 5, 4, 0, 0, 1186, 1187, 5, 5, 0, 0, 1187, 1188, 5, 3, 0, 0, 1188, 1193, 3, 68, 34, 0, 1189, 1190, 5, 5, 0, 0, 1190, 1192, 3, 68, 34, 0, 1191, 1189, 1, 0, 0, 0, 1192, 1195, 1, 0, 0, 0, 1193, 1191, 1, 0, 0, 0, 1193, 1194, 1, 0, 0, 0, 1194, 1196, 1, 0, 0, 0, 1195, 1193, 1, 0, 0, 0, 1196, 1197, 5, 4, 0, 0, 1197, 1199, 1, 0, 0, 0, 1198, 1186, 1, 0, 0, 0, 1199, 1202, 1, 0, 0, 0, 1200, 1198, 1, 0, 0, 0, 1200, 1201, 1, 0, 0, 0, 1201, 1207, 1, 0, 0, 0, 1202, 1200, 1, 0, 0, 0, 1203, 1207, 3, 84, 42, 0, 1204, 1205, 5, 58, 0, 0, 1205, 1207, 5, 147, 0, 0, 1206, 1175, 1, 0, 0, 0, 1206, 1203, 1, 0, 0, 0, 1206, 1204, 1, 0, 0, 0, 1207, 1209, 1, 0, 0, 0, 1208, 1210, 3, 76, 38, 0, 1209, 1208, 1, 0, 0, 0, 1209, 1210, 1, 0, 0, 0, 1210, 1212, 1, 0, 0, 0, 1211, 1213, 3, 58, 29, 0, 1212, 1211, 1, 0, 0, 0, 1212, 1213, 1, 0, 0, 0, 1213, 75, 1, 0, 0, 0, 1214, 1215, 5, 109, 0, 0, 1215, 1230, 5, 50, 0, 0, 1216, 1217, 5, 3, 0, 0, 1217, 1222, 3, 24, 12, 0, 1218, 1219, 5, 5, 0, 0, 1219, 1221, 3, 24, 12, 0, 1220, 1218, 1, 0, 0, 0, 1221, 1224, 1, 0, 0, 0, 1222, 1220, 1, 0, 0, 0, 1222, 1223, 1, 0, 0, 0, 1223, 1225, 1, 0, 0, 0, 1224, 1222, 1, 0, 0, 0, 1225, 1228, 5, 4, 0, 0, 1226, 1227, 5, 151, 0, 0, 1227, 1229, 3, 68, 34, 0, 1228, 1226, 1, 0, 0, 0, 1228, 1229, 1, 0, 0, 0, 1229, 1231, 1, 0, 0, 0, 1230, 1216, 1, 0, 0, 0, 1230, 1231, 1, 0, 0, 0, 1231, 1232, 1, 0, 0, 0, 1232, 1259, 5, 186, 0, 0, 1233, 1260, 5, 187, 0, 0, 1234, 1235, 5, 144, 0, 0, 1235, 1238, 5, 133, 0, 0, 1236, 1239, 3, 190, 95, 0, 1237, 1239, 3, 108, 54, 0, 1238, 1236, 1, 0, 0, 0, 1238, 1237, 1, 0, 0, 0, 1239, 1240, 1, 0, 0, 0, 1240, 1241, 5, 6, 0, 0, 1241, 1252, 3, 68, 34, 0, 1242, 1245, 5, 5, 0, 0, 1243, 1246, 3, 190, 95, 0, 1244, 1246, 3, 108, 54, 0, 1245, 1243, 1, 0, 0, 0, 1245, 1244, 1, 0, 0, 0, 1246, 1247, 1, 0, 0, 0, 1247, 1248, 5, 6, 0, 0, 1248, 1249, 3, 68, 34, 0, 1249, 1251, 1, 0, 0, 0, 1250, 1242, 1, 0, 0, 0, 1251, 1254, 1, 0, 0, 0, 1252, 1250, 1, 0, 0, 0, 1252, 1253, 1, 0, 0, 0, 1253, 1257, 1, 0, 0, 0, 1254, 1252, 1, 0, 0, 0, 1255, 1256, 5, 151, 0, 0, 1256, 1258, 3, 68, 34, 0, 1257, 1255, 1, 0, 0, 0, 1257, 1258, 1, 0, 0, 0, 1258, 1260, 1, 0, 0, 0, 1259, 1233, 1, 0, 0, 0, 1259, 1234, 1, 0, 0, 0, 1260, 77, 1, 0, 0, 0, 1261, 1265, 5, 114, 0, 0, 1262, 1263, 3, 182, 91, 0, 1263, 1264, 5, 2, 0, 0, 1264, 1266, 1, 0, 0, 0, 1265, 1262, 1, 0, 0, 0, 1265, 1266, 1, 0, 0, 0, 1266, 1267, 1, 0, 0, 0, 1267, 1274, 3, 204, 102, 0, 1268, 1269, 5, 6, 0, 0, 1269, 1275, 3, 80, 40, 0, 1270, 1271, 5, 3, 0, 0, 1271, 1272, 3, 80, 40, 0, 1272, 1273, 5, 4, 0, 0, 1273, 1275, 1, 0, 0, 0, 1274, 1268, 1, 0, 0, 0, 1274, 1270, 1, 0, 0, 0, 1274, 1275, 1, 0, 0, 0, 1275, 79, 1, 0, 0, 0, 1276, 1280, 3, 36, 18, 0, 1277, 1280, 3, 176, 88, 0, 1278, 1280, 5, 192, 0, 0, 1279, 1276, 1, 0, 0, 0, 1279, 1277, 1, 0, 0, 0, 1279, 1278, 1, 0, 0, 0, 1280, 81, 1, 0, 0, 0, 1281, 1292, 5, 121, 0, 0, 1282, 1293, 3, 192, 96, 0, 1283, 1284, 3, 182, 91, 0, 1284, 1285, 5, 2, 0, 0, 1285, 1287, 1, 0, 0, 0, 1286, 1283, 1, 0, 0, 0, 1286, 1287, 1, 0, 0, 0, 1287, 1290, 1, 0, 0, 0, 1288, 1291, 3, 184, 92, 0, 1289, 1291, 3, 196, 98, 0, 1290, 1288, 1, 0, 0, 0, 1290, 1289, 1, 0, 0, 0, 1291, 1293, 1, 0, 0, 0, 1292, 1282, 1, 0, 0, 0, 1292, 1286, 1, 0, 0, 0, 1292, 1293, 1, 0, 0, 0, 1293, 83, 1, 0, 0, 0, 1294, 1296, 3, 132, 66, 0, 1295, 1294, 1, 0, 0, 0, 1295, 1296, 1, 0, 0, 0, 1296, 1297, 1, 0, 0, 0, 1297, 1303, 3, 88, 44, 0, 1298, 1299, 3, 104, 52, 0, 1299, 1300, 3, 88, 44, 0, 1300, 1302, 1, 0, 0, 0, 1301, 1298, 1, 0, 0, 0, 1302, 1305, 1, 0, 0, 0, 1303, 1301, 1, 0, 0, 0, 1303, 1304, 1, 0, 0, 0, 1304, 1307, 1, 0, 0, 0, 1305, 1303, 1, 0, 0, 0, 1306, 1308, 3, 134, 67, 0, 1307, 1306, 1, 0, 0, 0, 1307, 1308, 1, 0, 0, 0, 1308, 1310, 1, 0, 0, 0, 1309, 1311, 3, 136, 68, 0, 1310, 1309, 1, 0, 0, 0, 1310, 1311, 1, 0, 0, 0, 1311, 85, 1, 0, 0, 0, 1312, 1319, 3, 96, 48, 0, 1313, 1314, 3, 100, 50, 0, 1314, 1315, 3, 96, 48, 0, 1315, 1316, 3, 102, 51, 0, 1316, 1318, 1, 0, 0, 0, 1317, 1313, 1, 0, 0, 0, 1318, 1321, 1, 0, 0, 0, 1319, 1317, 1, 0, 0, 0, 1319, 1320, 1, 0, 0, 0, 1320, 87, 1, 0, 0, 0, 1321, 1319, 1, 0, 0, 0, 1322, 1324, 5, 132, 0, 0, 1323, 1325, 7, 17, 0, 0, 1324, 1323, 1, 0, 0, 0, 1324, 1325, 1, 0, 0, 0, 1325, 1326, 1, 0, 0, 0, 1326, 1331, 3, 98, 49, 0, 1327, 1328, 5, 5, 0, 0, 1328, 1330, 3, 98, 49, 0, 1329, 1327, 1, 0, 0, 0, 1330, 1333, 1, 0, 0, 0, 1331, 1329, 1, 0, 0, 0, 1331, 1332, 1, 0, 0, 0, 1332, 1346, 1, 0, 0, 0, 1333, 1331, 1, 0, 0, 0, 1334, 1344, 5, 77, 0, 0, 1335, 1340, 3, 96, 48, 0, 1336, 1337, 5, 5, 0, 0, 1337, 1339, 3, 96, 48, 0, 1338, 1336, 1, 0, 0, 0, 1339, 1342, 1, 0, 0, 0, 1340, 1338, 1, 0, 0, 0, 1340, 1341, 1, 0, 0, 0, 1341, 1345, 1, 0, 0, 0, 1342, 1340, 1, 0, 0, 0, 1343, 1345, 3, 86, 43, 0, 1344, 1335, 1, 0, 0, 0, 1344, 1343, 1, 0, 0, 0, 1345, 1347, 1, 0, 0, 0, 1346, 1334, 1, 0, 0, 0, 1346, 1347, 1, 0, 0, 0, 1347, 1350, 1, 0, 0, 0, 1348, 1349, 5, 151, 0, 0, 1349, 1351, 3, 68, 34, 0, 1350, 1348, 1, 0, 0, 0, 1350, 1351, 1, 0, 0, 0, 1351, 1366, 1, 0, 0, 0, 1352, 1353, 5, 80, 0, 0, 1353, 1354, 5, 42, 0, 0, 1354, 1359, 3, 68, 34, 0, 1355, 1356, 5, 5, 0, 0, 1356, 1358, 3, 68, 34, 0, 1357, 1355, 1, 0, 0, 0, 1358, 1361, 1, 0, 0, 0, 1359, 1357, 1, 0, 0, 0, 1359, 1360, 1, 0, 0, 0, 1360, 1364, 1, 0, 0, 0, 1361, 1359, 1, 0, 0, 0, 1362, 1363, 5, 81, 0, 0, 1363, 1365, 3, 68, 34, 0, 1364, 1362, 1, 0, 0, 0, 1364, 1365, 1, 0, 0, 0, 1365, 1367, 1, 0, 0, 0, 1366, 1352, 1, 0, 0, 0, 1366, 1367, 1, 0, 0, 0, 1367, 1382, 1, 0, 0, 0, 1368, 1369, 5, 177, 0, 0, 1369, 1370, 3, 214, 107, 0, 1370, 1371, 5, 35, 0, 0, 1371, 1379, 3, 118, 59, 0, 1372, 1373, 5, 5, 0, 0, 1373, 1374, 3, 214, 107, 0, 1374, 1375, 5, 35, 0, 0, 1375, 1376, 3, 118, 59, 0, 1376, 1378, 1, 0, 0, 0, 1377, 1372, 1, 0, 0, 0, 1378, 1381, 1, 0, 0, 0, 1379, 1377, 1, 0, 0, 0, 1379, 1380, 1, 0, 0, 0, 1380, 1383, 1, 0, 0, 0, 1381, 1379, 1, 0, 0, 0, 1382, 1368, 1, 0, 0, 0, 1382, 1383, 1, 0, 0, 0, 1383, 1413, 1, 0, 0, 0, 1384, 1385, 5, 147, 0, 0, 1385, 1386, 5, 3, 0, 0, 1386, 1391, 3, 68, 34, 0, 1387, 1388, 5, 5, 0, 0, 1388, 1390, 3, 68, 34, 0, 1389, 1387, 1, 0, 0, 0, 1390, 1393, 1, 0, 0, 0, 1391, 1389, 1, 0, 0, 0, 1391, 1392, 1, 0, 0, 0, 1392, 1394, 1, 0, 0, 0, 1393, 1391, 1, 0, 0, 0, 1394, 1409, 5, 4, 0, 0, 1395, 1396, 5, 5, 0, 0, 1396, 1397, 5, 3, 0, 0, 1397, 1402, 3, 68, 34, 0, 1398, 1399, 5, 5, 0, 0, 1399, 1401, 3, 68, 34, 0, 1400, 1398, 1, 0, 0, 0, 1401, 1404, 1, 0, 0, 0, 1402, 1400, 1, 0, 0, 0, 1402, 1403, 1, 0, 0, 0, 1403, 1405, 1, 0, 0, 0, 1404, 1402, 1, 0, 0, 0, 1405, 1406, 5, 4, 0, 0, 1406, 1408, 1, 0, 0, 0, 1407, 1395, 1, 0, 0, 0, 1408, 1411, 1, 0, 0, 0, 1409, 1407, 1, 0, 0, 0, 1409, 1410, 1, 0, 0, 0, 1410, 1413, 1, 0, 0, 0, 1411, 1409, 1, 0, 0, 0, 1412, 1322, 1, 0, 0, 0, 1412, 1384, 1, 0, 0, 0, 1413, 89, 1, 0, 0, 0, 1414, 1415, 3, 84, 42, 0, 1415, 91, 1, 0, 0, 0, 1416, 1418, 3, 132, 66, 0, 1417, 1416, 1, 0, 0, 0, 1417, 1418, 1, 0, 0, 0, 1418, 1419, 1, 0, 0, 0, 1419, 1421, 3, 88, 44, 0, 1420, 1422, 3, 134, 67, 0, 1421, 1420, 1, 0, 0, 0, 1421, 1422, 1, 0, 0, 0, 1422, 1424, 1, 0, 0, 0, 1423, 1425, 3, 136, 68, 0, 1424, 1423, 1, 0, 0, 0, 1424, 1425, 1, 0, 0, 0, 1425, 93, 1, 0, 0, 0, 1426, 1428, 3, 132, 66, 0, 1427, 1426, 1, 0, 0, 0, 1427, 1428, 1, 0, 0, 0, 1428, 1429, 1, 0, 0, 0, 1429, 1439, 3, 88, 44, 0, 1430, 1432, 5, 142, 0, 0, 1431, 1433, 5, 31, 0, 0, 1432, 1431, 1, 0, 0, 0, 1432, 1433, 1, 0, 0, 0, 1433, 1437, 1, 0, 0, 0, 1434, 1437, 5, 92, 0, 0, 1435, 1437, 5, 70, 0, 0, 1436, 1430, 1, 0, 0, 0, 1436, 1434, 1, 0, 0, 0, 1436, 1435, 1, 0, 0, 0, 1437, 1438, 1, 0, 0, 0, 1438, 1440, 3, 88, 44, 0, 1439, 1436, 1, 0, 0, 0, 1440, 1441, 1, 0, 0, 0, 1441, 1439, 1, 0, 0, 0, 1441, 1442, 1, 0, 0, 0, 1442, 1444, 1, 0, 0, 0, 1443, 1445, 3, 134, 67, 0, 1444, 1443, 1, 0, 0, 0, 1444, 1445, 1, 0, 0, 0, 1445, 1447, 1, 0, 0, 0, 1446, 1448, 3, 136, 68, 0, 1447, 1446, 1, 0, 0, 0, 1447, 1448, 1, 0, 0, 0, 1448, 95, 1, 0, 0, 0, 1449, 1450, 3, 182, 91, 0, 1450, 1451, 5, 2, 0, 0, 1451, 1453, 1, 0, 0, 0, 1452, 1449, 1, 0, 0, 0, 1452, 1453, 1, 0, 0, 0, 1453, 1454, 1, 0, 0, 0, 1454, 1459, 3, 184, 92, 0, 1455, 1457, 5, 35, 0, 0, 1456, 1455, 1, 0, 0, 0, 1456, 1457, 1, 0, 0, 0, 1457, 1458, 1, 0, 0, 0, 1458, 1460, 3, 208, 104, 0, 1459, 1456, 1, 0, 0, 0, 1459, 1460, 1, 0, 0, 0, 1460, 1466, 1, 0, 0, 0, 1461, 1462, 5, 87, 0, 0, 1462, 1463, 5, 42, 0, 0, 1463, 1467, 3, 196, 98, 0, 1464, 1465, 5, 104, 0, 0, 1465, 1467, 5, 87, 0, 0, 1466, 1461, 1, 0, 0, 0, 1466, 1464, 1, 0, 0, 0, 1466, 1467, 1, 0, 0, 0, 1467, 1578, 1, 0, 0, 0, 1468, 1469, 3, 182, 91, 0, 1469, 1470, 5, 2, 0, 0, 1470, 1472, 1, 0, 0, 0, 1471, 1468, 1, 0, 0, 0, 1471, 1472, 1, 0, 0, 0, 1472, 1473, 1, 0, 0, 0, 1473, 1474, 3, 226, 113, 0, 1474, 1475, 5, 3, 0, 0, 1475, 1480, 3, 68, 34, 0, 1476, 1477, 5, 5, 0, 0, 1477, 1479, 3, 68, 34, 0, 1478, 1476, 1, 0, 0, 0, 1479, 1482, 1, 0, 0, 0, 1480, 1478, 1, 0, 0, 0, 1480, 1481, 1, 0, 0, 0, 1481, 1483, 1, 0, 0, 0, 1482, 1480, 1, 0, 0, 0, 1483, 1488, 5, 4, 0, 0, 1484, 1486, 5, 35, 0, 0, 1485, 1484, 1, 0, 0, 0, 1485, 1486, 1, 0, 0, 0, 1486, 1487, 1, 0, 0, 0, 1487, 1489, 3, 208, 104, 0, 1488, 1485, 1, 0, 0, 0, 1488, 1489, 1, 0, 0, 0, 1489, 1578, 1, 0, 0, 0, 1490, 1500, 5, 3, 0, 0, 1491, 1496, 3, 96, 48, 0, 1492, 1493, 5, 5, 0, 0, 1493, 1495, 3, 96, 48, 0, 1494, 1492, 1, 0, 0, 0, 1495, 1498, 1, 0, 0, 0, 1496, 1494, 1, 0, 0, 0, 1496, 1497, 1, 0, 0, 0, 1497, 1501, 1, 0, 0, 0, 1498, 1496, 1, 0, 0, 0, 1499, 1501, 3, 86, 43, 0, 1500, 1491, 1, 0, 0, 0, 1500, 1499, 1, 0, 0, 0, 1501, 1502, 1, 0, 0, 0, 1502, 1503, 5, 4, 0, 0, 1503, 1578, 1, 0, 0, 0, 1504, 1505, 5, 3, 0, 0, 1505, 1506, 3, 84, 42, 0, 1506, 1511, 5, 4, 0, 0, 1507, 1509, 5, 35, 0, 0, 1508, 1507, 1, 0, 0, 0, 1508, 1509, 1, 0, 0, 0, 1509, 1510, 1, 0, 0, 0, 1510, 1512, 3, 208, 104, 0, 1511, 1508, 1, 0, 0, 0, 1511, 1512, 1, 0, 0, 0, 1512, 1578, 1, 0, 0, 0, 1513, 1514, 3, 182, 91, 0, 1514, 1515, 5, 2, 0, 0, 1515, 1517, 1, 0, 0, 0, 1516, 1513, 1, 0, 0, 0, 1516, 1517, 1, 0, 0, 0, 1517, 1518, 1, 0, 0, 0, 1518, 1523, 3, 184, 92, 0, 1519, 1521, 5, 35, 0, 0, 1520, 1519, 1, 0, 0, 0, 1520, 1521, 1, 0, 0, 0, 1521, 1522, 1, 0, 0, 0, 1522, 1524, 3, 210, 105, 0, 1523, 1520, 1, 0, 0, 0, 1523, 1524, 1, 0, 0, 0, 1524, 1530, 1, 0, 0, 0, 1525, 1526, 5, 87, 0, 0, 1526, 1527, 5, 42, 0, 0, 1527, 1531, 3, 196, 98, 0, 1528, 1529, 5, 104, 0, 0, 1529, 1531, 5, 87, 0, 0, 1530, 1525, 1, 0, 0, 0, 1530, 1528, 1, 0, 0, 0, 1530, 1531, 1, 0, 0, 0, 1531, 1578, 1, 0, 0, 0, 1532, 1533, 3, 182, 91, 0, 1533, 1534, 5, 2, 0, 0, 1534, 1536, 1, 0, 0, 0, 1535, 1532, 1, 0, 0, 0, 1535, 1536, 1, 0, 0, 0, 1536, 1537, 1, 0, 0, 0, 1537, 1538, 3, 226, 113, 0, 1538, 1539, 5, 3, 0, 0, 1539, 1544, 3, 68, 34, 0, 1540, 1541, 5, 5, 0, 0, 1541, 1543, 3, 68, 34, 0, 1542, 1540, 1, 0, 0, 0, 1543, 1546, 1, 0, 0, 0, 1544, 1542, 1, 0, 0, 0, 1544, 1545, 1, 0, 0, 0, 1545, 1547, 1, 0, 0, 0, 1546, 1544, 1, 0, 0, 0, 1547, 1552, 5, 4, 0, 0, 1548, 1550, 5, 35, 0, 0, 1549, 1548, 1, 0, 0, 0, 1549, 1550, 1, 0, 0, 0, 1550, 1551, 1, 0, 0, 0, 1551, 1553, 3, 210, 105, 0, 1552, 1549, 1, 0, 0, 0, 1552, 1553, 1, 0, 0, 0, 1553, 1578, 1, 0, 0, 0, 1554, 1564, 5, 3, 0, 0, 1555, 1560, 3, 96, 48, 0, 1556, 1557, 5, 5, 0, 0, 1557, 1559, 3, 96, 48, 0, 1558, 1556, 1, 0, 0, 0, 1559, 1562, 1, 0, 0, 0, 1560, 1558, 1, 0, 0, 0, 1560, 1561, 1, 0, 0, 0, 1561, 1565, 1, 0, 0, 0, 1562, 1560, 1, 0, 0, 0, 1563, 1565, 3, 86, 43, 0, 1564, 1555, 1, 0, 0, 0, 1564, 1563, 1, 0, 0, 0, 1565, 1566, 1, 0, 0, 0, 1566, 1567, 5, 4, 0, 0, 1567, 1578, 1, 0, 0, 0, 1568, 1569, 5, 3, 0, 0, 1569, 1570, 3, 84, 42, 0, 1570, 1575, 5, 4, 0, 0, 1571, 1573, 5, 35, 0, 0, 1572, 1571, 1, 0, 0, 0, 1572, 1573, 1, 0, 0, 0, 1573, 1574, 1, 0, 0, 0, 1574, 1576, 3, 210, 105, 0, 1575, 1572, 1, 0, 0, 0, 1575, 1576, 1, 0, 0, 0, 1576, 1578, 1, 0, 0, 0, 1577, 1452, 1, 0, 0, 0, 1577, 1471, 1, 0, 0, 0, 1577, 1490, 1, 0, 0, 0, 1577, 1504, 1, 0, 0, 0, 1577, 1516, 1, 0, 0, 0, 1577, 1535, 1, 0, 0, 0, 1577, 1554, 1, 0, 0, 0, 1577, 1568, 1, 0, 0, 0, 1578, 97, 1, 0, 0, 0, 1579, 1592, 5, 7, 0, 0, 1580, 1581, 3, 184, 92, 0, 1581, 1582, 5, 2, 0, 0, 1582, 1583, 5, 7, 0, 0, 1583, 1592, 1, 0, 0, 0, 1584, 1589, 3, 68, 34, 0, 1585, 1587, 5, 35, 0, 0, 1586, 1585, 1, 0, 0, 0, 1586, 1587, 1, 0, 0, 0, 1587, 1588, 1, 0, 0, 0, 1588, 1590, 3, 172, 86, 0, 1589, 1586, 1, 0, 0, 0, 1589, 1590, 1, 0, 0, 0, 1590, 1592, 1, 0, 0, 0, 1591, 1579, 1, 0, 0, 0, 1591, 1580, 1, 0, 0, 0, 1591, 1584, 1, 0, 0, 0, 1592, 99, 1, 0, 0, 0, 1593, 1608, 5, 5, 0, 0, 1594, 1596, 5, 102, 0, 0, 1595, 1594, 1, 0, 0, 0, 1595, 1596, 1, 0, 0, 0, 1596, 1602, 1, 0, 0, 0, 1597, 1599, 7, 18, 0, 0, 1598, 1600, 5, 112, 0, 0, 1599, 1598, 1, 0, 0, 0, 1599, 1600, 1, 0, 0, 0, 1600, 1603, 1, 0, 0, 0, 1601, 1603, 5, 89, 0, 0, 1602, 1597, 1, 0, 0, 0, 1602, 1601, 1, 0, 0, 0, 1602, 1603, 1, 0, 0, 0, 1603, 1604, 1, 0, 0, 0, 1604, 1608, 5, 96, 0, 0, 1605, 1606, 5, 53, 0, 0, 1606, 1608, 5, 96, 0, 0, 1607, 1593, 1, 0, 0, 0, 1607, 1595, 1, 0, 0, 0, 1607, 1605, 1, 0, 0, 0, 1608, 101, 1, 0, 0, 0, 1609, 1610, 5, 109, 0, 0, 1610, 1624, 3, 68, 34, 0, 1611, 1612, 5, 145, 0, 0, 1612, 1613, 5, 3, 0, 0, 1613, 1618, 3, 190, 95, 0, 1614, 1615, 5, 5, 0, 0, 1615, 1617, 3, 190, 95, 0, 1616, 1614, 1, 0, 0, 0, 1617, 1620, 1, 0, 0, 0, 1618, 1616, 1, 0, 0, 0, 1618, 1619, 1, 0, 0, 0, 1619, 1621, 1, 0, 0, 0, 1620, 1618, 1, 0, 0, 0, 1621, 1622, 5, 4, 0, 0, 1622, 1624, 1, 0, 0, 0, 1623, 1609, 1, 0, 0, 0, 1623, 1611, 1, 0, 0, 0, 1623, 1624, 1, 0, 0, 0, 1624, 103, 1, 0, 0, 0, 1625, 1627, 5, 142, 0, 0, 1626, 1628, 5, 31, 0, 0, 1627, 1626, 1, 0, 0, 0, 1627, 1628, 1, 0, 0, 0, 1628, 1632, 1, 0, 0, 0, 1629, 1632, 5, 92, 0, 0, 1630, 1632, 5, 70, 0, 0, 1631, 1625, 1, 0, 0, 0, 1631, 1629, 1, 0, 0, 0, 1631, 1630, 1, 0, 0, 0, 1632, 105, 1, 0, 0, 0, 1633, 1635, 3, 50, 25, 0, 1634, 1633, 1, 0, 0, 0, 1634, 1635, 1, 0, 0, 0, 1635, 1636, 1, 0, 0, 0, 1636, 1639, 5, 144, 0, 0, 1637, 1638, 5, 110, 0, 0, 1638, 1640, 7, 8, 0, 0, 1639, 1637, 1, 0, 0, 0, 1639, 1640, 1, 0, 0, 0, 1640, 1641, 1, 0, 0, 0, 1641, 1642, 3, 112, 56, 0, 1642, 1645, 5, 133, 0, 0, 1643, 1646, 3, 190, 95, 0, 1644, 1646, 3, 108, 54, 0, 1645, 1643, 1, 0, 0, 0, 1645, 1644, 1, 0, 0, 0, 1646, 1647, 1, 0, 0, 0, 1647, 1648, 5, 6, 0, 0, 1648, 1659, 3, 68, 34, 0, 1649, 1652, 5, 5, 0, 0, 1650, 1653, 3, 190, 95, 0, 1651, 1653, 3, 108, 54, 0, 1652, 1650, 1, 0, 0, 0, 1652, 1651, 1, 0, 0, 0, 1653, 1654, 1, 0, 0, 0, 1654, 1655, 5, 6, 0, 0, 1655, 1656, 3, 68, 34, 0, 1656, 1658, 1, 0, 0, 0, 1657, 1649, 1, 0, 0, 0, 1658, 1661, 1, 0, 0, 0, 1659, 1657, 1, 0, 0, 0, 1659, 1660, 1, 0, 0, 0, 1660, 1664, 1, 0, 0, 0, 1661, 1659, 1, 0, 0, 0, 1662, 1663, 5, 151, 0, 0, 1663, 1665, 3, 68, 34, 0, 1664, 1662, 1, 0, 0, 0, 1664, 1665, 1, 0, 0, 0, 1665, 1667, 1, 0, 0, 0, 1666, 1668, 3, 58, 29, 0, 1667, 1666, 1, 0, 0, 0, 1667, 1668, 1, 0, 0, 0, 1668, 107, 1, 0, 0, 0, 1669, 1670, 5, 3, 0, 0, 1670, 1675, 3, 190, 95, 0, 1671, 1672, 5, 5, 0, 0, 1672, 1674, 3, 190, 95, 0, 1673, 1671, 1, 0, 0, 0, 1674, 1677, 1, 0, 0, 0, 1675, 1673, 1, 0, 0, 0, 1675, 1676, 1, 0, 0, 0, 1676, 1678, 1, 0, 0, 0, 1677, 1675, 1, 0, 0, 0, 1678, 1679, 5, 4, 0, 0, 1679, 109, 1, 0, 0, 0, 1680, 1682, 3, 50, 25, 0, 1681, 1680, 1, 0, 0, 0, 1681, 1682, 1, 0, 0, 0, 1682, 1683, 1, 0, 0, 0, 1683, 1686, 5, 144, 0, 0, 1684, 1685, 5, 110, 0, 0, 1685, 1687, 7, 8, 0, 0, 1686, 1684, 1, 0, 0, 0, 1686, 1687, 1, 0, 0, 0, 1687, 1688, 1, 0, 0, 0, 1688, 1689, 3, 112, 56, 0, 1689, 1692, 5, 133, 0, 0, 1690, 1693, 3, 190, 95, 0, 1691, 1693, 3, 108, 54, 0, 1692, 1690, 1, 0, 0, 0, 1692, 1691, 1, 0, 0, 0, 1693, 1694, 1, 0, 0, 0, 1694, 1695, 5, 6, 0, 0, 1695, 1706, 3, 68, 34, 0, 1696, 1699, 5, 5, 0, 0, 1697, 1700, 3, 190, 95, 0, 1698, 1700, 3, 108, 54, 0, 1699, 1697, 1, 0, 0, 0, 1699, 1698, 1, 0, 0, 0, 1700, 1701, 1, 0, 0, 0, 1701, 1702, 5, 6, 0, 0, 1702, 1703, 3, 68, 34, 0, 1703, 1705, 1, 0, 0, 0, 1704, 1696, 1, 0, 0, 0, 1705, 1708, 1, 0, 0, 0, 1706, 1704, 1, 0, 0, 0, 1706, 1707, 1, 0, 0, 0, 1707, 1711, 1, 0, 0, 0, 1708, 1706, 1, 0, 0, 0, 1709, 1710, 5, 151, 0, 0, 1710, 1712, 3, 68, 34, 0, 1711, 1709, 1, 0, 0, 0, 1711, 1712, 1, 0, 0, 0, 1712, 1717, 1, 0, 0, 0, 1713, 1715, 3, 134, 67, 0, 1714, 1713, 1, 0, 0, 0, 1714, 1715, 1, 0, 0, 0, 1715, 1716, 1, 0, 0, 0, 1716, 1718, 3, 136, 68, 0, 1717, 1714, 1, 0, 0, 0, 1717, 1718, 1, 0, 0, 0, 1718, 111, 1, 0, 0, 0, 1719, 1720, 3, 182, 91, 0, 1720, 1721, 5, 2, 0, 0, 1721, 1723, 1, 0, 0, 0, 1722, 1719, 1, 0, 0, 0, 1722, 1723, 1, 0, 0, 0, 1723, 1724, 1, 0, 0, 0, 1724, 1727, 3, 184, 92, 0, 1725, 1726, 5, 35, 0, 0, 1726, 1728, 3, 216, 108, 0, 1727, 1725, 1, 0, 0, 0, 1727, 1728, 1, 0, 0, 0, 1728, 1734, 1, 0, 0, 0, 1729, 1730, 5, 87, 0, 0, 1730, 1731, 5, 42, 0, 0, 1731, 1735, 3, 196, 98, 0, 1732, 1733, 5, 104, 0, 0, 1733, 1735, 5, 87, 0, 0, 1734, 1729, 1, 0, 0, 0, 1734, 1732, 1, 0, 0, 0, 1734, 1735, 1, 0, 0, 0, 1735, 113, 1, 0, 0, 0, 1736, 1738, 5, 146, 0, 0, 1737, 1739, 3, 182, 91, 0, 1738, 1737, 1, 0, 0, 0, 1738, 1739, 1, 0, 0, 0, 1739, 1742, 1, 0, 0, 0, 1740, 1741, 5, 93, 0, 0, 1741, 1743, 3, 218, 109, 0, 1742, 1740, 1, 0, 0, 0, 1742, 1743, 1, 0, 0, 0, 1743, 115, 1, 0, 0, 0, 1744, 1745, 5, 181, 0, 0, 1745, 1746, 5, 3, 0, 0, 1746, 1747, 5, 151, 0, 0, 1747, 1748, 3, 68, 34, 0, 1748, 1749, 5, 4, 0, 0, 1749, 117, 1, 0, 0, 0, 1750, 1752, 5, 3, 0, 0, 1751, 1753, 3, 220, 110, 0, 1752, 1751, 1, 0, 0, 0, 1752, 1753, 1, 0, 0, 0, 1753, 1764, 1, 0, 0, 0, 1754, 1755, 5, 156, 0, 0, 1755, 1756, 5, 42, 0, 0, 1756, 1761, 3, 68, 34, 0, 1757, 1758, 5, 5, 0, 0, 1758, 1760, 3, 68, 34, 0, 1759, 1757, 1, 0, 0, 0, 1760, 1763, 1, 0, 0, 0, 1761, 1759, 1, 0, 0, 0, 1761, 1762, 1, 0, 0, 0, 1762, 1765, 1, 0, 0, 0, 1763, 1761, 1, 0, 0, 0, 1764, 1754, 1, 0, 0, 0, 1764, 1765, 1, 0, 0, 0, 1765, 1766, 1, 0, 0, 0, 1766, 1767, 5, 111, 0, 0, 1767, 1768, 5, 42, 0, 0, 1768, 1773, 3, 138, 69, 0, 1769, 1770, 5, 5, 0, 0, 1770, 1772, 3, 138, 69, 0, 1771, 1769, 1, 0, 0, 0, 1772, 1775, 1, 0, 0, 0, 1773, 1771, 1, 0, 0, 0, 1773, 1774, 1, 0, 0, 0, 1774, 1777, 1, 0, 0, 0, 1775, 1773, 1, 0, 0, 0, 1776, 1778, 3, 122, 61, 0, 1777, 1776, 1, 0, 0, 0, 1777, 1778, 1, 0, 0, 0, 1778, 1779, 1, 0, 0, 0, 1779, 1780, 5, 4, 0, 0, 1780, 119, 1, 0, 0, 0, 1781, 1815, 5, 155, 0, 0, 1782, 1816, 3, 214, 107, 0, 1783, 1785, 5, 3, 0, 0, 1784, 1786, 3, 220, 110, 0, 1785, 1784, 1, 0, 0, 0, 1785, 1786, 1, 0, 0, 0, 1786, 1797, 1, 0, 0, 0, 1787, 1788, 5, 156, 0, 0, 1788, 1789, 5, 42, 0, 0, 1789, 1794, 3, 68, 34, 0, 1790, 1791, 5, 5, 0, 0, 1791, 1793, 3, 68, 34, 0, 1792, 1790, 1, 0, 0, 0, 1793, 1796, 1, 0, 0, 0, 1794, 1792, 1, 0, 0, 0, 1794, 1795, 1, 0, 0, 0, 1795, 1798, 1, 0, 0, 0, 1796, 1794, 1, 0, 0, 0, 1797, 1787, 1, 0, 0, 0, 1797, 1798, 1, 0, 0, 0, 1798, 1809, 1, 0, 0, 0, 1799, 1800, 5, 111, 0, 0, 1800, 1801, 5, 42, 0, 0, 1801, 1806, 3, 138, 69, 0, 1802, 1803, 5, 5, 0, 0, 1803, 1805, 3, 138, 69, 0, 1804, 1802, 1, 0, 0, 0, 1805, 1808, 1, 0, 0, 0, 1806, 1804, 1, 0, 0, 0, 1806, 1807, 1, 0, 0, 0, 1807, 1810, 1, 0, 0, 0, 1808, 1806, 1, 0, 0, 0, 1809, 1799, 1, 0, 0, 0, 1809, 1810, 1, 0, 0, 0, 1810, 1812, 1, 0, 0, 0, 1811, 1813, 3, 122, 61, 0, 1812, 1811, 1, 0, 0, 0, 1812, 1813, 1, 0, 0, 0, 1813, 1814, 1, 0, 0, 0, 1814, 1816, 5, 4, 0, 0, 1815, 1782, 1, 0, 0, 0, 1815, 1783, 1, 0, 0, 0, 1816, 121, 1, 0, 0, 0, 1817, 1825, 3, 124, 62, 0, 1818, 1819, 5, 183, 0, 0, 1819, 1820, 5, 103, 0, 0, 1820, 1826, 5, 185, 0, 0, 1821, 1822, 5, 160, 0, 0, 1822, 1826, 5, 129, 0, 0, 1823, 1826, 5, 80, 0, 0, 1824, 1826, 5, 184, 0, 0, 1825, 1818, 1, 0, 0, 0, 1825, 1821, 1, 0, 0, 0, 1825, 1823, 1, 0, 0, 0, 1825, 1824, 1, 0, 0, 0, 1825, 1826, 1, 0, 0, 0, 1826, 123, 1, 0, 0, 0, 1827, 1834, 7, 19, 0, 0, 1828, 1835, 3, 146, 73, 0, 1829, 1830, 5, 41, 0, 0, 1830, 1831, 3, 142, 71, 0, 1831, 1832, 5, 34, 0, 0, 1832, 1833, 3, 144, 72, 0, 1833, 1835, 1, 0, 0, 0, 1834, 1828, 1, 0, 0, 0, 1834, 1829, 1, 0, 0, 0, 1835, 125, 1, 0, 0, 0, 1836, 1837, 3, 222, 111, 0, 1837, 1847, 5, 3, 0, 0, 1838, 1843, 3, 68, 34, 0, 1839, 1840, 5, 5, 0, 0, 1840, 1842, 3, 68, 34, 0, 1841, 1839, 1, 0, 0, 0, 1842, 1845, 1, 0, 0, 0, 1843, 1841, 1, 0, 0, 0, 1843, 1844, 1, 0, 0, 0, 1844, 1848, 1, 0, 0, 0, 1845, 1843, 1, 0, 0, 0, 1846, 1848, 5, 7, 0, 0, 1847, 1838, 1, 0, 0, 0, 1847, 1846, 1, 0, 0, 0, 1848, 1849, 1, 0, 0, 0, 1849, 1850, 5, 4, 0, 0, 1850, 127, 1, 0, 0, 0, 1851, 1852, 3, 224, 112, 0, 1852, 1865, 5, 3, 0, 0, 1853, 1855, 5, 64, 0, 0, 1854, 1853, 1, 0, 0, 0, 1854, 1855, 1, 0, 0, 0, 1855, 1856, 1, 0, 0, 0, 1856, 1861, 3, 68, 34, 0, 1857, 1858, 5, 5, 0, 0, 1858, 1860, 3, 68, 34, 0, 1859, 1857, 1, 0, 0, 0, 1860, 1863, 1, 0, 0, 0, 1861, 1859, 1, 0, 0, 0, 1861, 1862, 1, 0, 0, 0, 1862, 1866, 1, 0, 0, 0, 1863, 1861, 1, 0, 0, 0, 1864, 1866, 5, 7, 0, 0, 1865, 1854, 1, 0, 0, 0, 1865, 1864, 1, 0, 0, 0, 1865, 1866, 1, 0, 0, 0, 1866, 1867, 1, 0, 0, 0, 1867, 1869, 5, 4, 0, 0, 1868, 1870, 3, 116, 58, 0, 1869, 1868, 1, 0, 0, 0, 1869, 1870, 1, 0, 0, 0, 1870, 129, 1, 0, 0, 0, 1871, 1872, 3, 148, 74, 0, 1872, 1882, 5, 3, 0, 0, 1873, 1878, 3, 68, 34, 0, 1874, 1875, 5, 5, 0, 0, 1875, 1877, 3, 68, 34, 0, 1876, 1874, 1, 0, 0, 0, 1877, 1880, 1, 0, 0, 0, 1878, 1876, 1, 0, 0, 0, 1878, 1879, 1, 0, 0, 0, 1879, 1883, 1, 0, 0, 0, 1880, 1878, 1, 0, 0, 0, 1881, 1883, 5, 7, 0, 0, 1882, 1873, 1, 0, 0, 0, 1882, 1881, 1, 0, 0, 0, 1882, 1883, 1, 0, 0, 0, 1883, 1884, 1, 0, 0, 0, 1884, 1886, 5, 4, 0, 0, 1885, 1887, 3, 116, 58, 0, 1886, 1885, 1, 0, 0, 0, 1886, 1887, 1, 0, 0, 0, 1887, 1888, 1, 0, 0, 0, 1888, 1891, 5, 155, 0, 0, 1889, 1892, 3, 118, 59, 0, 1890, 1892, 3, 214, 107, 0, 1891, 1889, 1, 0, 0, 0, 1891, 1890, 1, 0, 0, 0, 1892, 131, 1, 0, 0, 0, 1893, 1895, 5, 152, 0, 0, 1894, 1896, 5, 118, 0, 0, 1895, 1894, 1, 0, 0, 0, 1895, 1896, 1, 0, 0, 0, 1896, 1897, 1, 0, 0, 0, 1897, 1902, 3, 56, 28, 0, 1898, 1899, 5, 5, 0, 0, 1899, 1901, 3, 56, 28, 0, 1900, 1898, 1, 0, 0, 0, 1901, 1904, 1, 0, 0, 0, 1902, 1900, 1, 0, 0, 0, 1902, 1903, 1, 0, 0, 0, 1903, 133, 1, 0, 0, 0, 1904, 1902, 1, 0, 0, 0, 1905, 1906, 5, 111, 0, 0, 1906, 1907, 5, 42, 0, 0, 1907, 1912, 3, 138, 69, 0, 1908, 1909, 5, 5, 0, 0, 1909, 1911, 3, 138, 69, 0, 1910, 1908, 1, 0, 0, 0, 1911, 1914, 1, 0, 0, 0, 1912, 1910, 1, 0, 0, 0, 1912, 1913, 1, 0, 0, 0, 1913, 135, 1, 0, 0, 0, 1914, 1912, 1, 0, 0, 0, 1915, 1916, 5, 100, 0, 0, 1916, 1919, 3, 68, 34, 0, 1917, 1918, 7, 20, 0, 0, 1918, 1920, 3, 68, 34, 0, 1919, 1917, 1, 0, 0, 0, 1919, 1920, 1, 0, 0, 0, 1920, 137, 1, 0, 0, 0, 1921, 1924, 3, 68, 34, 0, 1922, 1923, 5, 47, 0, 0, 1923, 1925, 3, 192, 96, 0, 1924, 1922, 1, 0, 0, 0, 1924, 1925, 1, 0, 0, 0, 1925, 1927, 1, 0, 0, 0, 1926, 1928, 3, 140, 70, 0, 1927, 1926, 1, 0, 0, 0, 1927, 1928, 1, 0, 0, 0, 1928, 1931, 1, 0, 0, 0, 1929, 1930, 5, 178, 0, 0, 1930, 1932, 7, 21, 0, 0, 1931, 1929, 1, 0, 0, 0, 1931, 1932, 1, 0, 0, 0, 1932, 139, 1, 0, 0, 0, 1933, 1934, 7, 22, 0, 0, 1934, 141, 1, 0, 0, 0, 1935, 1936, 3, 68, 34, 0, 1936, 1937, 5, 158, 0, 0, 1937, 1946, 1, 0, 0, 0, 1938, 1939, 3, 68, 34, 0, 1939, 1940, 5, 161, 0, 0, 1940, 1946, 1, 0, 0, 0, 1941, 1942, 5, 160, 0, 0, 1942, 1946, 5, 129, 0, 0, 1943, 1944, 5, 159, 0, 0, 1944, 1946, 5, 158, 0, 0, 1945, 1935, 1, 0, 0, 0, 1945, 1938, 1, 0, 0, 0, 1945, 1941, 1, 0, 0, 0, 1945, 1943, 1, 0, 0, 0, 1946, 143, 1, 0, 0, 0, 1947, 1948, 3, 68, 34, 0, 1948, 1949, 5, 158, 0, 0, 1949, 1958, 1, 0, 0, 0, 1950, 1951, 3, 68, 34, 0, 1951, 1952, 5, 161, 0, 0, 1952, 1958, 1, 0, 0, 0, 1953, 1954, 5, 160, 0, 0, 1954, 1958, 5, 129, 0, 0, 1955, 1956, 5, 159, 0, 0, 1956, 1958, 5, 161, 0, 0, 1957, 1947, 1, 0, 0, 0, 1957, 1950, 1, 0, 0, 0, 1957, 1953, 1, 0, 0, 0, 1957, 1955, 1, 0, 0, 0, 1958, 145, 1, 0, 0, 0, 1959, 1960, 3, 68, 34, 0, 1960, 1961, 5, 158, 0, 0, 1961, 1967, 1, 0, 0, 0, 1962, 1963, 5, 159, 0, 0, 1963, 1967, 5, 158, 0, 0, 1964, 1965, 5, 160, 0, 0, 1965, 1967, 5, 129, 0, 0, 1966, 1959, 1, 0, 0, 0, 1966, 1962, 1, 0, 0, 0, 1966, 1964, 1, 0, 0, 0, 1967, 147, 1, 0, 0, 0, 1968, 1969, 7, 23, 0, 0, 1969, 1970, 5, 3, 0, 0, 1970, 1971, 3, 68, 34, 0, 1971, 1972, 5, 4, 0, 0, 1972, 1973, 5, 155, 0, 0, 1973, 1975, 5, 3, 0, 0, 1974, 1976, 3, 154, 77, 0, 1975, 1974, 1, 0, 0, 0, 1975, 1976, 1, 0, 0, 0, 1976, 1977, 1, 0, 0, 0, 1977, 1979, 3, 158, 79, 0, 1978, 1980, 3, 124, 62, 0, 1979, 1978, 1, 0, 0, 0, 1979, 1980, 1, 0, 0, 0, 1980, 1981, 1, 0, 0, 0, 1981, 1982, 5, 4, 0, 0, 1982, 2054, 1, 0, 0, 0, 1983, 1984, 7, 24, 0, 0, 1984, 1985, 5, 3, 0, 0, 1985, 1986, 5, 4, 0, 0, 1986, 1987, 5, 155, 0, 0, 1987, 1989, 5, 3, 0, 0, 1988, 1990, 3, 154, 77, 0, 1989, 1988, 1, 0, 0, 0, 1989, 1990, 1, 0, 0, 0, 1990, 1992, 1, 0, 0, 0, 1991, 1993, 3, 156, 78, 0, 1992, 1991, 1, 0, 0, 0, 1992, 1993, 1, 0, 0, 0, 1993, 1994, 1, 0, 0, 0, 1994, 2054, 5, 4, 0, 0, 1995, 1996, 7, 25, 0, 0, 1996, 1997, 5, 3, 0, 0, 1997, 1998, 5, 4, 0, 0, 1998, 1999, 5, 155, 0, 0, 1999, 2001, 5, 3, 0, 0, 2000, 2002, 3, 154, 77, 0, 2001, 2000, 1, 0, 0, 0, 2001, 2002, 1, 0, 0, 0, 2002, 2003, 1, 0, 0, 0, 2003, 2004, 3, 158, 79, 0, 2004, 2005, 5, 4, 0, 0, 2005, 2054, 1, 0, 0, 0, 2006, 2007, 7, 26, 0, 0, 2007, 2008, 5, 3, 0, 0, 2008, 2010, 3, 68, 34, 0, 2009, 2011, 3, 150, 75, 0, 2010, 2009, 1, 0, 0, 0, 2010, 2011, 1, 0, 0, 0, 2011, 2013, 1, 0, 0, 0, 2012, 2014, 3, 152, 76, 0, 2013, 2012, 1, 0, 0, 0, 2013, 2014, 1, 0, 0, 0, 2014, 2015, 1, 0, 0, 0, 2015, 2016, 5, 4, 0, 0, 2016, 2017, 5, 155, 0, 0, 2017, 2019, 5, 3, 0, 0, 2018, 2020, 3, 154, 77, 0, 2019, 2018, 1, 0, 0, 0, 2019, 2020, 1, 0, 0, 0, 2020, 2021, 1, 0, 0, 0, 2021, 2022, 3, 158, 79, 0, 2022, 2023, 5, 4, 0, 0, 2023, 2054, 1, 0, 0, 0, 2024, 2025, 5, 167, 0, 0, 2025, 2026, 5, 3, 0, 0, 2026, 2027, 3, 68, 34, 0, 2027, 2028, 5, 5, 0, 0, 2028, 2029, 3, 36, 18, 0, 2029, 2030, 5, 4, 0, 0, 2030, 2031, 5, 155, 0, 0, 2031, 2033, 5, 3, 0, 0, 2032, 2034, 3, 154, 77, 0, 2033, 2032, 1, 0, 0, 0, 2033, 2034, 1, 0, 0, 0, 2034, 2035, 1, 0, 0, 0, 2035, 2037, 3, 158, 79, 0, 2036, 2038, 3, 124, 62, 0, 2037, 2036, 1, 0, 0, 0, 2037, 2038, 1, 0, 0, 0, 2038, 2039, 1, 0, 0, 0, 2039, 2040, 5, 4, 0, 0, 2040, 2054, 1, 0, 0, 0, 2041, 2042, 5, 168, 0, 0, 2042, 2043, 5, 3, 0, 0, 2043, 2044, 3, 68, 34, 0, 2044, 2045, 5, 4, 0, 0, 2045, 2046, 5, 155, 0, 0, 2046, 2048, 5, 3, 0, 0, 2047, 2049, 3, 154, 77, 0, 2048, 2047, 1, 0, 0, 0, 2048, 2049, 1, 0, 0, 0, 2049, 2050, 1, 0, 0, 0, 2050, 2051, 3, 158, 79, 0, 2051, 2052, 5, 4, 0, 0, 2052, 2054, 1, 0, 0, 0, 2053, 1968, 1, 0, 0, 0, 2053, 1983, 1, 0, 0, 0, 2053, 1995, 1, 0, 0, 0, 2053, 2006, 1, 0, 0, 0, 2053, 2024, 1, 0, 0, 0, 2053, 2041, 1, 0, 0, 0, 2054, 149, 1, 0, 0, 0, 2055, 2056, 5, 5, 0, 0, 2056, 2057, 3, 36, 18, 0, 2057, 151, 1, 0, 0, 0, 2058, 2059, 5, 5, 0, 0, 2059, 2060, 3, 36, 18, 0, 2060, 153, 1, 0, 0, 0, 2061, 2062, 5, 156, 0, 0, 2062, 2064, 5, 42, 0, 0, 2063, 2065, 3, 68, 34, 0, 2064, 2063, 1, 0, 0, 0, 2065, 2066, 1, 0, 0, 0, 2066, 2064, 1, 0, 0, 0, 2066, 2067, 1, 0, 0, 0, 2067, 155, 1, 0, 0, 0, 2068, 2069, 5, 111, 0, 0, 2069, 2071, 5, 42, 0, 0, 2070, 2072, 3, 68, 34, 0, 2071, 2070, 1, 0, 0, 0, 2072, 2073, 1, 0, 0, 0, 2073, 2071, 1, 0, 0, 0, 2073, 2074, 1, 0, 0, 0, 2074, 157, 1, 0, 0, 0, 2075, 2076, 5, 111, 0, 0, 2076, 2077, 5, 42, 0, 0, 2077, 2078, 3, 158, 79, 0, 2078, 159, 1, 0, 0, 0, 2079, 2081, 3, 68, 34, 0, 2080, 2082, 3, 140, 70, 0, 2081, 2080, 1, 0, 0, 0, 2081, 2082, 1, 0, 0, 0, 2082, 2090, 1, 0, 0, 0, 2083, 2084, 5, 5, 0, 0, 2084, 2086, 3, 68, 34, 0, 2085, 2087, 3, 140, 70, 0, 2086, 2085, 1, 0, 0, 0, 2086, 2087, 1, 0, 0, 0, 2087, 2089, 1, 0, 0, 0, 2088, 2083, 1, 0, 0, 0, 2089, 2092, 1, 0, 0, 0, 2090, 2088, 1, 0, 0, 0, 2090, 2091, 1, 0, 0, 0, 2091, 161, 1, 0, 0, 0, 2092, 2090, 1, 0, 0, 0, 2093, 2094, 3, 84, 42, 0, 2094, 163, 1, 0, 0, 0, 2095, 2096, 3, 84, 42, 0, 2096, 165, 1, 0, 0, 0, 2097, 2098, 7, 27, 0, 0, 2098, 167, 1, 0, 0, 0, 2099, 2100, 5, 192, 0, 0, 2100, 169, 1, 0, 0, 0, 2101, 2104, 3, 68, 34, 0, 2102, 2104, 3, 30, 15, 0, 2103, 2101, 1, 0, 0, 0, 2103, 2102, 1, 0, 0, 0, 2104, 171, 1, 0, 0, 0, 2105, 2106, 7, 28, 0, 0, 2106, 173, 1, 0, 0, 0, 2107, 2108, 7, 29, 0, 0, 2108, 175, 1, 0, 0, 0, 2109, 2110, 3, 228, 114, 0, 2110, 177, 1, 0, 0, 0, 2111, 2112, 3, 228, 114, 0, 2112, 179, 1, 0, 0, 0, 2113, 2114, 3, 182, 91, 0, 2114, 2115, 5, 2, 0, 0, 2115, 2117, 1, 0, 0, 0, 2116, 2113, 1, 0, 0, 0, 2116, 2117, 1, 0, 0, 0, 2117, 2118, 1, 0, 0, 0, 2118, 2119, 3, 178, 89, 0, 2119, 181, 1, 0, 0, 0, 2120, 2121, 3, 228, 114, 0, 2121, 183, 1, 0, 0, 0, 2122, 2123, 3, 228, 114, 0, 2123, 185, 1, 0, 0, 0, 2124, 2125, 3, 228, 114, 0, 2125, 187, 1, 0, 0, 0, 2126, 2127, 3, 228, 114, 0, 2127, 189, 1, 0, 0, 0, 2128, 2129, 3, 228, 114, 0, 2129, 191, 1, 0, 0, 0, 2130, 2131, 3, 228, 114, 0, 2131, 193, 1, 0, 0, 0, 2132, 2133, 3, 228, 114, 0, 2133, 195, 1, 0, 0, 0, 2134, 2135, 3, 228, 114, 0, 2135, 197, 1, 0, 0, 0, 2136, 2137, 3, 228, 114, 0, 2137, 199, 1, 0, 0, 0, 2138, 2139, 3, 228, 114, 0, 2139, 201, 1, 0, 0, 0, 2140, 2141, 3, 228, 114, 0, 2141, 203, 1, 0, 0, 0, 2142, 2143, 3, 228, 114, 0, 2143, 205, 1, 0, 0, 0, 2144, 2145, 3, 228, 114, 0, 2145, 207, 1, 0, 0, 0, 2146, 2147, 7, 28, 0, 0, 2147, 209, 1, 0, 0, 0, 2148, 2149, 3, 228, 114, 0, 2149, 211, 1, 0, 0, 0, 2150, 2151, 3, 228, 114, 0, 2151, 213, 1, 0, 0, 0, 2152, 2153, 3, 228, 114, 0, 2153, 215, 1, 0, 0, 0, 2154, 2155, 3, 228, 114, 0, 2155, 217, 1, 0, 0, 0, 2156, 2157, 3, 228, 114, 0, 2157, 219, 1, 0, 0, 0, 2158, 2159, 3, 228, 114, 0, 2159, 221, 1, 0, 0, 0, 2160, 2161, 3, 228, 114, 0, 2161, 223, 1, 0, 0, 0, 2162, 2163, 3, 228, 114, 0, 2163, 225, 1, 0, 0, 0, 2164, 2165, 3, 228, 114, 0, 2165, 227, 1, 0, 0, 0, 2166, 2174, 5, 188, 0, 0, 2167, 2174, 3, 174, 87, 0, 2168, 2174, 5, 192, 0, 0, 2169, 2170, 5, 3, 0, 0, 2170, 2171, 3, 228, 114, 0, 2171, 2172, 5, 4, 0, 0, 2172, 2174, 1, 0, 0, 0, 2173, 2166, 1, 0, 0, 0, 2173, 2167, 1, 0, 0, 0, 2173, 2168, 1, 0, 0, 0, 2173, 2169, 1, 0, 0, 0, 2174, 229, 1, 0, 0, 0, 313, 233, 241, 248, 253, 259, 265, 267, 293, 300, 307, 313, 317, 322, 325, 332, 335, 339, 347, 351, 353, 357, 361, 365, 368, 375, 381, 387, 392, 403, 409, 413, 417, 420, 425, 429, 435, 440, 449, 456, 465, 468, 472, 476, 481, 487, 499, 503, 508, 511, 514, 519, 522, 536, 543, 550, 552, 555, 561, 566, 574, 579, 594, 600, 610, 615, 625, 629, 631, 635, 640, 642, 650, 656, 661, 668, 679, 682, 684, 691, 695, 702, 708, 714, 720, 725, 734, 739, 750, 755, 766, 771, 775, 791, 801, 806, 814, 826, 831, 842, 845, 847, 853, 856, 858, 862, 866, 873, 876, 879, 886, 889, 892, 895, 899, 907, 912, 923, 928, 937, 944, 948, 952, 955, 963, 976, 979, 987, 996, 1000, 1005, 1034, 1041, 1052, 1061, 1071, 1074, 1080, 1086, 1095, 1098, 1102, 1109, 1115, 1122, 1124, 1126, 1135, 1142, 1149, 1155, 1160, 1168, 1173, 1182, 1193, 1200, 1206, 1209, 1212, 1222, 1228, 1230, 1238, 1245, 1252, 1257, 1259, 1265, 1274, 1279, 1286, 1290, 1292, 1295, 1303, 1307, 1310, 1319, 1324, 1331, 1340, 1344, 1346, 1350, 1359, 1364, 1366, 1379, 1382, 1391, 1402, 1409, 1412, 1417, 1421, 1424, 1427, 1432, 1436, 1441, 1444, 1447, 1452, 1456, 1459, 1466, 1471, 1480, 1485, 1488, 1496, 1500, 1508, 1511, 1516, 1520, 1523, 1530, 1535, 1544, 1549, 1552, 1560, 1564, 1572, 1575, 1577, 1586, 1589, 1591, 1595, 1599, 1602, 1607, 1618, 1623, 1627, 1631, 1634, 1639, 1645, 1652, 1659, 1664, 1667, 1675, 1681, 1686, 1692, 1699, 1706, 1711, 1714, 1717, 1722, 1727, 1734, 1738, 1742, 1752, 1761, 1764, 1773, 1777, 1785, 1794, 1797, 1806, 1809, 1812, 1815, 1825, 1834, 1843, 1847, 1854, 1861, 1865, 1869, 1878, 1882, 1886, 1891, 1895, 1902, 1912, 1919, 1924, 1927, 1931, 1945, 1957, 1966, 1975, 1979, 1989, 1992, 2001, 2010, 2013, 2019, 2033, 2037, 2048, 2053, 2066, 2073, 2081, 2086, 2090, 2103, 2116, 2173] \ No newline at end of file diff --git a/internal/engine/sqlite/parser/SQLiteParser.tokens b/internal/engine/sqlite/parser/SQLiteParser.tokens index 928604c851..6777c57bdc 100644 --- a/internal/engine/sqlite/parser/SQLiteParser.tokens +++ b/internal/engine/sqlite/parser/SQLiteParser.tokens @@ -6,193 +6,195 @@ COMMA=5 ASSIGN=6 STAR=7 PLUS=8 -MINUS=9 -TILDE=10 -PIPE2=11 -DIV=12 -MOD=13 -LT2=14 -GT2=15 -AMP=16 -PIPE=17 -LT=18 -LT_EQ=19 -GT=20 -GT_EQ=21 -EQ=22 -NOT_EQ1=23 -NOT_EQ2=24 -ABORT_=25 -ACTION_=26 -ADD_=27 -AFTER_=28 -ALL_=29 -ALTER_=30 -ANALYZE_=31 -AND_=32 -AS_=33 -ASC_=34 -ATTACH_=35 -AUTOINCREMENT_=36 -BEFORE_=37 -BEGIN_=38 -BETWEEN_=39 -BY_=40 -CASCADE_=41 -CASE_=42 -CAST_=43 -CHECK_=44 -COLLATE_=45 -COLUMN_=46 -COMMIT_=47 -CONFLICT_=48 -CONSTRAINT_=49 -CREATE_=50 -CROSS_=51 -CURRENT_DATE_=52 -CURRENT_TIME_=53 -CURRENT_TIMESTAMP_=54 -DATABASE_=55 -DEFAULT_=56 -DEFERRABLE_=57 -DEFERRED_=58 -DELETE_=59 -DESC_=60 -DETACH_=61 -DISTINCT_=62 -DROP_=63 -EACH_=64 -ELSE_=65 -END_=66 -ESCAPE_=67 -EXCEPT_=68 -EXCLUSIVE_=69 -EXISTS_=70 -EXPLAIN_=71 -FAIL_=72 -FOR_=73 -FOREIGN_=74 -FROM_=75 -FULL_=76 -GLOB_=77 -GROUP_=78 -HAVING_=79 -IF_=80 -IGNORE_=81 -IMMEDIATE_=82 -IN_=83 -INDEX_=84 -INDEXED_=85 -INITIALLY_=86 -INNER_=87 -INSERT_=88 -INSTEAD_=89 -INTERSECT_=90 -INTO_=91 -IS_=92 -ISNULL_=93 -JOIN_=94 -KEY_=95 -LEFT_=96 -LIKE_=97 -LIMIT_=98 -MATCH_=99 -NATURAL_=100 -NO_=101 -NOT_=102 -NOTNULL_=103 -NULL_=104 -OF_=105 -OFFSET_=106 -ON_=107 -OR_=108 -ORDER_=109 -OUTER_=110 -PLAN_=111 -PRAGMA_=112 -PRIMARY_=113 -QUERY_=114 -RAISE_=115 -RECURSIVE_=116 -REFERENCES_=117 -REGEXP_=118 -REINDEX_=119 -RELEASE_=120 -RENAME_=121 -REPLACE_=122 -RESTRICT_=123 -RETURNING_=124 -RIGHT_=125 -ROLLBACK_=126 -ROW_=127 -ROWS_=128 -SAVEPOINT_=129 -SELECT_=130 -SET_=131 -STRICT_=132 -TABLE_=133 -TEMP_=134 -TEMPORARY_=135 -THEN_=136 -TO_=137 -TRANSACTION_=138 -TRIGGER_=139 -UNION_=140 -UNIQUE_=141 -UPDATE_=142 -USING_=143 -VACUUM_=144 -VALUES_=145 -VIEW_=146 -VIRTUAL_=147 -WHEN_=148 -WHERE_=149 -WITH_=150 -WITHOUT_=151 -FIRST_VALUE_=152 -OVER_=153 -PARTITION_=154 -RANGE_=155 -PRECEDING_=156 -UNBOUNDED_=157 -CURRENT_=158 -FOLLOWING_=159 -CUME_DIST_=160 -DENSE_RANK_=161 -LAG_=162 -LAST_VALUE_=163 -LEAD_=164 -NTH_VALUE_=165 -NTILE_=166 -PERCENT_RANK_=167 -RANK_=168 -ROW_NUMBER_=169 -GENERATED_=170 -ALWAYS_=171 -STORED_=172 -TRUE_=173 -FALSE_=174 -WINDOW_=175 -NULLS_=176 -FIRST_=177 -LAST_=178 -FILTER_=179 -GROUPS_=180 -EXCLUDE_=181 -TIES_=182 -OTHERS_=183 -DO_=184 -NOTHING_=185 -IDENTIFIER=186 -NUMERIC_LITERAL=187 -NUMBERED_BIND_PARAMETER=188 -NAMED_BIND_PARAMETER=189 -STRING_LITERAL=190 -BLOB_LITERAL=191 -SINGLE_LINE_COMMENT=192 -MULTILINE_COMMENT=193 -SPACES=194 -UNEXPECTED_CHAR=195 +PTR2=9 +PTR=10 +MINUS=11 +TILDE=12 +PIPE2=13 +DIV=14 +MOD=15 +LT2=16 +GT2=17 +AMP=18 +PIPE=19 +LT=20 +LT_EQ=21 +GT=22 +GT_EQ=23 +EQ=24 +NOT_EQ1=25 +NOT_EQ2=26 +ABORT_=27 +ACTION_=28 +ADD_=29 +AFTER_=30 +ALL_=31 +ALTER_=32 +ANALYZE_=33 +AND_=34 +AS_=35 +ASC_=36 +ATTACH_=37 +AUTOINCREMENT_=38 +BEFORE_=39 +BEGIN_=40 +BETWEEN_=41 +BY_=42 +CASCADE_=43 +CASE_=44 +CAST_=45 +CHECK_=46 +COLLATE_=47 +COLUMN_=48 +COMMIT_=49 +CONFLICT_=50 +CONSTRAINT_=51 +CREATE_=52 +CROSS_=53 +CURRENT_DATE_=54 +CURRENT_TIME_=55 +CURRENT_TIMESTAMP_=56 +DATABASE_=57 +DEFAULT_=58 +DEFERRABLE_=59 +DEFERRED_=60 +DELETE_=61 +DESC_=62 +DETACH_=63 +DISTINCT_=64 +DROP_=65 +EACH_=66 +ELSE_=67 +END_=68 +ESCAPE_=69 +EXCEPT_=70 +EXCLUSIVE_=71 +EXISTS_=72 +EXPLAIN_=73 +FAIL_=74 +FOR_=75 +FOREIGN_=76 +FROM_=77 +FULL_=78 +GLOB_=79 +GROUP_=80 +HAVING_=81 +IF_=82 +IGNORE_=83 +IMMEDIATE_=84 +IN_=85 +INDEX_=86 +INDEXED_=87 +INITIALLY_=88 +INNER_=89 +INSERT_=90 +INSTEAD_=91 +INTERSECT_=92 +INTO_=93 +IS_=94 +ISNULL_=95 +JOIN_=96 +KEY_=97 +LEFT_=98 +LIKE_=99 +LIMIT_=100 +MATCH_=101 +NATURAL_=102 +NO_=103 +NOT_=104 +NOTNULL_=105 +NULL_=106 +OF_=107 +OFFSET_=108 +ON_=109 +OR_=110 +ORDER_=111 +OUTER_=112 +PLAN_=113 +PRAGMA_=114 +PRIMARY_=115 +QUERY_=116 +RAISE_=117 +RECURSIVE_=118 +REFERENCES_=119 +REGEXP_=120 +REINDEX_=121 +RELEASE_=122 +RENAME_=123 +REPLACE_=124 +RESTRICT_=125 +RETURNING_=126 +RIGHT_=127 +ROLLBACK_=128 +ROW_=129 +ROWS_=130 +SAVEPOINT_=131 +SELECT_=132 +SET_=133 +STRICT_=134 +TABLE_=135 +TEMP_=136 +TEMPORARY_=137 +THEN_=138 +TO_=139 +TRANSACTION_=140 +TRIGGER_=141 +UNION_=142 +UNIQUE_=143 +UPDATE_=144 +USING_=145 +VACUUM_=146 +VALUES_=147 +VIEW_=148 +VIRTUAL_=149 +WHEN_=150 +WHERE_=151 +WITH_=152 +WITHOUT_=153 +FIRST_VALUE_=154 +OVER_=155 +PARTITION_=156 +RANGE_=157 +PRECEDING_=158 +UNBOUNDED_=159 +CURRENT_=160 +FOLLOWING_=161 +CUME_DIST_=162 +DENSE_RANK_=163 +LAG_=164 +LAST_VALUE_=165 +LEAD_=166 +NTH_VALUE_=167 +NTILE_=168 +PERCENT_RANK_=169 +RANK_=170 +ROW_NUMBER_=171 +GENERATED_=172 +ALWAYS_=173 +STORED_=174 +TRUE_=175 +FALSE_=176 +WINDOW_=177 +NULLS_=178 +FIRST_=179 +LAST_=180 +FILTER_=181 +GROUPS_=182 +EXCLUDE_=183 +TIES_=184 +OTHERS_=185 +DO_=186 +NOTHING_=187 +IDENTIFIER=188 +NUMERIC_LITERAL=189 +NUMBERED_BIND_PARAMETER=190 +NAMED_BIND_PARAMETER=191 +STRING_LITERAL=192 +BLOB_LITERAL=193 +SINGLE_LINE_COMMENT=194 +MULTILINE_COMMENT=195 +SPACES=196 +UNEXPECTED_CHAR=197 ';'=1 '.'=2 '('=3 @@ -201,19 +203,21 @@ UNEXPECTED_CHAR=195 '='=6 '*'=7 '+'=8 -'-'=9 -'~'=10 -'||'=11 -'/'=12 -'%'=13 -'<<'=14 -'>>'=15 -'&'=16 -'|'=17 -'<'=18 -'<='=19 -'>'=20 -'>='=21 -'=='=22 -'!='=23 -'<>'=24 +'->>'=9 +'->'=10 +'-'=11 +'~'=12 +'||'=13 +'/'=14 +'%'=15 +'<<'=16 +'>>'=17 +'&'=18 +'|'=19 +'<'=20 +'<='=21 +'>'=22 +'>='=23 +'=='=24 +'!='=25 +'<>'=26 diff --git a/internal/engine/sqlite/parser/sqlite_lexer.go b/internal/engine/sqlite/parser/sqlite_lexer.go index c2b35200b4..d3cfd14f1e 100644 --- a/internal/engine/sqlite/parser/sqlite_lexer.go +++ b/internal/engine/sqlite/parser/sqlite_lexer.go @@ -1,13 +1,12 @@ -// Code generated from SQLiteLexer.g4 by ANTLR 4.12.0. DO NOT EDIT. +// Code generated from SQLiteLexer.g4 by ANTLR 4.13.1. DO NOT EDIT. package parser import ( "fmt" + "github.com/antlr4-go/antlr/v4" "sync" "unicode" - - "github.com/antlr/antlr4/runtime/Go/antlr/v4" ) // Suppress unused import error @@ -22,101 +21,101 @@ type SQLiteLexer struct { // TODO: EOF string } -var sqlitelexerLexerStaticData struct { +var SQLiteLexerLexerStaticData struct { once sync.Once serializedATN []int32 - channelNames []string - modeNames []string - literalNames []string - symbolicNames []string - ruleNames []string - predictionContextCache *antlr.PredictionContextCache + ChannelNames []string + ModeNames []string + LiteralNames []string + SymbolicNames []string + RuleNames []string + PredictionContextCache *antlr.PredictionContextCache atn *antlr.ATN decisionToDFA []*antlr.DFA } func sqlitelexerLexerInit() { - staticData := &sqlitelexerLexerStaticData - staticData.channelNames = []string{ + staticData := &SQLiteLexerLexerStaticData + staticData.ChannelNames = []string{ "DEFAULT_TOKEN_CHANNEL", "HIDDEN", } - staticData.modeNames = []string{ + staticData.ModeNames = []string{ "DEFAULT_MODE", } - staticData.literalNames = []string{ - "", "';'", "'.'", "'('", "')'", "','", "'='", "'*'", "'+'", "'-'", "'~'", - "'||'", "'/'", "'%'", "'<<'", "'>>'", "'&'", "'|'", "'<'", "'<='", "'>'", - "'>='", "'=='", "'!='", "'<>'", + staticData.LiteralNames = []string{ + "", "';'", "'.'", "'('", "')'", "','", "'='", "'*'", "'+'", "'->>'", + "'->'", "'-'", "'~'", "'||'", "'/'", "'%'", "'<<'", "'>>'", "'&'", "'|'", + "'<'", "'<='", "'>'", "'>='", "'=='", "'!='", "'<>'", } - staticData.symbolicNames = []string{ + staticData.SymbolicNames = []string{ "", "SCOL", "DOT", "OPEN_PAR", "CLOSE_PAR", "COMMA", "ASSIGN", "STAR", - "PLUS", "MINUS", "TILDE", "PIPE2", "DIV", "MOD", "LT2", "GT2", "AMP", - "PIPE", "LT", "LT_EQ", "GT", "GT_EQ", "EQ", "NOT_EQ1", "NOT_EQ2", "ABORT_", - "ACTION_", "ADD_", "AFTER_", "ALL_", "ALTER_", "ANALYZE_", "AND_", "AS_", - "ASC_", "ATTACH_", "AUTOINCREMENT_", "BEFORE_", "BEGIN_", "BETWEEN_", - "BY_", "CASCADE_", "CASE_", "CAST_", "CHECK_", "COLLATE_", "COLUMN_", - "COMMIT_", "CONFLICT_", "CONSTRAINT_", "CREATE_", "CROSS_", "CURRENT_DATE_", - "CURRENT_TIME_", "CURRENT_TIMESTAMP_", "DATABASE_", "DEFAULT_", "DEFERRABLE_", - "DEFERRED_", "DELETE_", "DESC_", "DETACH_", "DISTINCT_", "DROP_", "EACH_", - "ELSE_", "END_", "ESCAPE_", "EXCEPT_", "EXCLUSIVE_", "EXISTS_", "EXPLAIN_", - "FAIL_", "FOR_", "FOREIGN_", "FROM_", "FULL_", "GLOB_", "GROUP_", "HAVING_", - "IF_", "IGNORE_", "IMMEDIATE_", "IN_", "INDEX_", "INDEXED_", "INITIALLY_", - "INNER_", "INSERT_", "INSTEAD_", "INTERSECT_", "INTO_", "IS_", "ISNULL_", - "JOIN_", "KEY_", "LEFT_", "LIKE_", "LIMIT_", "MATCH_", "NATURAL_", "NO_", - "NOT_", "NOTNULL_", "NULL_", "OF_", "OFFSET_", "ON_", "OR_", "ORDER_", - "OUTER_", "PLAN_", "PRAGMA_", "PRIMARY_", "QUERY_", "RAISE_", "RECURSIVE_", - "REFERENCES_", "REGEXP_", "REINDEX_", "RELEASE_", "RENAME_", "REPLACE_", - "RESTRICT_", "RETURNING_", "RIGHT_", "ROLLBACK_", "ROW_", "ROWS_", "SAVEPOINT_", - "SELECT_", "SET_", "STRICT_", "TABLE_", "TEMP_", "TEMPORARY_", "THEN_", - "TO_", "TRANSACTION_", "TRIGGER_", "UNION_", "UNIQUE_", "UPDATE_", "USING_", - "VACUUM_", "VALUES_", "VIEW_", "VIRTUAL_", "WHEN_", "WHERE_", "WITH_", - "WITHOUT_", "FIRST_VALUE_", "OVER_", "PARTITION_", "RANGE_", "PRECEDING_", - "UNBOUNDED_", "CURRENT_", "FOLLOWING_", "CUME_DIST_", "DENSE_RANK_", - "LAG_", "LAST_VALUE_", "LEAD_", "NTH_VALUE_", "NTILE_", "PERCENT_RANK_", - "RANK_", "ROW_NUMBER_", "GENERATED_", "ALWAYS_", "STORED_", "TRUE_", - "FALSE_", "WINDOW_", "NULLS_", "FIRST_", "LAST_", "FILTER_", "GROUPS_", - "EXCLUDE_", "TIES_", "OTHERS_", "DO_", "NOTHING_", "IDENTIFIER", "NUMERIC_LITERAL", - "NUMBERED_BIND_PARAMETER", "NAMED_BIND_PARAMETER", "STRING_LITERAL", - "BLOB_LITERAL", "SINGLE_LINE_COMMENT", "MULTILINE_COMMENT", "SPACES", - "UNEXPECTED_CHAR", + "PLUS", "PTR2", "PTR", "MINUS", "TILDE", "PIPE2", "DIV", "MOD", "LT2", + "GT2", "AMP", "PIPE", "LT", "LT_EQ", "GT", "GT_EQ", "EQ", "NOT_EQ1", + "NOT_EQ2", "ABORT_", "ACTION_", "ADD_", "AFTER_", "ALL_", "ALTER_", + "ANALYZE_", "AND_", "AS_", "ASC_", "ATTACH_", "AUTOINCREMENT_", "BEFORE_", + "BEGIN_", "BETWEEN_", "BY_", "CASCADE_", "CASE_", "CAST_", "CHECK_", + "COLLATE_", "COLUMN_", "COMMIT_", "CONFLICT_", "CONSTRAINT_", "CREATE_", + "CROSS_", "CURRENT_DATE_", "CURRENT_TIME_", "CURRENT_TIMESTAMP_", "DATABASE_", + "DEFAULT_", "DEFERRABLE_", "DEFERRED_", "DELETE_", "DESC_", "DETACH_", + "DISTINCT_", "DROP_", "EACH_", "ELSE_", "END_", "ESCAPE_", "EXCEPT_", + "EXCLUSIVE_", "EXISTS_", "EXPLAIN_", "FAIL_", "FOR_", "FOREIGN_", "FROM_", + "FULL_", "GLOB_", "GROUP_", "HAVING_", "IF_", "IGNORE_", "IMMEDIATE_", + "IN_", "INDEX_", "INDEXED_", "INITIALLY_", "INNER_", "INSERT_", "INSTEAD_", + "INTERSECT_", "INTO_", "IS_", "ISNULL_", "JOIN_", "KEY_", "LEFT_", "LIKE_", + "LIMIT_", "MATCH_", "NATURAL_", "NO_", "NOT_", "NOTNULL_", "NULL_", + "OF_", "OFFSET_", "ON_", "OR_", "ORDER_", "OUTER_", "PLAN_", "PRAGMA_", + "PRIMARY_", "QUERY_", "RAISE_", "RECURSIVE_", "REFERENCES_", "REGEXP_", + "REINDEX_", "RELEASE_", "RENAME_", "REPLACE_", "RESTRICT_", "RETURNING_", + "RIGHT_", "ROLLBACK_", "ROW_", "ROWS_", "SAVEPOINT_", "SELECT_", "SET_", + "STRICT_", "TABLE_", "TEMP_", "TEMPORARY_", "THEN_", "TO_", "TRANSACTION_", + "TRIGGER_", "UNION_", "UNIQUE_", "UPDATE_", "USING_", "VACUUM_", "VALUES_", + "VIEW_", "VIRTUAL_", "WHEN_", "WHERE_", "WITH_", "WITHOUT_", "FIRST_VALUE_", + "OVER_", "PARTITION_", "RANGE_", "PRECEDING_", "UNBOUNDED_", "CURRENT_", + "FOLLOWING_", "CUME_DIST_", "DENSE_RANK_", "LAG_", "LAST_VALUE_", "LEAD_", + "NTH_VALUE_", "NTILE_", "PERCENT_RANK_", "RANK_", "ROW_NUMBER_", "GENERATED_", + "ALWAYS_", "STORED_", "TRUE_", "FALSE_", "WINDOW_", "NULLS_", "FIRST_", + "LAST_", "FILTER_", "GROUPS_", "EXCLUDE_", "TIES_", "OTHERS_", "DO_", + "NOTHING_", "IDENTIFIER", "NUMERIC_LITERAL", "NUMBERED_BIND_PARAMETER", + "NAMED_BIND_PARAMETER", "STRING_LITERAL", "BLOB_LITERAL", "SINGLE_LINE_COMMENT", + "MULTILINE_COMMENT", "SPACES", "UNEXPECTED_CHAR", } - staticData.ruleNames = []string{ + staticData.RuleNames = []string{ "SCOL", "DOT", "OPEN_PAR", "CLOSE_PAR", "COMMA", "ASSIGN", "STAR", "PLUS", - "MINUS", "TILDE", "PIPE2", "DIV", "MOD", "LT2", "GT2", "AMP", "PIPE", - "LT", "LT_EQ", "GT", "GT_EQ", "EQ", "NOT_EQ1", "NOT_EQ2", "ABORT_", - "ACTION_", "ADD_", "AFTER_", "ALL_", "ALTER_", "ANALYZE_", "AND_", "AS_", - "ASC_", "ATTACH_", "AUTOINCREMENT_", "BEFORE_", "BEGIN_", "BETWEEN_", - "BY_", "CASCADE_", "CASE_", "CAST_", "CHECK_", "COLLATE_", "COLUMN_", - "COMMIT_", "CONFLICT_", "CONSTRAINT_", "CREATE_", "CROSS_", "CURRENT_DATE_", - "CURRENT_TIME_", "CURRENT_TIMESTAMP_", "DATABASE_", "DEFAULT_", "DEFERRABLE_", - "DEFERRED_", "DELETE_", "DESC_", "DETACH_", "DISTINCT_", "DROP_", "EACH_", - "ELSE_", "END_", "ESCAPE_", "EXCEPT_", "EXCLUSIVE_", "EXISTS_", "EXPLAIN_", - "FAIL_", "FOR_", "FOREIGN_", "FROM_", "FULL_", "GLOB_", "GROUP_", "HAVING_", - "IF_", "IGNORE_", "IMMEDIATE_", "IN_", "INDEX_", "INDEXED_", "INITIALLY_", - "INNER_", "INSERT_", "INSTEAD_", "INTERSECT_", "INTO_", "IS_", "ISNULL_", - "JOIN_", "KEY_", "LEFT_", "LIKE_", "LIMIT_", "MATCH_", "NATURAL_", "NO_", - "NOT_", "NOTNULL_", "NULL_", "OF_", "OFFSET_", "ON_", "OR_", "ORDER_", - "OUTER_", "PLAN_", "PRAGMA_", "PRIMARY_", "QUERY_", "RAISE_", "RECURSIVE_", - "REFERENCES_", "REGEXP_", "REINDEX_", "RELEASE_", "RENAME_", "REPLACE_", - "RESTRICT_", "RETURNING_", "RIGHT_", "ROLLBACK_", "ROW_", "ROWS_", "SAVEPOINT_", - "SELECT_", "SET_", "STRICT_", "TABLE_", "TEMP_", "TEMPORARY_", "THEN_", - "TO_", "TRANSACTION_", "TRIGGER_", "UNION_", "UNIQUE_", "UPDATE_", "USING_", - "VACUUM_", "VALUES_", "VIEW_", "VIRTUAL_", "WHEN_", "WHERE_", "WITH_", - "WITHOUT_", "FIRST_VALUE_", "OVER_", "PARTITION_", "RANGE_", "PRECEDING_", - "UNBOUNDED_", "CURRENT_", "FOLLOWING_", "CUME_DIST_", "DENSE_RANK_", - "LAG_", "LAST_VALUE_", "LEAD_", "NTH_VALUE_", "NTILE_", "PERCENT_RANK_", - "RANK_", "ROW_NUMBER_", "GENERATED_", "ALWAYS_", "STORED_", "TRUE_", - "FALSE_", "WINDOW_", "NULLS_", "FIRST_", "LAST_", "FILTER_", "GROUPS_", - "EXCLUDE_", "TIES_", "OTHERS_", "DO_", "NOTHING_", "IDENTIFIER", "NUMERIC_LITERAL", - "NUMBERED_BIND_PARAMETER", "NAMED_BIND_PARAMETER", "STRING_LITERAL", - "BLOB_LITERAL", "SINGLE_LINE_COMMENT", "MULTILINE_COMMENT", "SPACES", - "UNEXPECTED_CHAR", "HEX_DIGIT", "DIGIT", "A", "B", "C", "D", "E", "F", - "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", - "U", "V", "W", "X", "Y", "Z", + "PTR2", "PTR", "MINUS", "TILDE", "PIPE2", "DIV", "MOD", "LT2", "GT2", + "AMP", "PIPE", "LT", "LT_EQ", "GT", "GT_EQ", "EQ", "NOT_EQ1", "NOT_EQ2", + "ABORT_", "ACTION_", "ADD_", "AFTER_", "ALL_", "ALTER_", "ANALYZE_", + "AND_", "AS_", "ASC_", "ATTACH_", "AUTOINCREMENT_", "BEFORE_", "BEGIN_", + "BETWEEN_", "BY_", "CASCADE_", "CASE_", "CAST_", "CHECK_", "COLLATE_", + "COLUMN_", "COMMIT_", "CONFLICT_", "CONSTRAINT_", "CREATE_", "CROSS_", + "CURRENT_DATE_", "CURRENT_TIME_", "CURRENT_TIMESTAMP_", "DATABASE_", + "DEFAULT_", "DEFERRABLE_", "DEFERRED_", "DELETE_", "DESC_", "DETACH_", + "DISTINCT_", "DROP_", "EACH_", "ELSE_", "END_", "ESCAPE_", "EXCEPT_", + "EXCLUSIVE_", "EXISTS_", "EXPLAIN_", "FAIL_", "FOR_", "FOREIGN_", "FROM_", + "FULL_", "GLOB_", "GROUP_", "HAVING_", "IF_", "IGNORE_", "IMMEDIATE_", + "IN_", "INDEX_", "INDEXED_", "INITIALLY_", "INNER_", "INSERT_", "INSTEAD_", + "INTERSECT_", "INTO_", "IS_", "ISNULL_", "JOIN_", "KEY_", "LEFT_", "LIKE_", + "LIMIT_", "MATCH_", "NATURAL_", "NO_", "NOT_", "NOTNULL_", "NULL_", + "OF_", "OFFSET_", "ON_", "OR_", "ORDER_", "OUTER_", "PLAN_", "PRAGMA_", + "PRIMARY_", "QUERY_", "RAISE_", "RECURSIVE_", "REFERENCES_", "REGEXP_", + "REINDEX_", "RELEASE_", "RENAME_", "REPLACE_", "RESTRICT_", "RETURNING_", + "RIGHT_", "ROLLBACK_", "ROW_", "ROWS_", "SAVEPOINT_", "SELECT_", "SET_", + "STRICT_", "TABLE_", "TEMP_", "TEMPORARY_", "THEN_", "TO_", "TRANSACTION_", + "TRIGGER_", "UNION_", "UNIQUE_", "UPDATE_", "USING_", "VACUUM_", "VALUES_", + "VIEW_", "VIRTUAL_", "WHEN_", "WHERE_", "WITH_", "WITHOUT_", "FIRST_VALUE_", + "OVER_", "PARTITION_", "RANGE_", "PRECEDING_", "UNBOUNDED_", "CURRENT_", + "FOLLOWING_", "CUME_DIST_", "DENSE_RANK_", "LAG_", "LAST_VALUE_", "LEAD_", + "NTH_VALUE_", "NTILE_", "PERCENT_RANK_", "RANK_", "ROW_NUMBER_", "GENERATED_", + "ALWAYS_", "STORED_", "TRUE_", "FALSE_", "WINDOW_", "NULLS_", "FIRST_", + "LAST_", "FILTER_", "GROUPS_", "EXCLUDE_", "TIES_", "OTHERS_", "DO_", + "NOTHING_", "IDENTIFIER", "NUMERIC_LITERAL", "NUMBERED_BIND_PARAMETER", + "NAMED_BIND_PARAMETER", "STRING_LITERAL", "BLOB_LITERAL", "SINGLE_LINE_COMMENT", + "MULTILINE_COMMENT", "SPACES", "UNEXPECTED_CHAR", "HEX_DIGIT", "DIGIT", + "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", + "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", } - staticData.predictionContextCache = antlr.NewPredictionContextCache() + staticData.PredictionContextCache = antlr.NewPredictionContextCache() staticData.serializedATN = []int32{ - 4, 0, 195, 1818, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, + 4, 0, 197, 1829, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, @@ -162,812 +161,817 @@ func sqlitelexerLexerInit() { 7, 207, 2, 208, 7, 208, 2, 209, 7, 209, 2, 210, 7, 210, 2, 211, 7, 211, 2, 212, 7, 212, 2, 213, 7, 213, 2, 214, 7, 214, 2, 215, 7, 215, 2, 216, 7, 216, 2, 217, 7, 217, 2, 218, 7, 218, 2, 219, 7, 219, 2, 220, 7, 220, - 2, 221, 7, 221, 2, 222, 7, 222, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, - 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, - 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, - 1, 13, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, - 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, - 1, 22, 1, 22, 1, 22, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 24, 1, - 24, 1, 24, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 26, 1, 26, - 1, 26, 1, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, - 28, 1, 28, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 30, 1, 30, 1, 30, - 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 31, 1, 31, 1, 31, 1, 31, 1, 32, 1, - 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, - 1, 34, 1, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, - 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, - 1, 36, 1, 36, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, - 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 39, 1, 39, 1, 39, 1, 40, 1, 40, - 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, - 41, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, - 1, 43, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 45, 1, - 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, - 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, - 47, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, - 1, 48, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 50, 1, 50, 1, - 50, 1, 50, 1, 50, 1, 50, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, - 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 52, 1, 52, 1, 52, 1, 52, 1, - 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 53, 1, 53, - 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, - 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, - 1, 54, 1, 54, 1, 54, 1, 54, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, - 55, 1, 55, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, - 1, 56, 1, 56, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, - 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 1, 59, - 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 61, 1, - 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 62, 1, 62, 1, 62, - 1, 62, 1, 62, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 64, 1, 64, 1, 64, 1, - 64, 1, 64, 1, 65, 1, 65, 1, 65, 1, 65, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, - 1, 66, 1, 66, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 68, 1, - 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 69, 1, 69, - 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, - 70, 1, 70, 1, 70, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 72, 1, 72, 1, 72, - 1, 72, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 74, 1, - 74, 1, 74, 1, 74, 1, 74, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 76, 1, 76, - 1, 76, 1, 76, 1, 76, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 78, 1, - 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 79, 1, 79, 1, 79, 1, 80, 1, 80, - 1, 80, 1, 80, 1, 80, 1, 80, 1, 80, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, - 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 82, 1, 82, 1, 82, 1, 83, 1, 83, 1, 83, - 1, 83, 1, 83, 1, 83, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, - 84, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, - 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 87, 1, 87, 1, 87, 1, 87, 1, - 87, 1, 87, 1, 87, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, - 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, - 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 91, 1, 91, 1, 91, 1, 92, 1, 92, 1, 92, - 1, 92, 1, 92, 1, 92, 1, 92, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 94, 1, - 94, 1, 94, 1, 94, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 96, 1, 96, 1, 96, - 1, 96, 1, 96, 1, 97, 1, 97, 1, 97, 1, 97, 1, 97, 1, 97, 1, 98, 1, 98, 1, - 98, 1, 98, 1, 98, 1, 98, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, - 1, 99, 1, 100, 1, 100, 1, 100, 1, 101, 1, 101, 1, 101, 1, 101, 1, 102, - 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 103, 1, 103, - 1, 103, 1, 103, 1, 103, 1, 104, 1, 104, 1, 104, 1, 105, 1, 105, 1, 105, - 1, 105, 1, 105, 1, 105, 1, 105, 1, 106, 1, 106, 1, 106, 1, 107, 1, 107, - 1, 107, 1, 108, 1, 108, 1, 108, 1, 108, 1, 108, 1, 108, 1, 109, 1, 109, - 1, 109, 1, 109, 1, 109, 1, 109, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, - 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 112, 1, 112, - 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 113, 1, 113, 1, 113, - 1, 113, 1, 113, 1, 113, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, - 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, - 1, 115, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, - 1, 116, 1, 116, 1, 116, 1, 117, 1, 117, 1, 117, 1, 117, 1, 117, 1, 117, - 1, 117, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, - 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 120, - 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 121, 1, 121, 1, 121, - 1, 121, 1, 121, 1, 121, 1, 121, 1, 121, 1, 122, 1, 122, 1, 122, 1, 122, - 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 123, 1, 123, 1, 123, 1, 123, - 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 124, 1, 124, 1, 124, - 1, 124, 1, 124, 1, 124, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, - 1, 125, 1, 125, 1, 125, 1, 126, 1, 126, 1, 126, 1, 126, 1, 127, 1, 127, - 1, 127, 1, 127, 1, 127, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, - 1, 128, 1, 128, 1, 128, 1, 128, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, - 1, 129, 1, 129, 1, 130, 1, 130, 1, 130, 1, 130, 1, 131, 1, 131, 1, 131, - 1, 131, 1, 131, 1, 131, 1, 131, 1, 132, 1, 132, 1, 132, 1, 132, 1, 132, - 1, 132, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 134, 1, 134, 1, 134, - 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, 135, 1, 135, - 1, 135, 1, 135, 1, 135, 1, 136, 1, 136, 1, 136, 1, 137, 1, 137, 1, 137, - 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, - 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 139, - 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 140, 1, 140, 1, 140, 1, 140, - 1, 140, 1, 140, 1, 140, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, - 1, 141, 1, 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 143, 1, 143, - 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 144, 1, 144, 1, 144, 1, 144, - 1, 144, 1, 144, 1, 144, 1, 145, 1, 145, 1, 145, 1, 145, 1, 145, 1, 146, - 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 147, 1, 147, - 1, 147, 1, 147, 1, 147, 1, 148, 1, 148, 1, 148, 1, 148, 1, 148, 1, 148, - 1, 149, 1, 149, 1, 149, 1, 149, 1, 149, 1, 150, 1, 150, 1, 150, 1, 150, - 1, 150, 1, 150, 1, 150, 1, 150, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, - 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 152, 1, 152, - 1, 152, 1, 152, 1, 152, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, - 1, 153, 1, 153, 1, 153, 1, 153, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, - 1, 154, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, - 1, 155, 1, 155, 1, 156, 1, 156, 1, 156, 1, 156, 1, 156, 1, 156, 1, 156, - 1, 156, 1, 156, 1, 156, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, - 1, 157, 1, 157, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, - 1, 158, 1, 158, 1, 158, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, - 1, 159, 1, 159, 1, 159, 1, 159, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, - 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 161, 1, 161, 1, 161, - 1, 161, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, - 1, 162, 1, 162, 1, 162, 1, 163, 1, 163, 1, 163, 1, 163, 1, 163, 1, 164, - 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, - 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 166, 1, 166, 1, 166, - 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, - 1, 166, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 1, 168, 1, 168, 1, 168, - 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 169, - 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, - 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 171, 1, 171, - 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 172, 1, 172, 1, 172, 1, 172, - 1, 172, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 1, 174, 1, 174, - 1, 174, 1, 174, 1, 174, 1, 174, 1, 174, 1, 175, 1, 175, 1, 175, 1, 175, - 1, 175, 1, 175, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 177, - 1, 177, 1, 177, 1, 177, 1, 177, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, - 1, 178, 1, 178, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, - 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 181, - 1, 181, 1, 181, 1, 181, 1, 181, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, - 1, 182, 1, 182, 1, 183, 1, 183, 1, 183, 1, 184, 1, 184, 1, 184, 1, 184, - 1, 184, 1, 184, 1, 184, 1, 184, 1, 185, 1, 185, 1, 185, 1, 185, 5, 185, - 1625, 8, 185, 10, 185, 12, 185, 1628, 9, 185, 1, 185, 1, 185, 1, 185, 1, - 185, 1, 185, 5, 185, 1635, 8, 185, 10, 185, 12, 185, 1638, 9, 185, 1, 185, - 1, 185, 1, 185, 5, 185, 1643, 8, 185, 10, 185, 12, 185, 1646, 9, 185, 1, - 185, 1, 185, 1, 185, 5, 185, 1651, 8, 185, 10, 185, 12, 185, 1654, 9, 185, - 3, 185, 1656, 8, 185, 1, 186, 4, 186, 1659, 8, 186, 11, 186, 12, 186, 1660, - 1, 186, 1, 186, 5, 186, 1665, 8, 186, 10, 186, 12, 186, 1668, 9, 186, 3, - 186, 1670, 8, 186, 1, 186, 1, 186, 4, 186, 1674, 8, 186, 11, 186, 12, 186, - 1675, 3, 186, 1678, 8, 186, 1, 186, 1, 186, 3, 186, 1682, 8, 186, 1, 186, - 4, 186, 1685, 8, 186, 11, 186, 12, 186, 1686, 3, 186, 1689, 8, 186, 1, - 186, 1, 186, 1, 186, 1, 186, 4, 186, 1695, 8, 186, 11, 186, 12, 186, 1696, - 3, 186, 1699, 8, 186, 1, 187, 1, 187, 5, 187, 1703, 8, 187, 10, 187, 12, - 187, 1706, 9, 187, 1, 188, 1, 188, 1, 188, 1, 189, 1, 189, 1, 189, 1, 189, - 5, 189, 1715, 8, 189, 10, 189, 12, 189, 1718, 9, 189, 1, 189, 1, 189, 1, - 190, 1, 190, 1, 190, 1, 191, 1, 191, 1, 191, 1, 191, 5, 191, 1729, 8, 191, - 10, 191, 12, 191, 1732, 9, 191, 1, 191, 3, 191, 1735, 8, 191, 1, 191, 1, - 191, 3, 191, 1739, 8, 191, 1, 191, 1, 191, 1, 192, 1, 192, 1, 192, 1, 192, - 5, 192, 1747, 8, 192, 10, 192, 12, 192, 1750, 9, 192, 1, 192, 1, 192, 1, - 192, 1, 192, 1, 192, 1, 193, 1, 193, 1, 193, 1, 193, 1, 194, 1, 194, 1, + 2, 221, 7, 221, 2, 222, 7, 222, 2, 223, 7, 223, 2, 224, 7, 224, 1, 0, 1, + 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, + 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, + 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 15, 1, + 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 19, 1, 19, + 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, 23, 1, 23, 1, + 23, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 26, 1, 26, + 1, 26, 1, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 28, 1, + 28, 1, 28, 1, 28, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 30, 1, 30, + 1, 30, 1, 30, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 32, 1, 32, 1, + 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 33, 1, 34, + 1, 34, 1, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 36, 1, + 36, 1, 36, 1, 36, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, + 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, + 38, 1, 38, 1, 38, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 40, 1, 40, + 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 42, 1, + 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 43, 1, 43, 1, 43, 1, 43, + 1, 43, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 45, 1, 45, 1, 45, 1, 45, 1, + 45, 1, 45, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 47, + 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 48, 1, 48, 1, 48, 1, 48, 1, + 48, 1, 48, 1, 48, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, + 1, 49, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, + 50, 1, 50, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 52, 1, 52, + 1, 52, 1, 52, 1, 52, 1, 52, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, + 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 54, 1, 54, 1, 54, 1, 54, + 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 55, 1, + 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, + 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 56, 1, 56, 1, + 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, + 1, 57, 1, 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, + 58, 1, 58, 1, 58, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, + 1, 59, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 61, 1, 61, 1, + 61, 1, 61, 1, 61, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 63, + 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 64, 1, 64, 1, + 64, 1, 64, 1, 64, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 66, 1, 66, 1, 66, + 1, 66, 1, 66, 1, 67, 1, 67, 1, 67, 1, 67, 1, 68, 1, 68, 1, 68, 1, 68, 1, + 68, 1, 68, 1, 68, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 70, + 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 71, 1, + 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, + 1, 72, 1, 72, 1, 72, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 74, 1, 74, 1, + 74, 1, 74, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 76, + 1, 76, 1, 76, 1, 76, 1, 76, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 78, 1, + 78, 1, 78, 1, 78, 1, 78, 1, 79, 1, 79, 1, 79, 1, 79, 1, 79, 1, 79, 1, 80, + 1, 80, 1, 80, 1, 80, 1, 80, 1, 80, 1, 80, 1, 81, 1, 81, 1, 81, 1, 82, 1, + 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, + 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 84, 1, 84, 1, 84, 1, 85, 1, 85, 1, + 85, 1, 85, 1, 85, 1, 85, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, + 1, 86, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, + 87, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 89, 1, 89, 1, 89, 1, 89, + 1, 89, 1, 89, 1, 89, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, + 90, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, + 1, 92, 1, 92, 1, 92, 1, 92, 1, 92, 1, 93, 1, 93, 1, 93, 1, 94, 1, 94, 1, + 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 96, + 1, 96, 1, 96, 1, 96, 1, 97, 1, 97, 1, 97, 1, 97, 1, 97, 1, 98, 1, 98, 1, + 98, 1, 98, 1, 98, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 100, 1, + 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 101, 1, 101, 1, 101, 1, 101, 1, + 101, 1, 101, 1, 101, 1, 101, 1, 102, 1, 102, 1, 102, 1, 103, 1, 103, 1, + 103, 1, 103, 1, 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, + 104, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 106, 1, 106, 1, 106, 1, + 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 108, 1, 108, 1, + 108, 1, 109, 1, 109, 1, 109, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, + 110, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 112, 1, 112, 1, + 112, 1, 112, 1, 112, 1, 113, 1, 113, 1, 113, 1, 113, 1, 113, 1, 113, 1, + 113, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, + 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 116, 1, 116, 1, 116, 1, + 116, 1, 116, 1, 116, 1, 117, 1, 117, 1, 117, 1, 117, 1, 117, 1, 117, 1, + 117, 1, 117, 1, 117, 1, 117, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, + 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 119, 1, 119, 1, 119, 1, + 119, 1, 119, 1, 119, 1, 119, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, + 120, 1, 120, 1, 120, 1, 121, 1, 121, 1, 121, 1, 121, 1, 121, 1, 121, 1, + 121, 1, 121, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, + 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 124, 1, + 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 125, 1, + 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, + 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 127, 1, 127, 1, 127, 1, + 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 128, 1, 128, 1, 128, 1, + 128, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 130, 1, 130, 1, 130, 1, + 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 131, 1, 131, 1, + 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 132, 1, 132, 1, 132, 1, 132, 1, + 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 134, 1, 134, 1, + 134, 1, 134, 1, 134, 1, 134, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, + 136, 1, 136, 1, 136, 1, 136, 1, 136, 1, 136, 1, 136, 1, 136, 1, 136, 1, + 136, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 138, 1, 138, 1, 138, 1, + 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, + 139, 1, 139, 1, 139, 1, 140, 1, 140, 1, 140, 1, 140, 1, 140, 1, 140, 1, + 140, 1, 140, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 1, 142, 1, + 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 143, 1, 143, 1, 143, 1, + 143, 1, 143, 1, 143, 1, 143, 1, 144, 1, 144, 1, 144, 1, 144, 1, 144, 1, + 144, 1, 145, 1, 145, 1, 145, 1, 145, 1, 145, 1, 145, 1, 145, 1, 146, 1, + 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 147, 1, 147, 1, 147, 1, + 147, 1, 147, 1, 148, 1, 148, 1, 148, 1, 148, 1, 148, 1, 148, 1, 148, 1, + 148, 1, 149, 1, 149, 1, 149, 1, 149, 1, 149, 1, 150, 1, 150, 1, 150, 1, + 150, 1, 150, 1, 150, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 152, 1, + 152, 1, 152, 1, 152, 1, 152, 1, 152, 1, 152, 1, 152, 1, 153, 1, 153, 1, + 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, + 153, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 155, 1, 155, 1, 155, 1, + 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 156, 1, 156, 1, + 156, 1, 156, 1, 156, 1, 156, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, + 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 158, 1, 158, 1, 158, 1, 158, 1, + 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 159, 1, 159, 1, 159, 1, + 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 160, 1, 160, 1, 160, 1, 160, 1, + 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 161, 1, 161, 1, 161, 1, + 161, 1, 161, 1, 161, 1, 161, 1, 161, 1, 161, 1, 161, 1, 162, 1, 162, 1, + 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, + 163, 1, 163, 1, 163, 1, 163, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, + 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 165, 1, 165, 1, 165, 1, + 165, 1, 165, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, + 166, 1, 166, 1, 166, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 1, + 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, + 168, 1, 168, 1, 168, 1, 168, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, + 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, + 170, 1, 170, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, + 171, 1, 171, 1, 171, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, + 172, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 1, 174, 1, + 174, 1, 174, 1, 174, 1, 174, 1, 175, 1, 175, 1, 175, 1, 175, 1, 175, 1, + 175, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 177, 1, + 177, 1, 177, 1, 177, 1, 177, 1, 177, 1, 178, 1, 178, 1, 178, 1, 178, 1, + 178, 1, 178, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 180, 1, 180, 1, + 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 181, 1, 181, 1, 181, 1, 181, 1, + 181, 1, 181, 1, 181, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, + 182, 1, 182, 1, 183, 1, 183, 1, 183, 1, 183, 1, 183, 1, 184, 1, 184, 1, + 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 185, 1, 185, 1, 185, 1, 186, 1, + 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, 187, 1, 187, 1, + 187, 1, 187, 5, 187, 1636, 8, 187, 10, 187, 12, 187, 1639, 9, 187, 1, 187, + 1, 187, 1, 187, 1, 187, 1, 187, 5, 187, 1646, 8, 187, 10, 187, 12, 187, + 1649, 9, 187, 1, 187, 1, 187, 1, 187, 5, 187, 1654, 8, 187, 10, 187, 12, + 187, 1657, 9, 187, 1, 187, 1, 187, 1, 187, 5, 187, 1662, 8, 187, 10, 187, + 12, 187, 1665, 9, 187, 3, 187, 1667, 8, 187, 1, 188, 4, 188, 1670, 8, 188, + 11, 188, 12, 188, 1671, 1, 188, 1, 188, 5, 188, 1676, 8, 188, 10, 188, + 12, 188, 1679, 9, 188, 3, 188, 1681, 8, 188, 1, 188, 1, 188, 4, 188, 1685, + 8, 188, 11, 188, 12, 188, 1686, 3, 188, 1689, 8, 188, 1, 188, 1, 188, 3, + 188, 1693, 8, 188, 1, 188, 4, 188, 1696, 8, 188, 11, 188, 12, 188, 1697, + 3, 188, 1700, 8, 188, 1, 188, 1, 188, 1, 188, 1, 188, 4, 188, 1706, 8, + 188, 11, 188, 12, 188, 1707, 3, 188, 1710, 8, 188, 1, 189, 1, 189, 5, 189, + 1714, 8, 189, 10, 189, 12, 189, 1717, 9, 189, 1, 190, 1, 190, 1, 190, 1, + 191, 1, 191, 1, 191, 1, 191, 5, 191, 1726, 8, 191, 10, 191, 12, 191, 1729, + 9, 191, 1, 191, 1, 191, 1, 192, 1, 192, 1, 192, 1, 193, 1, 193, 1, 193, + 1, 193, 5, 193, 1740, 8, 193, 10, 193, 12, 193, 1743, 9, 193, 1, 193, 3, + 193, 1746, 8, 193, 1, 193, 1, 193, 3, 193, 1750, 8, 193, 1, 193, 1, 193, + 1, 194, 1, 194, 1, 194, 1, 194, 5, 194, 1758, 8, 194, 10, 194, 12, 194, + 1761, 9, 194, 1, 194, 1, 194, 1, 194, 1, 194, 1, 194, 1, 195, 1, 195, 1, 195, 1, 195, 1, 196, 1, 196, 1, 197, 1, 197, 1, 198, 1, 198, 1, 199, 1, 199, 1, 200, 1, 200, 1, 201, 1, 201, 1, 202, 1, 202, 1, 203, 1, 203, 1, 204, 1, 204, 1, 205, 1, 205, 1, 206, 1, 206, 1, 207, 1, 207, 1, 208, 1, 208, 1, 209, 1, 209, 1, 210, 1, 210, 1, 211, 1, 211, 1, 212, 1, 212, 1, 213, 1, 213, 1, 214, 1, 214, 1, 215, 1, 215, 1, 216, 1, 216, 1, 217, 1, 217, 1, 218, 1, 218, 1, 219, 1, 219, 1, 220, 1, 220, 1, 221, 1, 221, 1, - 222, 1, 222, 1, 1748, 0, 223, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, - 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, - 33, 17, 35, 18, 37, 19, 39, 20, 41, 21, 43, 22, 45, 23, 47, 24, 49, 25, - 51, 26, 53, 27, 55, 28, 57, 29, 59, 30, 61, 31, 63, 32, 65, 33, 67, 34, - 69, 35, 71, 36, 73, 37, 75, 38, 77, 39, 79, 40, 81, 41, 83, 42, 85, 43, - 87, 44, 89, 45, 91, 46, 93, 47, 95, 48, 97, 49, 99, 50, 101, 51, 103, 52, - 105, 53, 107, 54, 109, 55, 111, 56, 113, 57, 115, 58, 117, 59, 119, 60, - 121, 61, 123, 62, 125, 63, 127, 64, 129, 65, 131, 66, 133, 67, 135, 68, - 137, 69, 139, 70, 141, 71, 143, 72, 145, 73, 147, 74, 149, 75, 151, 76, - 153, 77, 155, 78, 157, 79, 159, 80, 161, 81, 163, 82, 165, 83, 167, 84, - 169, 85, 171, 86, 173, 87, 175, 88, 177, 89, 179, 90, 181, 91, 183, 92, - 185, 93, 187, 94, 189, 95, 191, 96, 193, 97, 195, 98, 197, 99, 199, 100, - 201, 101, 203, 102, 205, 103, 207, 104, 209, 105, 211, 106, 213, 107, 215, - 108, 217, 109, 219, 110, 221, 111, 223, 112, 225, 113, 227, 114, 229, 115, - 231, 116, 233, 117, 235, 118, 237, 119, 239, 120, 241, 121, 243, 122, 245, - 123, 247, 124, 249, 125, 251, 126, 253, 127, 255, 128, 257, 129, 259, 130, - 261, 131, 263, 132, 265, 133, 267, 134, 269, 135, 271, 136, 273, 137, 275, - 138, 277, 139, 279, 140, 281, 141, 283, 142, 285, 143, 287, 144, 289, 145, - 291, 146, 293, 147, 295, 148, 297, 149, 299, 150, 301, 151, 303, 152, 305, - 153, 307, 154, 309, 155, 311, 156, 313, 157, 315, 158, 317, 159, 319, 160, - 321, 161, 323, 162, 325, 163, 327, 164, 329, 165, 331, 166, 333, 167, 335, - 168, 337, 169, 339, 170, 341, 171, 343, 172, 345, 173, 347, 174, 349, 175, - 351, 176, 353, 177, 355, 178, 357, 179, 359, 180, 361, 181, 363, 182, 365, - 183, 367, 184, 369, 185, 371, 186, 373, 187, 375, 188, 377, 189, 379, 190, - 381, 191, 383, 192, 385, 193, 387, 194, 389, 195, 391, 0, 393, 0, 395, - 0, 397, 0, 399, 0, 401, 0, 403, 0, 405, 0, 407, 0, 409, 0, 411, 0, 413, - 0, 415, 0, 417, 0, 419, 0, 421, 0, 423, 0, 425, 0, 427, 0, 429, 0, 431, - 0, 433, 0, 435, 0, 437, 0, 439, 0, 441, 0, 443, 0, 445, 0, 1, 0, 38, 1, - 0, 34, 34, 1, 0, 96, 96, 1, 0, 93, 93, 3, 0, 65, 90, 95, 95, 97, 122, 4, - 0, 48, 57, 65, 90, 95, 95, 97, 122, 2, 0, 43, 43, 45, 45, 3, 0, 36, 36, - 58, 58, 64, 64, 1, 0, 39, 39, 2, 0, 10, 10, 13, 13, 3, 0, 9, 11, 13, 13, - 32, 32, 3, 0, 48, 57, 65, 70, 97, 102, 1, 0, 48, 57, 2, 0, 65, 65, 97, - 97, 2, 0, 66, 66, 98, 98, 2, 0, 67, 67, 99, 99, 2, 0, 68, 68, 100, 100, - 2, 0, 69, 69, 101, 101, 2, 0, 70, 70, 102, 102, 2, 0, 71, 71, 103, 103, - 2, 0, 72, 72, 104, 104, 2, 0, 73, 73, 105, 105, 2, 0, 74, 74, 106, 106, - 2, 0, 75, 75, 107, 107, 2, 0, 76, 76, 108, 108, 2, 0, 77, 77, 109, 109, - 2, 0, 78, 78, 110, 110, 2, 0, 79, 79, 111, 111, 2, 0, 80, 80, 112, 112, - 2, 0, 81, 81, 113, 113, 2, 0, 82, 82, 114, 114, 2, 0, 83, 83, 115, 115, - 2, 0, 84, 84, 116, 116, 2, 0, 85, 85, 117, 117, 2, 0, 86, 86, 118, 118, - 2, 0, 87, 87, 119, 119, 2, 0, 88, 88, 120, 120, 2, 0, 89, 89, 121, 121, - 2, 0, 90, 90, 122, 122, 1815, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, - 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, - 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, - 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, - 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, - 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, - 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, - 0, 0, 0, 0, 53, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, - 1, 0, 0, 0, 0, 61, 1, 0, 0, 0, 0, 63, 1, 0, 0, 0, 0, 65, 1, 0, 0, 0, 0, - 67, 1, 0, 0, 0, 0, 69, 1, 0, 0, 0, 0, 71, 1, 0, 0, 0, 0, 73, 1, 0, 0, 0, - 0, 75, 1, 0, 0, 0, 0, 77, 1, 0, 0, 0, 0, 79, 1, 0, 0, 0, 0, 81, 1, 0, 0, - 0, 0, 83, 1, 0, 0, 0, 0, 85, 1, 0, 0, 0, 0, 87, 1, 0, 0, 0, 0, 89, 1, 0, - 0, 0, 0, 91, 1, 0, 0, 0, 0, 93, 1, 0, 0, 0, 0, 95, 1, 0, 0, 0, 0, 97, 1, - 0, 0, 0, 0, 99, 1, 0, 0, 0, 0, 101, 1, 0, 0, 0, 0, 103, 1, 0, 0, 0, 0, - 105, 1, 0, 0, 0, 0, 107, 1, 0, 0, 0, 0, 109, 1, 0, 0, 0, 0, 111, 1, 0, - 0, 0, 0, 113, 1, 0, 0, 0, 0, 115, 1, 0, 0, 0, 0, 117, 1, 0, 0, 0, 0, 119, - 1, 0, 0, 0, 0, 121, 1, 0, 0, 0, 0, 123, 1, 0, 0, 0, 0, 125, 1, 0, 0, 0, - 0, 127, 1, 0, 0, 0, 0, 129, 1, 0, 0, 0, 0, 131, 1, 0, 0, 0, 0, 133, 1, - 0, 0, 0, 0, 135, 1, 0, 0, 0, 0, 137, 1, 0, 0, 0, 0, 139, 1, 0, 0, 0, 0, - 141, 1, 0, 0, 0, 0, 143, 1, 0, 0, 0, 0, 145, 1, 0, 0, 0, 0, 147, 1, 0, - 0, 0, 0, 149, 1, 0, 0, 0, 0, 151, 1, 0, 0, 0, 0, 153, 1, 0, 0, 0, 0, 155, - 1, 0, 0, 0, 0, 157, 1, 0, 0, 0, 0, 159, 1, 0, 0, 0, 0, 161, 1, 0, 0, 0, - 0, 163, 1, 0, 0, 0, 0, 165, 1, 0, 0, 0, 0, 167, 1, 0, 0, 0, 0, 169, 1, - 0, 0, 0, 0, 171, 1, 0, 0, 0, 0, 173, 1, 0, 0, 0, 0, 175, 1, 0, 0, 0, 0, - 177, 1, 0, 0, 0, 0, 179, 1, 0, 0, 0, 0, 181, 1, 0, 0, 0, 0, 183, 1, 0, - 0, 0, 0, 185, 1, 0, 0, 0, 0, 187, 1, 0, 0, 0, 0, 189, 1, 0, 0, 0, 0, 191, - 1, 0, 0, 0, 0, 193, 1, 0, 0, 0, 0, 195, 1, 0, 0, 0, 0, 197, 1, 0, 0, 0, - 0, 199, 1, 0, 0, 0, 0, 201, 1, 0, 0, 0, 0, 203, 1, 0, 0, 0, 0, 205, 1, - 0, 0, 0, 0, 207, 1, 0, 0, 0, 0, 209, 1, 0, 0, 0, 0, 211, 1, 0, 0, 0, 0, - 213, 1, 0, 0, 0, 0, 215, 1, 0, 0, 0, 0, 217, 1, 0, 0, 0, 0, 219, 1, 0, - 0, 0, 0, 221, 1, 0, 0, 0, 0, 223, 1, 0, 0, 0, 0, 225, 1, 0, 0, 0, 0, 227, - 1, 0, 0, 0, 0, 229, 1, 0, 0, 0, 0, 231, 1, 0, 0, 0, 0, 233, 1, 0, 0, 0, - 0, 235, 1, 0, 0, 0, 0, 237, 1, 0, 0, 0, 0, 239, 1, 0, 0, 0, 0, 241, 1, - 0, 0, 0, 0, 243, 1, 0, 0, 0, 0, 245, 1, 0, 0, 0, 0, 247, 1, 0, 0, 0, 0, - 249, 1, 0, 0, 0, 0, 251, 1, 0, 0, 0, 0, 253, 1, 0, 0, 0, 0, 255, 1, 0, - 0, 0, 0, 257, 1, 0, 0, 0, 0, 259, 1, 0, 0, 0, 0, 261, 1, 0, 0, 0, 0, 263, - 1, 0, 0, 0, 0, 265, 1, 0, 0, 0, 0, 267, 1, 0, 0, 0, 0, 269, 1, 0, 0, 0, - 0, 271, 1, 0, 0, 0, 0, 273, 1, 0, 0, 0, 0, 275, 1, 0, 0, 0, 0, 277, 1, - 0, 0, 0, 0, 279, 1, 0, 0, 0, 0, 281, 1, 0, 0, 0, 0, 283, 1, 0, 0, 0, 0, - 285, 1, 0, 0, 0, 0, 287, 1, 0, 0, 0, 0, 289, 1, 0, 0, 0, 0, 291, 1, 0, - 0, 0, 0, 293, 1, 0, 0, 0, 0, 295, 1, 0, 0, 0, 0, 297, 1, 0, 0, 0, 0, 299, - 1, 0, 0, 0, 0, 301, 1, 0, 0, 0, 0, 303, 1, 0, 0, 0, 0, 305, 1, 0, 0, 0, - 0, 307, 1, 0, 0, 0, 0, 309, 1, 0, 0, 0, 0, 311, 1, 0, 0, 0, 0, 313, 1, - 0, 0, 0, 0, 315, 1, 0, 0, 0, 0, 317, 1, 0, 0, 0, 0, 319, 1, 0, 0, 0, 0, - 321, 1, 0, 0, 0, 0, 323, 1, 0, 0, 0, 0, 325, 1, 0, 0, 0, 0, 327, 1, 0, - 0, 0, 0, 329, 1, 0, 0, 0, 0, 331, 1, 0, 0, 0, 0, 333, 1, 0, 0, 0, 0, 335, - 1, 0, 0, 0, 0, 337, 1, 0, 0, 0, 0, 339, 1, 0, 0, 0, 0, 341, 1, 0, 0, 0, - 0, 343, 1, 0, 0, 0, 0, 345, 1, 0, 0, 0, 0, 347, 1, 0, 0, 0, 0, 349, 1, - 0, 0, 0, 0, 351, 1, 0, 0, 0, 0, 353, 1, 0, 0, 0, 0, 355, 1, 0, 0, 0, 0, - 357, 1, 0, 0, 0, 0, 359, 1, 0, 0, 0, 0, 361, 1, 0, 0, 0, 0, 363, 1, 0, - 0, 0, 0, 365, 1, 0, 0, 0, 0, 367, 1, 0, 0, 0, 0, 369, 1, 0, 0, 0, 0, 371, - 1, 0, 0, 0, 0, 373, 1, 0, 0, 0, 0, 375, 1, 0, 0, 0, 0, 377, 1, 0, 0, 0, - 0, 379, 1, 0, 0, 0, 0, 381, 1, 0, 0, 0, 0, 383, 1, 0, 0, 0, 0, 385, 1, - 0, 0, 0, 0, 387, 1, 0, 0, 0, 0, 389, 1, 0, 0, 0, 1, 447, 1, 0, 0, 0, 3, - 449, 1, 0, 0, 0, 5, 451, 1, 0, 0, 0, 7, 453, 1, 0, 0, 0, 9, 455, 1, 0, - 0, 0, 11, 457, 1, 0, 0, 0, 13, 459, 1, 0, 0, 0, 15, 461, 1, 0, 0, 0, 17, - 463, 1, 0, 0, 0, 19, 465, 1, 0, 0, 0, 21, 467, 1, 0, 0, 0, 23, 470, 1, - 0, 0, 0, 25, 472, 1, 0, 0, 0, 27, 474, 1, 0, 0, 0, 29, 477, 1, 0, 0, 0, - 31, 480, 1, 0, 0, 0, 33, 482, 1, 0, 0, 0, 35, 484, 1, 0, 0, 0, 37, 486, - 1, 0, 0, 0, 39, 489, 1, 0, 0, 0, 41, 491, 1, 0, 0, 0, 43, 494, 1, 0, 0, - 0, 45, 497, 1, 0, 0, 0, 47, 500, 1, 0, 0, 0, 49, 503, 1, 0, 0, 0, 51, 509, - 1, 0, 0, 0, 53, 516, 1, 0, 0, 0, 55, 520, 1, 0, 0, 0, 57, 526, 1, 0, 0, - 0, 59, 530, 1, 0, 0, 0, 61, 536, 1, 0, 0, 0, 63, 544, 1, 0, 0, 0, 65, 548, - 1, 0, 0, 0, 67, 551, 1, 0, 0, 0, 69, 555, 1, 0, 0, 0, 71, 562, 1, 0, 0, - 0, 73, 576, 1, 0, 0, 0, 75, 583, 1, 0, 0, 0, 77, 589, 1, 0, 0, 0, 79, 597, - 1, 0, 0, 0, 81, 600, 1, 0, 0, 0, 83, 608, 1, 0, 0, 0, 85, 613, 1, 0, 0, - 0, 87, 618, 1, 0, 0, 0, 89, 624, 1, 0, 0, 0, 91, 632, 1, 0, 0, 0, 93, 639, - 1, 0, 0, 0, 95, 646, 1, 0, 0, 0, 97, 655, 1, 0, 0, 0, 99, 666, 1, 0, 0, - 0, 101, 673, 1, 0, 0, 0, 103, 679, 1, 0, 0, 0, 105, 692, 1, 0, 0, 0, 107, - 705, 1, 0, 0, 0, 109, 723, 1, 0, 0, 0, 111, 732, 1, 0, 0, 0, 113, 740, - 1, 0, 0, 0, 115, 751, 1, 0, 0, 0, 117, 760, 1, 0, 0, 0, 119, 767, 1, 0, - 0, 0, 121, 772, 1, 0, 0, 0, 123, 779, 1, 0, 0, 0, 125, 788, 1, 0, 0, 0, - 127, 793, 1, 0, 0, 0, 129, 798, 1, 0, 0, 0, 131, 803, 1, 0, 0, 0, 133, - 807, 1, 0, 0, 0, 135, 814, 1, 0, 0, 0, 137, 821, 1, 0, 0, 0, 139, 831, - 1, 0, 0, 0, 141, 838, 1, 0, 0, 0, 143, 846, 1, 0, 0, 0, 145, 851, 1, 0, - 0, 0, 147, 855, 1, 0, 0, 0, 149, 863, 1, 0, 0, 0, 151, 868, 1, 0, 0, 0, - 153, 873, 1, 0, 0, 0, 155, 878, 1, 0, 0, 0, 157, 884, 1, 0, 0, 0, 159, - 891, 1, 0, 0, 0, 161, 894, 1, 0, 0, 0, 163, 901, 1, 0, 0, 0, 165, 911, - 1, 0, 0, 0, 167, 914, 1, 0, 0, 0, 169, 920, 1, 0, 0, 0, 171, 928, 1, 0, - 0, 0, 173, 938, 1, 0, 0, 0, 175, 944, 1, 0, 0, 0, 177, 951, 1, 0, 0, 0, - 179, 959, 1, 0, 0, 0, 181, 969, 1, 0, 0, 0, 183, 974, 1, 0, 0, 0, 185, - 977, 1, 0, 0, 0, 187, 984, 1, 0, 0, 0, 189, 989, 1, 0, 0, 0, 191, 993, - 1, 0, 0, 0, 193, 998, 1, 0, 0, 0, 195, 1003, 1, 0, 0, 0, 197, 1009, 1, - 0, 0, 0, 199, 1015, 1, 0, 0, 0, 201, 1023, 1, 0, 0, 0, 203, 1026, 1, 0, - 0, 0, 205, 1030, 1, 0, 0, 0, 207, 1038, 1, 0, 0, 0, 209, 1043, 1, 0, 0, - 0, 211, 1046, 1, 0, 0, 0, 213, 1053, 1, 0, 0, 0, 215, 1056, 1, 0, 0, 0, - 217, 1059, 1, 0, 0, 0, 219, 1065, 1, 0, 0, 0, 221, 1071, 1, 0, 0, 0, 223, - 1076, 1, 0, 0, 0, 225, 1083, 1, 0, 0, 0, 227, 1091, 1, 0, 0, 0, 229, 1097, - 1, 0, 0, 0, 231, 1103, 1, 0, 0, 0, 233, 1113, 1, 0, 0, 0, 235, 1124, 1, - 0, 0, 0, 237, 1131, 1, 0, 0, 0, 239, 1139, 1, 0, 0, 0, 241, 1147, 1, 0, - 0, 0, 243, 1154, 1, 0, 0, 0, 245, 1162, 1, 0, 0, 0, 247, 1171, 1, 0, 0, - 0, 249, 1181, 1, 0, 0, 0, 251, 1187, 1, 0, 0, 0, 253, 1196, 1, 0, 0, 0, - 255, 1200, 1, 0, 0, 0, 257, 1205, 1, 0, 0, 0, 259, 1215, 1, 0, 0, 0, 261, - 1222, 1, 0, 0, 0, 263, 1226, 1, 0, 0, 0, 265, 1233, 1, 0, 0, 0, 267, 1239, - 1, 0, 0, 0, 269, 1244, 1, 0, 0, 0, 271, 1254, 1, 0, 0, 0, 273, 1259, 1, - 0, 0, 0, 275, 1262, 1, 0, 0, 0, 277, 1274, 1, 0, 0, 0, 279, 1282, 1, 0, - 0, 0, 281, 1288, 1, 0, 0, 0, 283, 1295, 1, 0, 0, 0, 285, 1302, 1, 0, 0, - 0, 287, 1308, 1, 0, 0, 0, 289, 1315, 1, 0, 0, 0, 291, 1322, 1, 0, 0, 0, - 293, 1327, 1, 0, 0, 0, 295, 1335, 1, 0, 0, 0, 297, 1340, 1, 0, 0, 0, 299, - 1346, 1, 0, 0, 0, 301, 1351, 1, 0, 0, 0, 303, 1359, 1, 0, 0, 0, 305, 1371, - 1, 0, 0, 0, 307, 1376, 1, 0, 0, 0, 309, 1386, 1, 0, 0, 0, 311, 1392, 1, - 0, 0, 0, 313, 1402, 1, 0, 0, 0, 315, 1412, 1, 0, 0, 0, 317, 1420, 1, 0, - 0, 0, 319, 1430, 1, 0, 0, 0, 321, 1440, 1, 0, 0, 0, 323, 1451, 1, 0, 0, - 0, 325, 1455, 1, 0, 0, 0, 327, 1466, 1, 0, 0, 0, 329, 1471, 1, 0, 0, 0, - 331, 1481, 1, 0, 0, 0, 333, 1487, 1, 0, 0, 0, 335, 1500, 1, 0, 0, 0, 337, - 1505, 1, 0, 0, 0, 339, 1516, 1, 0, 0, 0, 341, 1526, 1, 0, 0, 0, 343, 1533, - 1, 0, 0, 0, 345, 1540, 1, 0, 0, 0, 347, 1545, 1, 0, 0, 0, 349, 1551, 1, - 0, 0, 0, 351, 1558, 1, 0, 0, 0, 353, 1564, 1, 0, 0, 0, 355, 1570, 1, 0, - 0, 0, 357, 1575, 1, 0, 0, 0, 359, 1582, 1, 0, 0, 0, 361, 1589, 1, 0, 0, - 0, 363, 1597, 1, 0, 0, 0, 365, 1602, 1, 0, 0, 0, 367, 1609, 1, 0, 0, 0, - 369, 1612, 1, 0, 0, 0, 371, 1655, 1, 0, 0, 0, 373, 1698, 1, 0, 0, 0, 375, - 1700, 1, 0, 0, 0, 377, 1707, 1, 0, 0, 0, 379, 1710, 1, 0, 0, 0, 381, 1721, - 1, 0, 0, 0, 383, 1724, 1, 0, 0, 0, 385, 1742, 1, 0, 0, 0, 387, 1756, 1, - 0, 0, 0, 389, 1760, 1, 0, 0, 0, 391, 1762, 1, 0, 0, 0, 393, 1764, 1, 0, - 0, 0, 395, 1766, 1, 0, 0, 0, 397, 1768, 1, 0, 0, 0, 399, 1770, 1, 0, 0, - 0, 401, 1772, 1, 0, 0, 0, 403, 1774, 1, 0, 0, 0, 405, 1776, 1, 0, 0, 0, - 407, 1778, 1, 0, 0, 0, 409, 1780, 1, 0, 0, 0, 411, 1782, 1, 0, 0, 0, 413, - 1784, 1, 0, 0, 0, 415, 1786, 1, 0, 0, 0, 417, 1788, 1, 0, 0, 0, 419, 1790, - 1, 0, 0, 0, 421, 1792, 1, 0, 0, 0, 423, 1794, 1, 0, 0, 0, 425, 1796, 1, - 0, 0, 0, 427, 1798, 1, 0, 0, 0, 429, 1800, 1, 0, 0, 0, 431, 1802, 1, 0, - 0, 0, 433, 1804, 1, 0, 0, 0, 435, 1806, 1, 0, 0, 0, 437, 1808, 1, 0, 0, - 0, 439, 1810, 1, 0, 0, 0, 441, 1812, 1, 0, 0, 0, 443, 1814, 1, 0, 0, 0, - 445, 1816, 1, 0, 0, 0, 447, 448, 5, 59, 0, 0, 448, 2, 1, 0, 0, 0, 449, - 450, 5, 46, 0, 0, 450, 4, 1, 0, 0, 0, 451, 452, 5, 40, 0, 0, 452, 6, 1, - 0, 0, 0, 453, 454, 5, 41, 0, 0, 454, 8, 1, 0, 0, 0, 455, 456, 5, 44, 0, - 0, 456, 10, 1, 0, 0, 0, 457, 458, 5, 61, 0, 0, 458, 12, 1, 0, 0, 0, 459, - 460, 5, 42, 0, 0, 460, 14, 1, 0, 0, 0, 461, 462, 5, 43, 0, 0, 462, 16, - 1, 0, 0, 0, 463, 464, 5, 45, 0, 0, 464, 18, 1, 0, 0, 0, 465, 466, 5, 126, - 0, 0, 466, 20, 1, 0, 0, 0, 467, 468, 5, 124, 0, 0, 468, 469, 5, 124, 0, - 0, 469, 22, 1, 0, 0, 0, 470, 471, 5, 47, 0, 0, 471, 24, 1, 0, 0, 0, 472, - 473, 5, 37, 0, 0, 473, 26, 1, 0, 0, 0, 474, 475, 5, 60, 0, 0, 475, 476, - 5, 60, 0, 0, 476, 28, 1, 0, 0, 0, 477, 478, 5, 62, 0, 0, 478, 479, 5, 62, - 0, 0, 479, 30, 1, 0, 0, 0, 480, 481, 5, 38, 0, 0, 481, 32, 1, 0, 0, 0, - 482, 483, 5, 124, 0, 0, 483, 34, 1, 0, 0, 0, 484, 485, 5, 60, 0, 0, 485, - 36, 1, 0, 0, 0, 486, 487, 5, 60, 0, 0, 487, 488, 5, 61, 0, 0, 488, 38, - 1, 0, 0, 0, 489, 490, 5, 62, 0, 0, 490, 40, 1, 0, 0, 0, 491, 492, 5, 62, - 0, 0, 492, 493, 5, 61, 0, 0, 493, 42, 1, 0, 0, 0, 494, 495, 5, 61, 0, 0, - 495, 496, 5, 61, 0, 0, 496, 44, 1, 0, 0, 0, 497, 498, 5, 33, 0, 0, 498, - 499, 5, 61, 0, 0, 499, 46, 1, 0, 0, 0, 500, 501, 5, 60, 0, 0, 501, 502, - 5, 62, 0, 0, 502, 48, 1, 0, 0, 0, 503, 504, 3, 395, 197, 0, 504, 505, 3, - 397, 198, 0, 505, 506, 3, 423, 211, 0, 506, 507, 3, 429, 214, 0, 507, 508, - 3, 433, 216, 0, 508, 50, 1, 0, 0, 0, 509, 510, 3, 395, 197, 0, 510, 511, - 3, 399, 199, 0, 511, 512, 3, 433, 216, 0, 512, 513, 3, 411, 205, 0, 513, - 514, 3, 423, 211, 0, 514, 515, 3, 421, 210, 0, 515, 52, 1, 0, 0, 0, 516, - 517, 3, 395, 197, 0, 517, 518, 3, 401, 200, 0, 518, 519, 3, 401, 200, 0, - 519, 54, 1, 0, 0, 0, 520, 521, 3, 395, 197, 0, 521, 522, 3, 405, 202, 0, - 522, 523, 3, 433, 216, 0, 523, 524, 3, 403, 201, 0, 524, 525, 3, 429, 214, - 0, 525, 56, 1, 0, 0, 0, 526, 527, 3, 395, 197, 0, 527, 528, 3, 417, 208, - 0, 528, 529, 3, 417, 208, 0, 529, 58, 1, 0, 0, 0, 530, 531, 3, 395, 197, - 0, 531, 532, 3, 417, 208, 0, 532, 533, 3, 433, 216, 0, 533, 534, 3, 403, - 201, 0, 534, 535, 3, 429, 214, 0, 535, 60, 1, 0, 0, 0, 536, 537, 3, 395, - 197, 0, 537, 538, 3, 421, 210, 0, 538, 539, 3, 395, 197, 0, 539, 540, 3, - 417, 208, 0, 540, 541, 3, 443, 221, 0, 541, 542, 3, 445, 222, 0, 542, 543, - 3, 403, 201, 0, 543, 62, 1, 0, 0, 0, 544, 545, 3, 395, 197, 0, 545, 546, - 3, 421, 210, 0, 546, 547, 3, 401, 200, 0, 547, 64, 1, 0, 0, 0, 548, 549, - 3, 395, 197, 0, 549, 550, 3, 431, 215, 0, 550, 66, 1, 0, 0, 0, 551, 552, - 3, 395, 197, 0, 552, 553, 3, 431, 215, 0, 553, 554, 3, 399, 199, 0, 554, - 68, 1, 0, 0, 0, 555, 556, 3, 395, 197, 0, 556, 557, 3, 433, 216, 0, 557, - 558, 3, 433, 216, 0, 558, 559, 3, 395, 197, 0, 559, 560, 3, 399, 199, 0, - 560, 561, 3, 409, 204, 0, 561, 70, 1, 0, 0, 0, 562, 563, 3, 395, 197, 0, - 563, 564, 3, 435, 217, 0, 564, 565, 3, 433, 216, 0, 565, 566, 3, 423, 211, - 0, 566, 567, 3, 411, 205, 0, 567, 568, 3, 421, 210, 0, 568, 569, 3, 399, - 199, 0, 569, 570, 3, 429, 214, 0, 570, 571, 3, 403, 201, 0, 571, 572, 3, - 419, 209, 0, 572, 573, 3, 403, 201, 0, 573, 574, 3, 421, 210, 0, 574, 575, - 3, 433, 216, 0, 575, 72, 1, 0, 0, 0, 576, 577, 3, 397, 198, 0, 577, 578, - 3, 403, 201, 0, 578, 579, 3, 405, 202, 0, 579, 580, 3, 423, 211, 0, 580, - 581, 3, 429, 214, 0, 581, 582, 3, 403, 201, 0, 582, 74, 1, 0, 0, 0, 583, - 584, 3, 397, 198, 0, 584, 585, 3, 403, 201, 0, 585, 586, 3, 407, 203, 0, - 586, 587, 3, 411, 205, 0, 587, 588, 3, 421, 210, 0, 588, 76, 1, 0, 0, 0, - 589, 590, 3, 397, 198, 0, 590, 591, 3, 403, 201, 0, 591, 592, 3, 433, 216, - 0, 592, 593, 3, 439, 219, 0, 593, 594, 3, 403, 201, 0, 594, 595, 3, 403, - 201, 0, 595, 596, 3, 421, 210, 0, 596, 78, 1, 0, 0, 0, 597, 598, 3, 397, - 198, 0, 598, 599, 3, 443, 221, 0, 599, 80, 1, 0, 0, 0, 600, 601, 3, 399, - 199, 0, 601, 602, 3, 395, 197, 0, 602, 603, 3, 431, 215, 0, 603, 604, 3, - 399, 199, 0, 604, 605, 3, 395, 197, 0, 605, 606, 3, 401, 200, 0, 606, 607, - 3, 403, 201, 0, 607, 82, 1, 0, 0, 0, 608, 609, 3, 399, 199, 0, 609, 610, - 3, 395, 197, 0, 610, 611, 3, 431, 215, 0, 611, 612, 3, 403, 201, 0, 612, - 84, 1, 0, 0, 0, 613, 614, 3, 399, 199, 0, 614, 615, 3, 395, 197, 0, 615, - 616, 3, 431, 215, 0, 616, 617, 3, 433, 216, 0, 617, 86, 1, 0, 0, 0, 618, - 619, 3, 399, 199, 0, 619, 620, 3, 409, 204, 0, 620, 621, 3, 403, 201, 0, - 621, 622, 3, 399, 199, 0, 622, 623, 3, 415, 207, 0, 623, 88, 1, 0, 0, 0, - 624, 625, 3, 399, 199, 0, 625, 626, 3, 423, 211, 0, 626, 627, 3, 417, 208, - 0, 627, 628, 3, 417, 208, 0, 628, 629, 3, 395, 197, 0, 629, 630, 3, 433, - 216, 0, 630, 631, 3, 403, 201, 0, 631, 90, 1, 0, 0, 0, 632, 633, 3, 399, - 199, 0, 633, 634, 3, 423, 211, 0, 634, 635, 3, 417, 208, 0, 635, 636, 3, - 435, 217, 0, 636, 637, 3, 419, 209, 0, 637, 638, 3, 421, 210, 0, 638, 92, - 1, 0, 0, 0, 639, 640, 3, 399, 199, 0, 640, 641, 3, 423, 211, 0, 641, 642, - 3, 419, 209, 0, 642, 643, 3, 419, 209, 0, 643, 644, 3, 411, 205, 0, 644, - 645, 3, 433, 216, 0, 645, 94, 1, 0, 0, 0, 646, 647, 3, 399, 199, 0, 647, - 648, 3, 423, 211, 0, 648, 649, 3, 421, 210, 0, 649, 650, 3, 405, 202, 0, - 650, 651, 3, 417, 208, 0, 651, 652, 3, 411, 205, 0, 652, 653, 3, 399, 199, - 0, 653, 654, 3, 433, 216, 0, 654, 96, 1, 0, 0, 0, 655, 656, 3, 399, 199, - 0, 656, 657, 3, 423, 211, 0, 657, 658, 3, 421, 210, 0, 658, 659, 3, 431, - 215, 0, 659, 660, 3, 433, 216, 0, 660, 661, 3, 429, 214, 0, 661, 662, 3, - 395, 197, 0, 662, 663, 3, 411, 205, 0, 663, 664, 3, 421, 210, 0, 664, 665, - 3, 433, 216, 0, 665, 98, 1, 0, 0, 0, 666, 667, 3, 399, 199, 0, 667, 668, - 3, 429, 214, 0, 668, 669, 3, 403, 201, 0, 669, 670, 3, 395, 197, 0, 670, - 671, 3, 433, 216, 0, 671, 672, 3, 403, 201, 0, 672, 100, 1, 0, 0, 0, 673, - 674, 3, 399, 199, 0, 674, 675, 3, 429, 214, 0, 675, 676, 3, 423, 211, 0, - 676, 677, 3, 431, 215, 0, 677, 678, 3, 431, 215, 0, 678, 102, 1, 0, 0, - 0, 679, 680, 3, 399, 199, 0, 680, 681, 3, 435, 217, 0, 681, 682, 3, 429, - 214, 0, 682, 683, 3, 429, 214, 0, 683, 684, 3, 403, 201, 0, 684, 685, 3, - 421, 210, 0, 685, 686, 3, 433, 216, 0, 686, 687, 5, 95, 0, 0, 687, 688, - 3, 401, 200, 0, 688, 689, 3, 395, 197, 0, 689, 690, 3, 433, 216, 0, 690, - 691, 3, 403, 201, 0, 691, 104, 1, 0, 0, 0, 692, 693, 3, 399, 199, 0, 693, - 694, 3, 435, 217, 0, 694, 695, 3, 429, 214, 0, 695, 696, 3, 429, 214, 0, - 696, 697, 3, 403, 201, 0, 697, 698, 3, 421, 210, 0, 698, 699, 3, 433, 216, - 0, 699, 700, 5, 95, 0, 0, 700, 701, 3, 433, 216, 0, 701, 702, 3, 411, 205, - 0, 702, 703, 3, 419, 209, 0, 703, 704, 3, 403, 201, 0, 704, 106, 1, 0, - 0, 0, 705, 706, 3, 399, 199, 0, 706, 707, 3, 435, 217, 0, 707, 708, 3, - 429, 214, 0, 708, 709, 3, 429, 214, 0, 709, 710, 3, 403, 201, 0, 710, 711, - 3, 421, 210, 0, 711, 712, 3, 433, 216, 0, 712, 713, 5, 95, 0, 0, 713, 714, - 3, 433, 216, 0, 714, 715, 3, 411, 205, 0, 715, 716, 3, 419, 209, 0, 716, - 717, 3, 403, 201, 0, 717, 718, 3, 431, 215, 0, 718, 719, 3, 433, 216, 0, - 719, 720, 3, 395, 197, 0, 720, 721, 3, 419, 209, 0, 721, 722, 3, 425, 212, - 0, 722, 108, 1, 0, 0, 0, 723, 724, 3, 401, 200, 0, 724, 725, 3, 395, 197, - 0, 725, 726, 3, 433, 216, 0, 726, 727, 3, 395, 197, 0, 727, 728, 3, 397, - 198, 0, 728, 729, 3, 395, 197, 0, 729, 730, 3, 431, 215, 0, 730, 731, 3, - 403, 201, 0, 731, 110, 1, 0, 0, 0, 732, 733, 3, 401, 200, 0, 733, 734, - 3, 403, 201, 0, 734, 735, 3, 405, 202, 0, 735, 736, 3, 395, 197, 0, 736, - 737, 3, 435, 217, 0, 737, 738, 3, 417, 208, 0, 738, 739, 3, 433, 216, 0, - 739, 112, 1, 0, 0, 0, 740, 741, 3, 401, 200, 0, 741, 742, 3, 403, 201, - 0, 742, 743, 3, 405, 202, 0, 743, 744, 3, 403, 201, 0, 744, 745, 3, 429, - 214, 0, 745, 746, 3, 429, 214, 0, 746, 747, 3, 395, 197, 0, 747, 748, 3, - 397, 198, 0, 748, 749, 3, 417, 208, 0, 749, 750, 3, 403, 201, 0, 750, 114, - 1, 0, 0, 0, 751, 752, 3, 401, 200, 0, 752, 753, 3, 403, 201, 0, 753, 754, - 3, 405, 202, 0, 754, 755, 3, 403, 201, 0, 755, 756, 3, 429, 214, 0, 756, - 757, 3, 429, 214, 0, 757, 758, 3, 403, 201, 0, 758, 759, 3, 401, 200, 0, - 759, 116, 1, 0, 0, 0, 760, 761, 3, 401, 200, 0, 761, 762, 3, 403, 201, - 0, 762, 763, 3, 417, 208, 0, 763, 764, 3, 403, 201, 0, 764, 765, 3, 433, - 216, 0, 765, 766, 3, 403, 201, 0, 766, 118, 1, 0, 0, 0, 767, 768, 3, 401, - 200, 0, 768, 769, 3, 403, 201, 0, 769, 770, 3, 431, 215, 0, 770, 771, 3, - 399, 199, 0, 771, 120, 1, 0, 0, 0, 772, 773, 3, 401, 200, 0, 773, 774, - 3, 403, 201, 0, 774, 775, 3, 433, 216, 0, 775, 776, 3, 395, 197, 0, 776, - 777, 3, 399, 199, 0, 777, 778, 3, 409, 204, 0, 778, 122, 1, 0, 0, 0, 779, - 780, 3, 401, 200, 0, 780, 781, 3, 411, 205, 0, 781, 782, 3, 431, 215, 0, - 782, 783, 3, 433, 216, 0, 783, 784, 3, 411, 205, 0, 784, 785, 3, 421, 210, - 0, 785, 786, 3, 399, 199, 0, 786, 787, 3, 433, 216, 0, 787, 124, 1, 0, - 0, 0, 788, 789, 3, 401, 200, 0, 789, 790, 3, 429, 214, 0, 790, 791, 3, - 423, 211, 0, 791, 792, 3, 425, 212, 0, 792, 126, 1, 0, 0, 0, 793, 794, - 3, 403, 201, 0, 794, 795, 3, 395, 197, 0, 795, 796, 3, 399, 199, 0, 796, - 797, 3, 409, 204, 0, 797, 128, 1, 0, 0, 0, 798, 799, 3, 403, 201, 0, 799, - 800, 3, 417, 208, 0, 800, 801, 3, 431, 215, 0, 801, 802, 3, 403, 201, 0, - 802, 130, 1, 0, 0, 0, 803, 804, 3, 403, 201, 0, 804, 805, 3, 421, 210, - 0, 805, 806, 3, 401, 200, 0, 806, 132, 1, 0, 0, 0, 807, 808, 3, 403, 201, - 0, 808, 809, 3, 431, 215, 0, 809, 810, 3, 399, 199, 0, 810, 811, 3, 395, - 197, 0, 811, 812, 3, 425, 212, 0, 812, 813, 3, 403, 201, 0, 813, 134, 1, - 0, 0, 0, 814, 815, 3, 403, 201, 0, 815, 816, 3, 441, 220, 0, 816, 817, - 3, 399, 199, 0, 817, 818, 3, 403, 201, 0, 818, 819, 3, 425, 212, 0, 819, - 820, 3, 433, 216, 0, 820, 136, 1, 0, 0, 0, 821, 822, 3, 403, 201, 0, 822, - 823, 3, 441, 220, 0, 823, 824, 3, 399, 199, 0, 824, 825, 3, 417, 208, 0, - 825, 826, 3, 435, 217, 0, 826, 827, 3, 431, 215, 0, 827, 828, 3, 411, 205, - 0, 828, 829, 3, 437, 218, 0, 829, 830, 3, 403, 201, 0, 830, 138, 1, 0, - 0, 0, 831, 832, 3, 403, 201, 0, 832, 833, 3, 441, 220, 0, 833, 834, 3, - 411, 205, 0, 834, 835, 3, 431, 215, 0, 835, 836, 3, 433, 216, 0, 836, 837, - 3, 431, 215, 0, 837, 140, 1, 0, 0, 0, 838, 839, 3, 403, 201, 0, 839, 840, - 3, 441, 220, 0, 840, 841, 3, 425, 212, 0, 841, 842, 3, 417, 208, 0, 842, - 843, 3, 395, 197, 0, 843, 844, 3, 411, 205, 0, 844, 845, 3, 421, 210, 0, - 845, 142, 1, 0, 0, 0, 846, 847, 3, 405, 202, 0, 847, 848, 3, 395, 197, - 0, 848, 849, 3, 411, 205, 0, 849, 850, 3, 417, 208, 0, 850, 144, 1, 0, - 0, 0, 851, 852, 3, 405, 202, 0, 852, 853, 3, 423, 211, 0, 853, 854, 3, - 429, 214, 0, 854, 146, 1, 0, 0, 0, 855, 856, 3, 405, 202, 0, 856, 857, - 3, 423, 211, 0, 857, 858, 3, 429, 214, 0, 858, 859, 3, 403, 201, 0, 859, - 860, 3, 411, 205, 0, 860, 861, 3, 407, 203, 0, 861, 862, 3, 421, 210, 0, - 862, 148, 1, 0, 0, 0, 863, 864, 3, 405, 202, 0, 864, 865, 3, 429, 214, - 0, 865, 866, 3, 423, 211, 0, 866, 867, 3, 419, 209, 0, 867, 150, 1, 0, - 0, 0, 868, 869, 3, 405, 202, 0, 869, 870, 3, 435, 217, 0, 870, 871, 3, - 417, 208, 0, 871, 872, 3, 417, 208, 0, 872, 152, 1, 0, 0, 0, 873, 874, - 3, 407, 203, 0, 874, 875, 3, 417, 208, 0, 875, 876, 3, 423, 211, 0, 876, - 877, 3, 397, 198, 0, 877, 154, 1, 0, 0, 0, 878, 879, 3, 407, 203, 0, 879, - 880, 3, 429, 214, 0, 880, 881, 3, 423, 211, 0, 881, 882, 3, 435, 217, 0, - 882, 883, 3, 425, 212, 0, 883, 156, 1, 0, 0, 0, 884, 885, 3, 409, 204, - 0, 885, 886, 3, 395, 197, 0, 886, 887, 3, 437, 218, 0, 887, 888, 3, 411, - 205, 0, 888, 889, 3, 421, 210, 0, 889, 890, 3, 407, 203, 0, 890, 158, 1, - 0, 0, 0, 891, 892, 3, 411, 205, 0, 892, 893, 3, 405, 202, 0, 893, 160, - 1, 0, 0, 0, 894, 895, 3, 411, 205, 0, 895, 896, 3, 407, 203, 0, 896, 897, - 3, 421, 210, 0, 897, 898, 3, 423, 211, 0, 898, 899, 3, 429, 214, 0, 899, - 900, 3, 403, 201, 0, 900, 162, 1, 0, 0, 0, 901, 902, 3, 411, 205, 0, 902, - 903, 3, 419, 209, 0, 903, 904, 3, 419, 209, 0, 904, 905, 3, 403, 201, 0, - 905, 906, 3, 401, 200, 0, 906, 907, 3, 411, 205, 0, 907, 908, 3, 395, 197, - 0, 908, 909, 3, 433, 216, 0, 909, 910, 3, 403, 201, 0, 910, 164, 1, 0, - 0, 0, 911, 912, 3, 411, 205, 0, 912, 913, 3, 421, 210, 0, 913, 166, 1, - 0, 0, 0, 914, 915, 3, 411, 205, 0, 915, 916, 3, 421, 210, 0, 916, 917, - 3, 401, 200, 0, 917, 918, 3, 403, 201, 0, 918, 919, 3, 441, 220, 0, 919, - 168, 1, 0, 0, 0, 920, 921, 3, 411, 205, 0, 921, 922, 3, 421, 210, 0, 922, - 923, 3, 401, 200, 0, 923, 924, 3, 403, 201, 0, 924, 925, 3, 441, 220, 0, - 925, 926, 3, 403, 201, 0, 926, 927, 3, 401, 200, 0, 927, 170, 1, 0, 0, - 0, 928, 929, 3, 411, 205, 0, 929, 930, 3, 421, 210, 0, 930, 931, 3, 411, - 205, 0, 931, 932, 3, 433, 216, 0, 932, 933, 3, 411, 205, 0, 933, 934, 3, - 395, 197, 0, 934, 935, 3, 417, 208, 0, 935, 936, 3, 417, 208, 0, 936, 937, - 3, 443, 221, 0, 937, 172, 1, 0, 0, 0, 938, 939, 3, 411, 205, 0, 939, 940, - 3, 421, 210, 0, 940, 941, 3, 421, 210, 0, 941, 942, 3, 403, 201, 0, 942, - 943, 3, 429, 214, 0, 943, 174, 1, 0, 0, 0, 944, 945, 3, 411, 205, 0, 945, - 946, 3, 421, 210, 0, 946, 947, 3, 431, 215, 0, 947, 948, 3, 403, 201, 0, - 948, 949, 3, 429, 214, 0, 949, 950, 3, 433, 216, 0, 950, 176, 1, 0, 0, - 0, 951, 952, 3, 411, 205, 0, 952, 953, 3, 421, 210, 0, 953, 954, 3, 431, - 215, 0, 954, 955, 3, 433, 216, 0, 955, 956, 3, 403, 201, 0, 956, 957, 3, - 395, 197, 0, 957, 958, 3, 401, 200, 0, 958, 178, 1, 0, 0, 0, 959, 960, - 3, 411, 205, 0, 960, 961, 3, 421, 210, 0, 961, 962, 3, 433, 216, 0, 962, - 963, 3, 403, 201, 0, 963, 964, 3, 429, 214, 0, 964, 965, 3, 431, 215, 0, - 965, 966, 3, 403, 201, 0, 966, 967, 3, 399, 199, 0, 967, 968, 3, 433, 216, - 0, 968, 180, 1, 0, 0, 0, 969, 970, 3, 411, 205, 0, 970, 971, 3, 421, 210, - 0, 971, 972, 3, 433, 216, 0, 972, 973, 3, 423, 211, 0, 973, 182, 1, 0, - 0, 0, 974, 975, 3, 411, 205, 0, 975, 976, 3, 431, 215, 0, 976, 184, 1, - 0, 0, 0, 977, 978, 3, 411, 205, 0, 978, 979, 3, 431, 215, 0, 979, 980, - 3, 421, 210, 0, 980, 981, 3, 435, 217, 0, 981, 982, 3, 417, 208, 0, 982, - 983, 3, 417, 208, 0, 983, 186, 1, 0, 0, 0, 984, 985, 3, 413, 206, 0, 985, - 986, 3, 423, 211, 0, 986, 987, 3, 411, 205, 0, 987, 988, 3, 421, 210, 0, - 988, 188, 1, 0, 0, 0, 989, 990, 3, 415, 207, 0, 990, 991, 3, 403, 201, - 0, 991, 992, 3, 443, 221, 0, 992, 190, 1, 0, 0, 0, 993, 994, 3, 417, 208, - 0, 994, 995, 3, 403, 201, 0, 995, 996, 3, 405, 202, 0, 996, 997, 3, 433, - 216, 0, 997, 192, 1, 0, 0, 0, 998, 999, 3, 417, 208, 0, 999, 1000, 3, 411, - 205, 0, 1000, 1001, 3, 415, 207, 0, 1001, 1002, 3, 403, 201, 0, 1002, 194, - 1, 0, 0, 0, 1003, 1004, 3, 417, 208, 0, 1004, 1005, 3, 411, 205, 0, 1005, - 1006, 3, 419, 209, 0, 1006, 1007, 3, 411, 205, 0, 1007, 1008, 3, 433, 216, - 0, 1008, 196, 1, 0, 0, 0, 1009, 1010, 3, 419, 209, 0, 1010, 1011, 3, 395, - 197, 0, 1011, 1012, 3, 433, 216, 0, 1012, 1013, 3, 399, 199, 0, 1013, 1014, - 3, 409, 204, 0, 1014, 198, 1, 0, 0, 0, 1015, 1016, 3, 421, 210, 0, 1016, - 1017, 3, 395, 197, 0, 1017, 1018, 3, 433, 216, 0, 1018, 1019, 3, 435, 217, - 0, 1019, 1020, 3, 429, 214, 0, 1020, 1021, 3, 395, 197, 0, 1021, 1022, - 3, 417, 208, 0, 1022, 200, 1, 0, 0, 0, 1023, 1024, 3, 421, 210, 0, 1024, - 1025, 3, 423, 211, 0, 1025, 202, 1, 0, 0, 0, 1026, 1027, 3, 421, 210, 0, - 1027, 1028, 3, 423, 211, 0, 1028, 1029, 3, 433, 216, 0, 1029, 204, 1, 0, - 0, 0, 1030, 1031, 3, 421, 210, 0, 1031, 1032, 3, 423, 211, 0, 1032, 1033, - 3, 433, 216, 0, 1033, 1034, 3, 421, 210, 0, 1034, 1035, 3, 435, 217, 0, - 1035, 1036, 3, 417, 208, 0, 1036, 1037, 3, 417, 208, 0, 1037, 206, 1, 0, - 0, 0, 1038, 1039, 3, 421, 210, 0, 1039, 1040, 3, 435, 217, 0, 1040, 1041, - 3, 417, 208, 0, 1041, 1042, 3, 417, 208, 0, 1042, 208, 1, 0, 0, 0, 1043, - 1044, 3, 423, 211, 0, 1044, 1045, 3, 405, 202, 0, 1045, 210, 1, 0, 0, 0, - 1046, 1047, 3, 423, 211, 0, 1047, 1048, 3, 405, 202, 0, 1048, 1049, 3, - 405, 202, 0, 1049, 1050, 3, 431, 215, 0, 1050, 1051, 3, 403, 201, 0, 1051, - 1052, 3, 433, 216, 0, 1052, 212, 1, 0, 0, 0, 1053, 1054, 3, 423, 211, 0, - 1054, 1055, 3, 421, 210, 0, 1055, 214, 1, 0, 0, 0, 1056, 1057, 3, 423, - 211, 0, 1057, 1058, 3, 429, 214, 0, 1058, 216, 1, 0, 0, 0, 1059, 1060, - 3, 423, 211, 0, 1060, 1061, 3, 429, 214, 0, 1061, 1062, 3, 401, 200, 0, - 1062, 1063, 3, 403, 201, 0, 1063, 1064, 3, 429, 214, 0, 1064, 218, 1, 0, - 0, 0, 1065, 1066, 3, 423, 211, 0, 1066, 1067, 3, 435, 217, 0, 1067, 1068, - 3, 433, 216, 0, 1068, 1069, 3, 403, 201, 0, 1069, 1070, 3, 429, 214, 0, - 1070, 220, 1, 0, 0, 0, 1071, 1072, 3, 425, 212, 0, 1072, 1073, 3, 417, - 208, 0, 1073, 1074, 3, 395, 197, 0, 1074, 1075, 3, 421, 210, 0, 1075, 222, - 1, 0, 0, 0, 1076, 1077, 3, 425, 212, 0, 1077, 1078, 3, 429, 214, 0, 1078, - 1079, 3, 395, 197, 0, 1079, 1080, 3, 407, 203, 0, 1080, 1081, 3, 419, 209, - 0, 1081, 1082, 3, 395, 197, 0, 1082, 224, 1, 0, 0, 0, 1083, 1084, 3, 425, - 212, 0, 1084, 1085, 3, 429, 214, 0, 1085, 1086, 3, 411, 205, 0, 1086, 1087, - 3, 419, 209, 0, 1087, 1088, 3, 395, 197, 0, 1088, 1089, 3, 429, 214, 0, - 1089, 1090, 3, 443, 221, 0, 1090, 226, 1, 0, 0, 0, 1091, 1092, 3, 427, - 213, 0, 1092, 1093, 3, 435, 217, 0, 1093, 1094, 3, 403, 201, 0, 1094, 1095, - 3, 429, 214, 0, 1095, 1096, 3, 443, 221, 0, 1096, 228, 1, 0, 0, 0, 1097, - 1098, 3, 429, 214, 0, 1098, 1099, 3, 395, 197, 0, 1099, 1100, 3, 411, 205, - 0, 1100, 1101, 3, 431, 215, 0, 1101, 1102, 3, 403, 201, 0, 1102, 230, 1, - 0, 0, 0, 1103, 1104, 3, 429, 214, 0, 1104, 1105, 3, 403, 201, 0, 1105, - 1106, 3, 399, 199, 0, 1106, 1107, 3, 435, 217, 0, 1107, 1108, 3, 429, 214, - 0, 1108, 1109, 3, 431, 215, 0, 1109, 1110, 3, 411, 205, 0, 1110, 1111, - 3, 437, 218, 0, 1111, 1112, 3, 403, 201, 0, 1112, 232, 1, 0, 0, 0, 1113, - 1114, 3, 429, 214, 0, 1114, 1115, 3, 403, 201, 0, 1115, 1116, 3, 405, 202, - 0, 1116, 1117, 3, 403, 201, 0, 1117, 1118, 3, 429, 214, 0, 1118, 1119, - 3, 403, 201, 0, 1119, 1120, 3, 421, 210, 0, 1120, 1121, 3, 399, 199, 0, - 1121, 1122, 3, 403, 201, 0, 1122, 1123, 3, 431, 215, 0, 1123, 234, 1, 0, - 0, 0, 1124, 1125, 3, 429, 214, 0, 1125, 1126, 3, 403, 201, 0, 1126, 1127, - 3, 407, 203, 0, 1127, 1128, 3, 403, 201, 0, 1128, 1129, 3, 441, 220, 0, - 1129, 1130, 3, 425, 212, 0, 1130, 236, 1, 0, 0, 0, 1131, 1132, 3, 429, - 214, 0, 1132, 1133, 3, 403, 201, 0, 1133, 1134, 3, 411, 205, 0, 1134, 1135, - 3, 421, 210, 0, 1135, 1136, 3, 401, 200, 0, 1136, 1137, 3, 403, 201, 0, - 1137, 1138, 3, 441, 220, 0, 1138, 238, 1, 0, 0, 0, 1139, 1140, 3, 429, - 214, 0, 1140, 1141, 3, 403, 201, 0, 1141, 1142, 3, 417, 208, 0, 1142, 1143, - 3, 403, 201, 0, 1143, 1144, 3, 395, 197, 0, 1144, 1145, 3, 431, 215, 0, - 1145, 1146, 3, 403, 201, 0, 1146, 240, 1, 0, 0, 0, 1147, 1148, 3, 429, - 214, 0, 1148, 1149, 3, 403, 201, 0, 1149, 1150, 3, 421, 210, 0, 1150, 1151, - 3, 395, 197, 0, 1151, 1152, 3, 419, 209, 0, 1152, 1153, 3, 403, 201, 0, - 1153, 242, 1, 0, 0, 0, 1154, 1155, 3, 429, 214, 0, 1155, 1156, 3, 403, - 201, 0, 1156, 1157, 3, 425, 212, 0, 1157, 1158, 3, 417, 208, 0, 1158, 1159, - 3, 395, 197, 0, 1159, 1160, 3, 399, 199, 0, 1160, 1161, 3, 403, 201, 0, - 1161, 244, 1, 0, 0, 0, 1162, 1163, 3, 429, 214, 0, 1163, 1164, 3, 403, - 201, 0, 1164, 1165, 3, 431, 215, 0, 1165, 1166, 3, 433, 216, 0, 1166, 1167, - 3, 429, 214, 0, 1167, 1168, 3, 411, 205, 0, 1168, 1169, 3, 399, 199, 0, - 1169, 1170, 3, 433, 216, 0, 1170, 246, 1, 0, 0, 0, 1171, 1172, 3, 429, - 214, 0, 1172, 1173, 3, 403, 201, 0, 1173, 1174, 3, 433, 216, 0, 1174, 1175, - 3, 435, 217, 0, 1175, 1176, 3, 429, 214, 0, 1176, 1177, 3, 421, 210, 0, - 1177, 1178, 3, 411, 205, 0, 1178, 1179, 3, 421, 210, 0, 1179, 1180, 3, - 407, 203, 0, 1180, 248, 1, 0, 0, 0, 1181, 1182, 3, 429, 214, 0, 1182, 1183, - 3, 411, 205, 0, 1183, 1184, 3, 407, 203, 0, 1184, 1185, 3, 409, 204, 0, - 1185, 1186, 3, 433, 216, 0, 1186, 250, 1, 0, 0, 0, 1187, 1188, 3, 429, - 214, 0, 1188, 1189, 3, 423, 211, 0, 1189, 1190, 3, 417, 208, 0, 1190, 1191, - 3, 417, 208, 0, 1191, 1192, 3, 397, 198, 0, 1192, 1193, 3, 395, 197, 0, - 1193, 1194, 3, 399, 199, 0, 1194, 1195, 3, 415, 207, 0, 1195, 252, 1, 0, - 0, 0, 1196, 1197, 3, 429, 214, 0, 1197, 1198, 3, 423, 211, 0, 1198, 1199, - 3, 439, 219, 0, 1199, 254, 1, 0, 0, 0, 1200, 1201, 3, 429, 214, 0, 1201, - 1202, 3, 423, 211, 0, 1202, 1203, 3, 439, 219, 0, 1203, 1204, 3, 431, 215, - 0, 1204, 256, 1, 0, 0, 0, 1205, 1206, 3, 431, 215, 0, 1206, 1207, 3, 395, - 197, 0, 1207, 1208, 3, 437, 218, 0, 1208, 1209, 3, 403, 201, 0, 1209, 1210, - 3, 425, 212, 0, 1210, 1211, 3, 423, 211, 0, 1211, 1212, 3, 411, 205, 0, - 1212, 1213, 3, 421, 210, 0, 1213, 1214, 3, 433, 216, 0, 1214, 258, 1, 0, - 0, 0, 1215, 1216, 3, 431, 215, 0, 1216, 1217, 3, 403, 201, 0, 1217, 1218, - 3, 417, 208, 0, 1218, 1219, 3, 403, 201, 0, 1219, 1220, 3, 399, 199, 0, - 1220, 1221, 3, 433, 216, 0, 1221, 260, 1, 0, 0, 0, 1222, 1223, 3, 431, - 215, 0, 1223, 1224, 3, 403, 201, 0, 1224, 1225, 3, 433, 216, 0, 1225, 262, - 1, 0, 0, 0, 1226, 1227, 3, 431, 215, 0, 1227, 1228, 3, 433, 216, 0, 1228, - 1229, 3, 429, 214, 0, 1229, 1230, 3, 411, 205, 0, 1230, 1231, 3, 399, 199, - 0, 1231, 1232, 3, 433, 216, 0, 1232, 264, 1, 0, 0, 0, 1233, 1234, 3, 433, - 216, 0, 1234, 1235, 3, 395, 197, 0, 1235, 1236, 3, 397, 198, 0, 1236, 1237, - 3, 417, 208, 0, 1237, 1238, 3, 403, 201, 0, 1238, 266, 1, 0, 0, 0, 1239, - 1240, 3, 433, 216, 0, 1240, 1241, 3, 403, 201, 0, 1241, 1242, 3, 419, 209, - 0, 1242, 1243, 3, 425, 212, 0, 1243, 268, 1, 0, 0, 0, 1244, 1245, 3, 433, - 216, 0, 1245, 1246, 3, 403, 201, 0, 1246, 1247, 3, 419, 209, 0, 1247, 1248, - 3, 425, 212, 0, 1248, 1249, 3, 423, 211, 0, 1249, 1250, 3, 429, 214, 0, - 1250, 1251, 3, 395, 197, 0, 1251, 1252, 3, 429, 214, 0, 1252, 1253, 3, - 443, 221, 0, 1253, 270, 1, 0, 0, 0, 1254, 1255, 3, 433, 216, 0, 1255, 1256, - 3, 409, 204, 0, 1256, 1257, 3, 403, 201, 0, 1257, 1258, 3, 421, 210, 0, - 1258, 272, 1, 0, 0, 0, 1259, 1260, 3, 433, 216, 0, 1260, 1261, 3, 423, - 211, 0, 1261, 274, 1, 0, 0, 0, 1262, 1263, 3, 433, 216, 0, 1263, 1264, - 3, 429, 214, 0, 1264, 1265, 3, 395, 197, 0, 1265, 1266, 3, 421, 210, 0, - 1266, 1267, 3, 431, 215, 0, 1267, 1268, 3, 395, 197, 0, 1268, 1269, 3, - 399, 199, 0, 1269, 1270, 3, 433, 216, 0, 1270, 1271, 3, 411, 205, 0, 1271, - 1272, 3, 423, 211, 0, 1272, 1273, 3, 421, 210, 0, 1273, 276, 1, 0, 0, 0, - 1274, 1275, 3, 433, 216, 0, 1275, 1276, 3, 429, 214, 0, 1276, 1277, 3, - 411, 205, 0, 1277, 1278, 3, 407, 203, 0, 1278, 1279, 3, 407, 203, 0, 1279, - 1280, 3, 403, 201, 0, 1280, 1281, 3, 429, 214, 0, 1281, 278, 1, 0, 0, 0, - 1282, 1283, 3, 435, 217, 0, 1283, 1284, 3, 421, 210, 0, 1284, 1285, 3, - 411, 205, 0, 1285, 1286, 3, 423, 211, 0, 1286, 1287, 3, 421, 210, 0, 1287, - 280, 1, 0, 0, 0, 1288, 1289, 3, 435, 217, 0, 1289, 1290, 3, 421, 210, 0, - 1290, 1291, 3, 411, 205, 0, 1291, 1292, 3, 427, 213, 0, 1292, 1293, 3, - 435, 217, 0, 1293, 1294, 3, 403, 201, 0, 1294, 282, 1, 0, 0, 0, 1295, 1296, - 3, 435, 217, 0, 1296, 1297, 3, 425, 212, 0, 1297, 1298, 3, 401, 200, 0, - 1298, 1299, 3, 395, 197, 0, 1299, 1300, 3, 433, 216, 0, 1300, 1301, 3, - 403, 201, 0, 1301, 284, 1, 0, 0, 0, 1302, 1303, 3, 435, 217, 0, 1303, 1304, - 3, 431, 215, 0, 1304, 1305, 3, 411, 205, 0, 1305, 1306, 3, 421, 210, 0, - 1306, 1307, 3, 407, 203, 0, 1307, 286, 1, 0, 0, 0, 1308, 1309, 3, 437, - 218, 0, 1309, 1310, 3, 395, 197, 0, 1310, 1311, 3, 399, 199, 0, 1311, 1312, - 3, 435, 217, 0, 1312, 1313, 3, 435, 217, 0, 1313, 1314, 3, 419, 209, 0, - 1314, 288, 1, 0, 0, 0, 1315, 1316, 3, 437, 218, 0, 1316, 1317, 3, 395, - 197, 0, 1317, 1318, 3, 417, 208, 0, 1318, 1319, 3, 435, 217, 0, 1319, 1320, - 3, 403, 201, 0, 1320, 1321, 3, 431, 215, 0, 1321, 290, 1, 0, 0, 0, 1322, - 1323, 3, 437, 218, 0, 1323, 1324, 3, 411, 205, 0, 1324, 1325, 3, 403, 201, - 0, 1325, 1326, 3, 439, 219, 0, 1326, 292, 1, 0, 0, 0, 1327, 1328, 3, 437, - 218, 0, 1328, 1329, 3, 411, 205, 0, 1329, 1330, 3, 429, 214, 0, 1330, 1331, - 3, 433, 216, 0, 1331, 1332, 3, 435, 217, 0, 1332, 1333, 3, 395, 197, 0, - 1333, 1334, 3, 417, 208, 0, 1334, 294, 1, 0, 0, 0, 1335, 1336, 3, 439, - 219, 0, 1336, 1337, 3, 409, 204, 0, 1337, 1338, 3, 403, 201, 0, 1338, 1339, - 3, 421, 210, 0, 1339, 296, 1, 0, 0, 0, 1340, 1341, 3, 439, 219, 0, 1341, - 1342, 3, 409, 204, 0, 1342, 1343, 3, 403, 201, 0, 1343, 1344, 3, 429, 214, - 0, 1344, 1345, 3, 403, 201, 0, 1345, 298, 1, 0, 0, 0, 1346, 1347, 3, 439, - 219, 0, 1347, 1348, 3, 411, 205, 0, 1348, 1349, 3, 433, 216, 0, 1349, 1350, - 3, 409, 204, 0, 1350, 300, 1, 0, 0, 0, 1351, 1352, 3, 439, 219, 0, 1352, - 1353, 3, 411, 205, 0, 1353, 1354, 3, 433, 216, 0, 1354, 1355, 3, 409, 204, - 0, 1355, 1356, 3, 423, 211, 0, 1356, 1357, 3, 435, 217, 0, 1357, 1358, - 3, 433, 216, 0, 1358, 302, 1, 0, 0, 0, 1359, 1360, 3, 405, 202, 0, 1360, - 1361, 3, 411, 205, 0, 1361, 1362, 3, 429, 214, 0, 1362, 1363, 3, 431, 215, - 0, 1363, 1364, 3, 433, 216, 0, 1364, 1365, 5, 95, 0, 0, 1365, 1366, 3, - 437, 218, 0, 1366, 1367, 3, 395, 197, 0, 1367, 1368, 3, 417, 208, 0, 1368, - 1369, 3, 435, 217, 0, 1369, 1370, 3, 403, 201, 0, 1370, 304, 1, 0, 0, 0, - 1371, 1372, 3, 423, 211, 0, 1372, 1373, 3, 437, 218, 0, 1373, 1374, 3, - 403, 201, 0, 1374, 1375, 3, 429, 214, 0, 1375, 306, 1, 0, 0, 0, 1376, 1377, - 3, 425, 212, 0, 1377, 1378, 3, 395, 197, 0, 1378, 1379, 3, 429, 214, 0, - 1379, 1380, 3, 433, 216, 0, 1380, 1381, 3, 411, 205, 0, 1381, 1382, 3, - 433, 216, 0, 1382, 1383, 3, 411, 205, 0, 1383, 1384, 3, 423, 211, 0, 1384, - 1385, 3, 421, 210, 0, 1385, 308, 1, 0, 0, 0, 1386, 1387, 3, 429, 214, 0, - 1387, 1388, 3, 395, 197, 0, 1388, 1389, 3, 421, 210, 0, 1389, 1390, 3, - 407, 203, 0, 1390, 1391, 3, 403, 201, 0, 1391, 310, 1, 0, 0, 0, 1392, 1393, - 3, 425, 212, 0, 1393, 1394, 3, 429, 214, 0, 1394, 1395, 3, 403, 201, 0, - 1395, 1396, 3, 399, 199, 0, 1396, 1397, 3, 403, 201, 0, 1397, 1398, 3, - 401, 200, 0, 1398, 1399, 3, 411, 205, 0, 1399, 1400, 3, 421, 210, 0, 1400, - 1401, 3, 407, 203, 0, 1401, 312, 1, 0, 0, 0, 1402, 1403, 3, 435, 217, 0, - 1403, 1404, 3, 421, 210, 0, 1404, 1405, 3, 397, 198, 0, 1405, 1406, 3, - 423, 211, 0, 1406, 1407, 3, 435, 217, 0, 1407, 1408, 3, 421, 210, 0, 1408, - 1409, 3, 401, 200, 0, 1409, 1410, 3, 403, 201, 0, 1410, 1411, 3, 401, 200, - 0, 1411, 314, 1, 0, 0, 0, 1412, 1413, 3, 399, 199, 0, 1413, 1414, 3, 435, - 217, 0, 1414, 1415, 3, 429, 214, 0, 1415, 1416, 3, 429, 214, 0, 1416, 1417, - 3, 403, 201, 0, 1417, 1418, 3, 421, 210, 0, 1418, 1419, 3, 433, 216, 0, - 1419, 316, 1, 0, 0, 0, 1420, 1421, 3, 405, 202, 0, 1421, 1422, 3, 423, - 211, 0, 1422, 1423, 3, 417, 208, 0, 1423, 1424, 3, 417, 208, 0, 1424, 1425, - 3, 423, 211, 0, 1425, 1426, 3, 439, 219, 0, 1426, 1427, 3, 411, 205, 0, - 1427, 1428, 3, 421, 210, 0, 1428, 1429, 3, 407, 203, 0, 1429, 318, 1, 0, - 0, 0, 1430, 1431, 3, 399, 199, 0, 1431, 1432, 3, 435, 217, 0, 1432, 1433, - 3, 419, 209, 0, 1433, 1434, 3, 403, 201, 0, 1434, 1435, 5, 95, 0, 0, 1435, - 1436, 3, 401, 200, 0, 1436, 1437, 3, 411, 205, 0, 1437, 1438, 3, 431, 215, - 0, 1438, 1439, 3, 433, 216, 0, 1439, 320, 1, 0, 0, 0, 1440, 1441, 3, 401, - 200, 0, 1441, 1442, 3, 403, 201, 0, 1442, 1443, 3, 421, 210, 0, 1443, 1444, - 3, 431, 215, 0, 1444, 1445, 3, 403, 201, 0, 1445, 1446, 5, 95, 0, 0, 1446, - 1447, 3, 429, 214, 0, 1447, 1448, 3, 395, 197, 0, 1448, 1449, 3, 421, 210, - 0, 1449, 1450, 3, 415, 207, 0, 1450, 322, 1, 0, 0, 0, 1451, 1452, 3, 417, - 208, 0, 1452, 1453, 3, 395, 197, 0, 1453, 1454, 3, 407, 203, 0, 1454, 324, - 1, 0, 0, 0, 1455, 1456, 3, 417, 208, 0, 1456, 1457, 3, 395, 197, 0, 1457, - 1458, 3, 431, 215, 0, 1458, 1459, 3, 433, 216, 0, 1459, 1460, 5, 95, 0, - 0, 1460, 1461, 3, 437, 218, 0, 1461, 1462, 3, 395, 197, 0, 1462, 1463, - 3, 417, 208, 0, 1463, 1464, 3, 435, 217, 0, 1464, 1465, 3, 403, 201, 0, - 1465, 326, 1, 0, 0, 0, 1466, 1467, 3, 417, 208, 0, 1467, 1468, 3, 403, - 201, 0, 1468, 1469, 3, 395, 197, 0, 1469, 1470, 3, 401, 200, 0, 1470, 328, - 1, 0, 0, 0, 1471, 1472, 3, 421, 210, 0, 1472, 1473, 3, 433, 216, 0, 1473, - 1474, 3, 409, 204, 0, 1474, 1475, 5, 95, 0, 0, 1475, 1476, 3, 437, 218, - 0, 1476, 1477, 3, 395, 197, 0, 1477, 1478, 3, 417, 208, 0, 1478, 1479, - 3, 435, 217, 0, 1479, 1480, 3, 403, 201, 0, 1480, 330, 1, 0, 0, 0, 1481, - 1482, 3, 421, 210, 0, 1482, 1483, 3, 433, 216, 0, 1483, 1484, 3, 411, 205, - 0, 1484, 1485, 3, 417, 208, 0, 1485, 1486, 3, 403, 201, 0, 1486, 332, 1, - 0, 0, 0, 1487, 1488, 3, 425, 212, 0, 1488, 1489, 3, 403, 201, 0, 1489, - 1490, 3, 429, 214, 0, 1490, 1491, 3, 399, 199, 0, 1491, 1492, 3, 403, 201, - 0, 1492, 1493, 3, 421, 210, 0, 1493, 1494, 3, 433, 216, 0, 1494, 1495, - 5, 95, 0, 0, 1495, 1496, 3, 429, 214, 0, 1496, 1497, 3, 395, 197, 0, 1497, - 1498, 3, 421, 210, 0, 1498, 1499, 3, 415, 207, 0, 1499, 334, 1, 0, 0, 0, - 1500, 1501, 3, 429, 214, 0, 1501, 1502, 3, 395, 197, 0, 1502, 1503, 3, - 421, 210, 0, 1503, 1504, 3, 415, 207, 0, 1504, 336, 1, 0, 0, 0, 1505, 1506, - 3, 429, 214, 0, 1506, 1507, 3, 423, 211, 0, 1507, 1508, 3, 439, 219, 0, - 1508, 1509, 5, 95, 0, 0, 1509, 1510, 3, 421, 210, 0, 1510, 1511, 3, 435, - 217, 0, 1511, 1512, 3, 419, 209, 0, 1512, 1513, 3, 397, 198, 0, 1513, 1514, - 3, 403, 201, 0, 1514, 1515, 3, 429, 214, 0, 1515, 338, 1, 0, 0, 0, 1516, - 1517, 3, 407, 203, 0, 1517, 1518, 3, 403, 201, 0, 1518, 1519, 3, 421, 210, - 0, 1519, 1520, 3, 403, 201, 0, 1520, 1521, 3, 429, 214, 0, 1521, 1522, - 3, 395, 197, 0, 1522, 1523, 3, 433, 216, 0, 1523, 1524, 3, 403, 201, 0, - 1524, 1525, 3, 401, 200, 0, 1525, 340, 1, 0, 0, 0, 1526, 1527, 3, 395, - 197, 0, 1527, 1528, 3, 417, 208, 0, 1528, 1529, 3, 439, 219, 0, 1529, 1530, - 3, 395, 197, 0, 1530, 1531, 3, 443, 221, 0, 1531, 1532, 3, 431, 215, 0, - 1532, 342, 1, 0, 0, 0, 1533, 1534, 3, 431, 215, 0, 1534, 1535, 3, 433, - 216, 0, 1535, 1536, 3, 423, 211, 0, 1536, 1537, 3, 429, 214, 0, 1537, 1538, - 3, 403, 201, 0, 1538, 1539, 3, 401, 200, 0, 1539, 344, 1, 0, 0, 0, 1540, - 1541, 3, 433, 216, 0, 1541, 1542, 3, 429, 214, 0, 1542, 1543, 3, 435, 217, - 0, 1543, 1544, 3, 403, 201, 0, 1544, 346, 1, 0, 0, 0, 1545, 1546, 3, 405, - 202, 0, 1546, 1547, 3, 395, 197, 0, 1547, 1548, 3, 417, 208, 0, 1548, 1549, - 3, 431, 215, 0, 1549, 1550, 3, 403, 201, 0, 1550, 348, 1, 0, 0, 0, 1551, - 1552, 3, 439, 219, 0, 1552, 1553, 3, 411, 205, 0, 1553, 1554, 3, 421, 210, - 0, 1554, 1555, 3, 401, 200, 0, 1555, 1556, 3, 423, 211, 0, 1556, 1557, - 3, 439, 219, 0, 1557, 350, 1, 0, 0, 0, 1558, 1559, 3, 421, 210, 0, 1559, - 1560, 3, 435, 217, 0, 1560, 1561, 3, 417, 208, 0, 1561, 1562, 3, 417, 208, - 0, 1562, 1563, 3, 431, 215, 0, 1563, 352, 1, 0, 0, 0, 1564, 1565, 3, 405, - 202, 0, 1565, 1566, 3, 411, 205, 0, 1566, 1567, 3, 429, 214, 0, 1567, 1568, - 3, 431, 215, 0, 1568, 1569, 3, 433, 216, 0, 1569, 354, 1, 0, 0, 0, 1570, - 1571, 3, 417, 208, 0, 1571, 1572, 3, 395, 197, 0, 1572, 1573, 3, 431, 215, - 0, 1573, 1574, 3, 433, 216, 0, 1574, 356, 1, 0, 0, 0, 1575, 1576, 3, 405, - 202, 0, 1576, 1577, 3, 411, 205, 0, 1577, 1578, 3, 417, 208, 0, 1578, 1579, - 3, 433, 216, 0, 1579, 1580, 3, 403, 201, 0, 1580, 1581, 3, 429, 214, 0, - 1581, 358, 1, 0, 0, 0, 1582, 1583, 3, 407, 203, 0, 1583, 1584, 3, 429, - 214, 0, 1584, 1585, 3, 423, 211, 0, 1585, 1586, 3, 435, 217, 0, 1586, 1587, - 3, 425, 212, 0, 1587, 1588, 3, 431, 215, 0, 1588, 360, 1, 0, 0, 0, 1589, - 1590, 3, 403, 201, 0, 1590, 1591, 3, 441, 220, 0, 1591, 1592, 3, 399, 199, - 0, 1592, 1593, 3, 417, 208, 0, 1593, 1594, 3, 435, 217, 0, 1594, 1595, - 3, 401, 200, 0, 1595, 1596, 3, 403, 201, 0, 1596, 362, 1, 0, 0, 0, 1597, - 1598, 3, 433, 216, 0, 1598, 1599, 3, 411, 205, 0, 1599, 1600, 3, 403, 201, - 0, 1600, 1601, 3, 431, 215, 0, 1601, 364, 1, 0, 0, 0, 1602, 1603, 3, 423, - 211, 0, 1603, 1604, 3, 433, 216, 0, 1604, 1605, 3, 409, 204, 0, 1605, 1606, - 3, 403, 201, 0, 1606, 1607, 3, 429, 214, 0, 1607, 1608, 3, 431, 215, 0, - 1608, 366, 1, 0, 0, 0, 1609, 1610, 3, 401, 200, 0, 1610, 1611, 3, 423, - 211, 0, 1611, 368, 1, 0, 0, 0, 1612, 1613, 3, 421, 210, 0, 1613, 1614, - 3, 423, 211, 0, 1614, 1615, 3, 433, 216, 0, 1615, 1616, 3, 409, 204, 0, - 1616, 1617, 3, 411, 205, 0, 1617, 1618, 3, 421, 210, 0, 1618, 1619, 3, - 407, 203, 0, 1619, 370, 1, 0, 0, 0, 1620, 1626, 5, 34, 0, 0, 1621, 1625, - 8, 0, 0, 0, 1622, 1623, 5, 34, 0, 0, 1623, 1625, 5, 34, 0, 0, 1624, 1621, - 1, 0, 0, 0, 1624, 1622, 1, 0, 0, 0, 1625, 1628, 1, 0, 0, 0, 1626, 1624, - 1, 0, 0, 0, 1626, 1627, 1, 0, 0, 0, 1627, 1629, 1, 0, 0, 0, 1628, 1626, - 1, 0, 0, 0, 1629, 1656, 5, 34, 0, 0, 1630, 1636, 5, 96, 0, 0, 1631, 1635, - 8, 1, 0, 0, 1632, 1633, 5, 96, 0, 0, 1633, 1635, 5, 96, 0, 0, 1634, 1631, - 1, 0, 0, 0, 1634, 1632, 1, 0, 0, 0, 1635, 1638, 1, 0, 0, 0, 1636, 1634, - 1, 0, 0, 0, 1636, 1637, 1, 0, 0, 0, 1637, 1639, 1, 0, 0, 0, 1638, 1636, - 1, 0, 0, 0, 1639, 1656, 5, 96, 0, 0, 1640, 1644, 5, 91, 0, 0, 1641, 1643, - 8, 2, 0, 0, 1642, 1641, 1, 0, 0, 0, 1643, 1646, 1, 0, 0, 0, 1644, 1642, - 1, 0, 0, 0, 1644, 1645, 1, 0, 0, 0, 1645, 1647, 1, 0, 0, 0, 1646, 1644, - 1, 0, 0, 0, 1647, 1656, 5, 93, 0, 0, 1648, 1652, 7, 3, 0, 0, 1649, 1651, - 7, 4, 0, 0, 1650, 1649, 1, 0, 0, 0, 1651, 1654, 1, 0, 0, 0, 1652, 1650, - 1, 0, 0, 0, 1652, 1653, 1, 0, 0, 0, 1653, 1656, 1, 0, 0, 0, 1654, 1652, - 1, 0, 0, 0, 1655, 1620, 1, 0, 0, 0, 1655, 1630, 1, 0, 0, 0, 1655, 1640, - 1, 0, 0, 0, 1655, 1648, 1, 0, 0, 0, 1656, 372, 1, 0, 0, 0, 1657, 1659, - 3, 393, 196, 0, 1658, 1657, 1, 0, 0, 0, 1659, 1660, 1, 0, 0, 0, 1660, 1658, - 1, 0, 0, 0, 1660, 1661, 1, 0, 0, 0, 1661, 1669, 1, 0, 0, 0, 1662, 1666, - 5, 46, 0, 0, 1663, 1665, 3, 393, 196, 0, 1664, 1663, 1, 0, 0, 0, 1665, - 1668, 1, 0, 0, 0, 1666, 1664, 1, 0, 0, 0, 1666, 1667, 1, 0, 0, 0, 1667, - 1670, 1, 0, 0, 0, 1668, 1666, 1, 0, 0, 0, 1669, 1662, 1, 0, 0, 0, 1669, - 1670, 1, 0, 0, 0, 1670, 1678, 1, 0, 0, 0, 1671, 1673, 5, 46, 0, 0, 1672, - 1674, 3, 393, 196, 0, 1673, 1672, 1, 0, 0, 0, 1674, 1675, 1, 0, 0, 0, 1675, - 1673, 1, 0, 0, 0, 1675, 1676, 1, 0, 0, 0, 1676, 1678, 1, 0, 0, 0, 1677, - 1658, 1, 0, 0, 0, 1677, 1671, 1, 0, 0, 0, 1678, 1688, 1, 0, 0, 0, 1679, - 1681, 3, 403, 201, 0, 1680, 1682, 7, 5, 0, 0, 1681, 1680, 1, 0, 0, 0, 1681, - 1682, 1, 0, 0, 0, 1682, 1684, 1, 0, 0, 0, 1683, 1685, 3, 393, 196, 0, 1684, - 1683, 1, 0, 0, 0, 1685, 1686, 1, 0, 0, 0, 1686, 1684, 1, 0, 0, 0, 1686, - 1687, 1, 0, 0, 0, 1687, 1689, 1, 0, 0, 0, 1688, 1679, 1, 0, 0, 0, 1688, - 1689, 1, 0, 0, 0, 1689, 1699, 1, 0, 0, 0, 1690, 1691, 5, 48, 0, 0, 1691, - 1692, 5, 120, 0, 0, 1692, 1694, 1, 0, 0, 0, 1693, 1695, 3, 391, 195, 0, - 1694, 1693, 1, 0, 0, 0, 1695, 1696, 1, 0, 0, 0, 1696, 1694, 1, 0, 0, 0, - 1696, 1697, 1, 0, 0, 0, 1697, 1699, 1, 0, 0, 0, 1698, 1677, 1, 0, 0, 0, - 1698, 1690, 1, 0, 0, 0, 1699, 374, 1, 0, 0, 0, 1700, 1704, 5, 63, 0, 0, - 1701, 1703, 3, 393, 196, 0, 1702, 1701, 1, 0, 0, 0, 1703, 1706, 1, 0, 0, - 0, 1704, 1702, 1, 0, 0, 0, 1704, 1705, 1, 0, 0, 0, 1705, 376, 1, 0, 0, - 0, 1706, 1704, 1, 0, 0, 0, 1707, 1708, 7, 6, 0, 0, 1708, 1709, 3, 371, - 185, 0, 1709, 378, 1, 0, 0, 0, 1710, 1716, 5, 39, 0, 0, 1711, 1715, 8, - 7, 0, 0, 1712, 1713, 5, 39, 0, 0, 1713, 1715, 5, 39, 0, 0, 1714, 1711, - 1, 0, 0, 0, 1714, 1712, 1, 0, 0, 0, 1715, 1718, 1, 0, 0, 0, 1716, 1714, - 1, 0, 0, 0, 1716, 1717, 1, 0, 0, 0, 1717, 1719, 1, 0, 0, 0, 1718, 1716, - 1, 0, 0, 0, 1719, 1720, 5, 39, 0, 0, 1720, 380, 1, 0, 0, 0, 1721, 1722, - 3, 441, 220, 0, 1722, 1723, 3, 379, 189, 0, 1723, 382, 1, 0, 0, 0, 1724, - 1725, 5, 45, 0, 0, 1725, 1726, 5, 45, 0, 0, 1726, 1730, 1, 0, 0, 0, 1727, - 1729, 8, 8, 0, 0, 1728, 1727, 1, 0, 0, 0, 1729, 1732, 1, 0, 0, 0, 1730, - 1728, 1, 0, 0, 0, 1730, 1731, 1, 0, 0, 0, 1731, 1738, 1, 0, 0, 0, 1732, - 1730, 1, 0, 0, 0, 1733, 1735, 5, 13, 0, 0, 1734, 1733, 1, 0, 0, 0, 1734, - 1735, 1, 0, 0, 0, 1735, 1736, 1, 0, 0, 0, 1736, 1739, 5, 10, 0, 0, 1737, - 1739, 5, 0, 0, 1, 1738, 1734, 1, 0, 0, 0, 1738, 1737, 1, 0, 0, 0, 1739, - 1740, 1, 0, 0, 0, 1740, 1741, 6, 191, 0, 0, 1741, 384, 1, 0, 0, 0, 1742, - 1743, 5, 47, 0, 0, 1743, 1744, 5, 42, 0, 0, 1744, 1748, 1, 0, 0, 0, 1745, - 1747, 9, 0, 0, 0, 1746, 1745, 1, 0, 0, 0, 1747, 1750, 1, 0, 0, 0, 1748, - 1749, 1, 0, 0, 0, 1748, 1746, 1, 0, 0, 0, 1749, 1751, 1, 0, 0, 0, 1750, - 1748, 1, 0, 0, 0, 1751, 1752, 5, 42, 0, 0, 1752, 1753, 5, 47, 0, 0, 1753, - 1754, 1, 0, 0, 0, 1754, 1755, 6, 192, 0, 0, 1755, 386, 1, 0, 0, 0, 1756, - 1757, 7, 9, 0, 0, 1757, 1758, 1, 0, 0, 0, 1758, 1759, 6, 193, 0, 0, 1759, - 388, 1, 0, 0, 0, 1760, 1761, 9, 0, 0, 0, 1761, 390, 1, 0, 0, 0, 1762, 1763, - 7, 10, 0, 0, 1763, 392, 1, 0, 0, 0, 1764, 1765, 7, 11, 0, 0, 1765, 394, - 1, 0, 0, 0, 1766, 1767, 7, 12, 0, 0, 1767, 396, 1, 0, 0, 0, 1768, 1769, - 7, 13, 0, 0, 1769, 398, 1, 0, 0, 0, 1770, 1771, 7, 14, 0, 0, 1771, 400, - 1, 0, 0, 0, 1772, 1773, 7, 15, 0, 0, 1773, 402, 1, 0, 0, 0, 1774, 1775, - 7, 16, 0, 0, 1775, 404, 1, 0, 0, 0, 1776, 1777, 7, 17, 0, 0, 1777, 406, - 1, 0, 0, 0, 1778, 1779, 7, 18, 0, 0, 1779, 408, 1, 0, 0, 0, 1780, 1781, - 7, 19, 0, 0, 1781, 410, 1, 0, 0, 0, 1782, 1783, 7, 20, 0, 0, 1783, 412, - 1, 0, 0, 0, 1784, 1785, 7, 21, 0, 0, 1785, 414, 1, 0, 0, 0, 1786, 1787, - 7, 22, 0, 0, 1787, 416, 1, 0, 0, 0, 1788, 1789, 7, 23, 0, 0, 1789, 418, - 1, 0, 0, 0, 1790, 1791, 7, 24, 0, 0, 1791, 420, 1, 0, 0, 0, 1792, 1793, - 7, 25, 0, 0, 1793, 422, 1, 0, 0, 0, 1794, 1795, 7, 26, 0, 0, 1795, 424, - 1, 0, 0, 0, 1796, 1797, 7, 27, 0, 0, 1797, 426, 1, 0, 0, 0, 1798, 1799, - 7, 28, 0, 0, 1799, 428, 1, 0, 0, 0, 1800, 1801, 7, 29, 0, 0, 1801, 430, - 1, 0, 0, 0, 1802, 1803, 7, 30, 0, 0, 1803, 432, 1, 0, 0, 0, 1804, 1805, - 7, 31, 0, 0, 1805, 434, 1, 0, 0, 0, 1806, 1807, 7, 32, 0, 0, 1807, 436, - 1, 0, 0, 0, 1808, 1809, 7, 33, 0, 0, 1809, 438, 1, 0, 0, 0, 1810, 1811, - 7, 34, 0, 0, 1811, 440, 1, 0, 0, 0, 1812, 1813, 7, 35, 0, 0, 1813, 442, - 1, 0, 0, 0, 1814, 1815, 7, 36, 0, 0, 1815, 444, 1, 0, 0, 0, 1816, 1817, - 7, 37, 0, 0, 1817, 446, 1, 0, 0, 0, 25, 0, 1624, 1626, 1634, 1636, 1644, - 1652, 1655, 1660, 1666, 1669, 1675, 1677, 1681, 1686, 1688, 1696, 1698, - 1704, 1714, 1716, 1730, 1734, 1738, 1748, 1, 0, 1, 0, + 222, 1, 222, 1, 223, 1, 223, 1, 224, 1, 224, 1, 1759, 0, 225, 1, 1, 3, + 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, + 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 20, 41, 21, + 43, 22, 45, 23, 47, 24, 49, 25, 51, 26, 53, 27, 55, 28, 57, 29, 59, 30, + 61, 31, 63, 32, 65, 33, 67, 34, 69, 35, 71, 36, 73, 37, 75, 38, 77, 39, + 79, 40, 81, 41, 83, 42, 85, 43, 87, 44, 89, 45, 91, 46, 93, 47, 95, 48, + 97, 49, 99, 50, 101, 51, 103, 52, 105, 53, 107, 54, 109, 55, 111, 56, 113, + 57, 115, 58, 117, 59, 119, 60, 121, 61, 123, 62, 125, 63, 127, 64, 129, + 65, 131, 66, 133, 67, 135, 68, 137, 69, 139, 70, 141, 71, 143, 72, 145, + 73, 147, 74, 149, 75, 151, 76, 153, 77, 155, 78, 157, 79, 159, 80, 161, + 81, 163, 82, 165, 83, 167, 84, 169, 85, 171, 86, 173, 87, 175, 88, 177, + 89, 179, 90, 181, 91, 183, 92, 185, 93, 187, 94, 189, 95, 191, 96, 193, + 97, 195, 98, 197, 99, 199, 100, 201, 101, 203, 102, 205, 103, 207, 104, + 209, 105, 211, 106, 213, 107, 215, 108, 217, 109, 219, 110, 221, 111, 223, + 112, 225, 113, 227, 114, 229, 115, 231, 116, 233, 117, 235, 118, 237, 119, + 239, 120, 241, 121, 243, 122, 245, 123, 247, 124, 249, 125, 251, 126, 253, + 127, 255, 128, 257, 129, 259, 130, 261, 131, 263, 132, 265, 133, 267, 134, + 269, 135, 271, 136, 273, 137, 275, 138, 277, 139, 279, 140, 281, 141, 283, + 142, 285, 143, 287, 144, 289, 145, 291, 146, 293, 147, 295, 148, 297, 149, + 299, 150, 301, 151, 303, 152, 305, 153, 307, 154, 309, 155, 311, 156, 313, + 157, 315, 158, 317, 159, 319, 160, 321, 161, 323, 162, 325, 163, 327, 164, + 329, 165, 331, 166, 333, 167, 335, 168, 337, 169, 339, 170, 341, 171, 343, + 172, 345, 173, 347, 174, 349, 175, 351, 176, 353, 177, 355, 178, 357, 179, + 359, 180, 361, 181, 363, 182, 365, 183, 367, 184, 369, 185, 371, 186, 373, + 187, 375, 188, 377, 189, 379, 190, 381, 191, 383, 192, 385, 193, 387, 194, + 389, 195, 391, 196, 393, 197, 395, 0, 397, 0, 399, 0, 401, 0, 403, 0, 405, + 0, 407, 0, 409, 0, 411, 0, 413, 0, 415, 0, 417, 0, 419, 0, 421, 0, 423, + 0, 425, 0, 427, 0, 429, 0, 431, 0, 433, 0, 435, 0, 437, 0, 439, 0, 441, + 0, 443, 0, 445, 0, 447, 0, 449, 0, 1, 0, 38, 1, 0, 34, 34, 1, 0, 96, 96, + 1, 0, 93, 93, 3, 0, 65, 90, 95, 95, 97, 122, 4, 0, 48, 57, 65, 90, 95, + 95, 97, 122, 2, 0, 43, 43, 45, 45, 3, 0, 36, 36, 58, 58, 64, 64, 1, 0, + 39, 39, 2, 0, 10, 10, 13, 13, 3, 0, 9, 11, 13, 13, 32, 32, 3, 0, 48, 57, + 65, 70, 97, 102, 1, 0, 48, 57, 2, 0, 65, 65, 97, 97, 2, 0, 66, 66, 98, + 98, 2, 0, 67, 67, 99, 99, 2, 0, 68, 68, 100, 100, 2, 0, 69, 69, 101, 101, + 2, 0, 70, 70, 102, 102, 2, 0, 71, 71, 103, 103, 2, 0, 72, 72, 104, 104, + 2, 0, 73, 73, 105, 105, 2, 0, 74, 74, 106, 106, 2, 0, 75, 75, 107, 107, + 2, 0, 76, 76, 108, 108, 2, 0, 77, 77, 109, 109, 2, 0, 78, 78, 110, 110, + 2, 0, 79, 79, 111, 111, 2, 0, 80, 80, 112, 112, 2, 0, 81, 81, 113, 113, + 2, 0, 82, 82, 114, 114, 2, 0, 83, 83, 115, 115, 2, 0, 84, 84, 116, 116, + 2, 0, 85, 85, 117, 117, 2, 0, 86, 86, 118, 118, 2, 0, 87, 87, 119, 119, + 2, 0, 88, 88, 120, 120, 2, 0, 89, 89, 121, 121, 2, 0, 90, 90, 122, 122, + 1826, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, + 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, + 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, + 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, + 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, + 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, + 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, 1, 0, + 0, 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 0, 61, 1, + 0, 0, 0, 0, 63, 1, 0, 0, 0, 0, 65, 1, 0, 0, 0, 0, 67, 1, 0, 0, 0, 0, 69, + 1, 0, 0, 0, 0, 71, 1, 0, 0, 0, 0, 73, 1, 0, 0, 0, 0, 75, 1, 0, 0, 0, 0, + 77, 1, 0, 0, 0, 0, 79, 1, 0, 0, 0, 0, 81, 1, 0, 0, 0, 0, 83, 1, 0, 0, 0, + 0, 85, 1, 0, 0, 0, 0, 87, 1, 0, 0, 0, 0, 89, 1, 0, 0, 0, 0, 91, 1, 0, 0, + 0, 0, 93, 1, 0, 0, 0, 0, 95, 1, 0, 0, 0, 0, 97, 1, 0, 0, 0, 0, 99, 1, 0, + 0, 0, 0, 101, 1, 0, 0, 0, 0, 103, 1, 0, 0, 0, 0, 105, 1, 0, 0, 0, 0, 107, + 1, 0, 0, 0, 0, 109, 1, 0, 0, 0, 0, 111, 1, 0, 0, 0, 0, 113, 1, 0, 0, 0, + 0, 115, 1, 0, 0, 0, 0, 117, 1, 0, 0, 0, 0, 119, 1, 0, 0, 0, 0, 121, 1, + 0, 0, 0, 0, 123, 1, 0, 0, 0, 0, 125, 1, 0, 0, 0, 0, 127, 1, 0, 0, 0, 0, + 129, 1, 0, 0, 0, 0, 131, 1, 0, 0, 0, 0, 133, 1, 0, 0, 0, 0, 135, 1, 0, + 0, 0, 0, 137, 1, 0, 0, 0, 0, 139, 1, 0, 0, 0, 0, 141, 1, 0, 0, 0, 0, 143, + 1, 0, 0, 0, 0, 145, 1, 0, 0, 0, 0, 147, 1, 0, 0, 0, 0, 149, 1, 0, 0, 0, + 0, 151, 1, 0, 0, 0, 0, 153, 1, 0, 0, 0, 0, 155, 1, 0, 0, 0, 0, 157, 1, + 0, 0, 0, 0, 159, 1, 0, 0, 0, 0, 161, 1, 0, 0, 0, 0, 163, 1, 0, 0, 0, 0, + 165, 1, 0, 0, 0, 0, 167, 1, 0, 0, 0, 0, 169, 1, 0, 0, 0, 0, 171, 1, 0, + 0, 0, 0, 173, 1, 0, 0, 0, 0, 175, 1, 0, 0, 0, 0, 177, 1, 0, 0, 0, 0, 179, + 1, 0, 0, 0, 0, 181, 1, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 185, 1, 0, 0, 0, + 0, 187, 1, 0, 0, 0, 0, 189, 1, 0, 0, 0, 0, 191, 1, 0, 0, 0, 0, 193, 1, + 0, 0, 0, 0, 195, 1, 0, 0, 0, 0, 197, 1, 0, 0, 0, 0, 199, 1, 0, 0, 0, 0, + 201, 1, 0, 0, 0, 0, 203, 1, 0, 0, 0, 0, 205, 1, 0, 0, 0, 0, 207, 1, 0, + 0, 0, 0, 209, 1, 0, 0, 0, 0, 211, 1, 0, 0, 0, 0, 213, 1, 0, 0, 0, 0, 215, + 1, 0, 0, 0, 0, 217, 1, 0, 0, 0, 0, 219, 1, 0, 0, 0, 0, 221, 1, 0, 0, 0, + 0, 223, 1, 0, 0, 0, 0, 225, 1, 0, 0, 0, 0, 227, 1, 0, 0, 0, 0, 229, 1, + 0, 0, 0, 0, 231, 1, 0, 0, 0, 0, 233, 1, 0, 0, 0, 0, 235, 1, 0, 0, 0, 0, + 237, 1, 0, 0, 0, 0, 239, 1, 0, 0, 0, 0, 241, 1, 0, 0, 0, 0, 243, 1, 0, + 0, 0, 0, 245, 1, 0, 0, 0, 0, 247, 1, 0, 0, 0, 0, 249, 1, 0, 0, 0, 0, 251, + 1, 0, 0, 0, 0, 253, 1, 0, 0, 0, 0, 255, 1, 0, 0, 0, 0, 257, 1, 0, 0, 0, + 0, 259, 1, 0, 0, 0, 0, 261, 1, 0, 0, 0, 0, 263, 1, 0, 0, 0, 0, 265, 1, + 0, 0, 0, 0, 267, 1, 0, 0, 0, 0, 269, 1, 0, 0, 0, 0, 271, 1, 0, 0, 0, 0, + 273, 1, 0, 0, 0, 0, 275, 1, 0, 0, 0, 0, 277, 1, 0, 0, 0, 0, 279, 1, 0, + 0, 0, 0, 281, 1, 0, 0, 0, 0, 283, 1, 0, 0, 0, 0, 285, 1, 0, 0, 0, 0, 287, + 1, 0, 0, 0, 0, 289, 1, 0, 0, 0, 0, 291, 1, 0, 0, 0, 0, 293, 1, 0, 0, 0, + 0, 295, 1, 0, 0, 0, 0, 297, 1, 0, 0, 0, 0, 299, 1, 0, 0, 0, 0, 301, 1, + 0, 0, 0, 0, 303, 1, 0, 0, 0, 0, 305, 1, 0, 0, 0, 0, 307, 1, 0, 0, 0, 0, + 309, 1, 0, 0, 0, 0, 311, 1, 0, 0, 0, 0, 313, 1, 0, 0, 0, 0, 315, 1, 0, + 0, 0, 0, 317, 1, 0, 0, 0, 0, 319, 1, 0, 0, 0, 0, 321, 1, 0, 0, 0, 0, 323, + 1, 0, 0, 0, 0, 325, 1, 0, 0, 0, 0, 327, 1, 0, 0, 0, 0, 329, 1, 0, 0, 0, + 0, 331, 1, 0, 0, 0, 0, 333, 1, 0, 0, 0, 0, 335, 1, 0, 0, 0, 0, 337, 1, + 0, 0, 0, 0, 339, 1, 0, 0, 0, 0, 341, 1, 0, 0, 0, 0, 343, 1, 0, 0, 0, 0, + 345, 1, 0, 0, 0, 0, 347, 1, 0, 0, 0, 0, 349, 1, 0, 0, 0, 0, 351, 1, 0, + 0, 0, 0, 353, 1, 0, 0, 0, 0, 355, 1, 0, 0, 0, 0, 357, 1, 0, 0, 0, 0, 359, + 1, 0, 0, 0, 0, 361, 1, 0, 0, 0, 0, 363, 1, 0, 0, 0, 0, 365, 1, 0, 0, 0, + 0, 367, 1, 0, 0, 0, 0, 369, 1, 0, 0, 0, 0, 371, 1, 0, 0, 0, 0, 373, 1, + 0, 0, 0, 0, 375, 1, 0, 0, 0, 0, 377, 1, 0, 0, 0, 0, 379, 1, 0, 0, 0, 0, + 381, 1, 0, 0, 0, 0, 383, 1, 0, 0, 0, 0, 385, 1, 0, 0, 0, 0, 387, 1, 0, + 0, 0, 0, 389, 1, 0, 0, 0, 0, 391, 1, 0, 0, 0, 0, 393, 1, 0, 0, 0, 1, 451, + 1, 0, 0, 0, 3, 453, 1, 0, 0, 0, 5, 455, 1, 0, 0, 0, 7, 457, 1, 0, 0, 0, + 9, 459, 1, 0, 0, 0, 11, 461, 1, 0, 0, 0, 13, 463, 1, 0, 0, 0, 15, 465, + 1, 0, 0, 0, 17, 467, 1, 0, 0, 0, 19, 471, 1, 0, 0, 0, 21, 474, 1, 0, 0, + 0, 23, 476, 1, 0, 0, 0, 25, 478, 1, 0, 0, 0, 27, 481, 1, 0, 0, 0, 29, 483, + 1, 0, 0, 0, 31, 485, 1, 0, 0, 0, 33, 488, 1, 0, 0, 0, 35, 491, 1, 0, 0, + 0, 37, 493, 1, 0, 0, 0, 39, 495, 1, 0, 0, 0, 41, 497, 1, 0, 0, 0, 43, 500, + 1, 0, 0, 0, 45, 502, 1, 0, 0, 0, 47, 505, 1, 0, 0, 0, 49, 508, 1, 0, 0, + 0, 51, 511, 1, 0, 0, 0, 53, 514, 1, 0, 0, 0, 55, 520, 1, 0, 0, 0, 57, 527, + 1, 0, 0, 0, 59, 531, 1, 0, 0, 0, 61, 537, 1, 0, 0, 0, 63, 541, 1, 0, 0, + 0, 65, 547, 1, 0, 0, 0, 67, 555, 1, 0, 0, 0, 69, 559, 1, 0, 0, 0, 71, 562, + 1, 0, 0, 0, 73, 566, 1, 0, 0, 0, 75, 573, 1, 0, 0, 0, 77, 587, 1, 0, 0, + 0, 79, 594, 1, 0, 0, 0, 81, 600, 1, 0, 0, 0, 83, 608, 1, 0, 0, 0, 85, 611, + 1, 0, 0, 0, 87, 619, 1, 0, 0, 0, 89, 624, 1, 0, 0, 0, 91, 629, 1, 0, 0, + 0, 93, 635, 1, 0, 0, 0, 95, 643, 1, 0, 0, 0, 97, 650, 1, 0, 0, 0, 99, 657, + 1, 0, 0, 0, 101, 666, 1, 0, 0, 0, 103, 677, 1, 0, 0, 0, 105, 684, 1, 0, + 0, 0, 107, 690, 1, 0, 0, 0, 109, 703, 1, 0, 0, 0, 111, 716, 1, 0, 0, 0, + 113, 734, 1, 0, 0, 0, 115, 743, 1, 0, 0, 0, 117, 751, 1, 0, 0, 0, 119, + 762, 1, 0, 0, 0, 121, 771, 1, 0, 0, 0, 123, 778, 1, 0, 0, 0, 125, 783, + 1, 0, 0, 0, 127, 790, 1, 0, 0, 0, 129, 799, 1, 0, 0, 0, 131, 804, 1, 0, + 0, 0, 133, 809, 1, 0, 0, 0, 135, 814, 1, 0, 0, 0, 137, 818, 1, 0, 0, 0, + 139, 825, 1, 0, 0, 0, 141, 832, 1, 0, 0, 0, 143, 842, 1, 0, 0, 0, 145, + 849, 1, 0, 0, 0, 147, 857, 1, 0, 0, 0, 149, 862, 1, 0, 0, 0, 151, 866, + 1, 0, 0, 0, 153, 874, 1, 0, 0, 0, 155, 879, 1, 0, 0, 0, 157, 884, 1, 0, + 0, 0, 159, 889, 1, 0, 0, 0, 161, 895, 1, 0, 0, 0, 163, 902, 1, 0, 0, 0, + 165, 905, 1, 0, 0, 0, 167, 912, 1, 0, 0, 0, 169, 922, 1, 0, 0, 0, 171, + 925, 1, 0, 0, 0, 173, 931, 1, 0, 0, 0, 175, 939, 1, 0, 0, 0, 177, 949, + 1, 0, 0, 0, 179, 955, 1, 0, 0, 0, 181, 962, 1, 0, 0, 0, 183, 970, 1, 0, + 0, 0, 185, 980, 1, 0, 0, 0, 187, 985, 1, 0, 0, 0, 189, 988, 1, 0, 0, 0, + 191, 995, 1, 0, 0, 0, 193, 1000, 1, 0, 0, 0, 195, 1004, 1, 0, 0, 0, 197, + 1009, 1, 0, 0, 0, 199, 1014, 1, 0, 0, 0, 201, 1020, 1, 0, 0, 0, 203, 1026, + 1, 0, 0, 0, 205, 1034, 1, 0, 0, 0, 207, 1037, 1, 0, 0, 0, 209, 1041, 1, + 0, 0, 0, 211, 1049, 1, 0, 0, 0, 213, 1054, 1, 0, 0, 0, 215, 1057, 1, 0, + 0, 0, 217, 1064, 1, 0, 0, 0, 219, 1067, 1, 0, 0, 0, 221, 1070, 1, 0, 0, + 0, 223, 1076, 1, 0, 0, 0, 225, 1082, 1, 0, 0, 0, 227, 1087, 1, 0, 0, 0, + 229, 1094, 1, 0, 0, 0, 231, 1102, 1, 0, 0, 0, 233, 1108, 1, 0, 0, 0, 235, + 1114, 1, 0, 0, 0, 237, 1124, 1, 0, 0, 0, 239, 1135, 1, 0, 0, 0, 241, 1142, + 1, 0, 0, 0, 243, 1150, 1, 0, 0, 0, 245, 1158, 1, 0, 0, 0, 247, 1165, 1, + 0, 0, 0, 249, 1173, 1, 0, 0, 0, 251, 1182, 1, 0, 0, 0, 253, 1192, 1, 0, + 0, 0, 255, 1198, 1, 0, 0, 0, 257, 1207, 1, 0, 0, 0, 259, 1211, 1, 0, 0, + 0, 261, 1216, 1, 0, 0, 0, 263, 1226, 1, 0, 0, 0, 265, 1233, 1, 0, 0, 0, + 267, 1237, 1, 0, 0, 0, 269, 1244, 1, 0, 0, 0, 271, 1250, 1, 0, 0, 0, 273, + 1255, 1, 0, 0, 0, 275, 1265, 1, 0, 0, 0, 277, 1270, 1, 0, 0, 0, 279, 1273, + 1, 0, 0, 0, 281, 1285, 1, 0, 0, 0, 283, 1293, 1, 0, 0, 0, 285, 1299, 1, + 0, 0, 0, 287, 1306, 1, 0, 0, 0, 289, 1313, 1, 0, 0, 0, 291, 1319, 1, 0, + 0, 0, 293, 1326, 1, 0, 0, 0, 295, 1333, 1, 0, 0, 0, 297, 1338, 1, 0, 0, + 0, 299, 1346, 1, 0, 0, 0, 301, 1351, 1, 0, 0, 0, 303, 1357, 1, 0, 0, 0, + 305, 1362, 1, 0, 0, 0, 307, 1370, 1, 0, 0, 0, 309, 1382, 1, 0, 0, 0, 311, + 1387, 1, 0, 0, 0, 313, 1397, 1, 0, 0, 0, 315, 1403, 1, 0, 0, 0, 317, 1413, + 1, 0, 0, 0, 319, 1423, 1, 0, 0, 0, 321, 1431, 1, 0, 0, 0, 323, 1441, 1, + 0, 0, 0, 325, 1451, 1, 0, 0, 0, 327, 1462, 1, 0, 0, 0, 329, 1466, 1, 0, + 0, 0, 331, 1477, 1, 0, 0, 0, 333, 1482, 1, 0, 0, 0, 335, 1492, 1, 0, 0, + 0, 337, 1498, 1, 0, 0, 0, 339, 1511, 1, 0, 0, 0, 341, 1516, 1, 0, 0, 0, + 343, 1527, 1, 0, 0, 0, 345, 1537, 1, 0, 0, 0, 347, 1544, 1, 0, 0, 0, 349, + 1551, 1, 0, 0, 0, 351, 1556, 1, 0, 0, 0, 353, 1562, 1, 0, 0, 0, 355, 1569, + 1, 0, 0, 0, 357, 1575, 1, 0, 0, 0, 359, 1581, 1, 0, 0, 0, 361, 1586, 1, + 0, 0, 0, 363, 1593, 1, 0, 0, 0, 365, 1600, 1, 0, 0, 0, 367, 1608, 1, 0, + 0, 0, 369, 1613, 1, 0, 0, 0, 371, 1620, 1, 0, 0, 0, 373, 1623, 1, 0, 0, + 0, 375, 1666, 1, 0, 0, 0, 377, 1709, 1, 0, 0, 0, 379, 1711, 1, 0, 0, 0, + 381, 1718, 1, 0, 0, 0, 383, 1721, 1, 0, 0, 0, 385, 1732, 1, 0, 0, 0, 387, + 1735, 1, 0, 0, 0, 389, 1753, 1, 0, 0, 0, 391, 1767, 1, 0, 0, 0, 393, 1771, + 1, 0, 0, 0, 395, 1773, 1, 0, 0, 0, 397, 1775, 1, 0, 0, 0, 399, 1777, 1, + 0, 0, 0, 401, 1779, 1, 0, 0, 0, 403, 1781, 1, 0, 0, 0, 405, 1783, 1, 0, + 0, 0, 407, 1785, 1, 0, 0, 0, 409, 1787, 1, 0, 0, 0, 411, 1789, 1, 0, 0, + 0, 413, 1791, 1, 0, 0, 0, 415, 1793, 1, 0, 0, 0, 417, 1795, 1, 0, 0, 0, + 419, 1797, 1, 0, 0, 0, 421, 1799, 1, 0, 0, 0, 423, 1801, 1, 0, 0, 0, 425, + 1803, 1, 0, 0, 0, 427, 1805, 1, 0, 0, 0, 429, 1807, 1, 0, 0, 0, 431, 1809, + 1, 0, 0, 0, 433, 1811, 1, 0, 0, 0, 435, 1813, 1, 0, 0, 0, 437, 1815, 1, + 0, 0, 0, 439, 1817, 1, 0, 0, 0, 441, 1819, 1, 0, 0, 0, 443, 1821, 1, 0, + 0, 0, 445, 1823, 1, 0, 0, 0, 447, 1825, 1, 0, 0, 0, 449, 1827, 1, 0, 0, + 0, 451, 452, 5, 59, 0, 0, 452, 2, 1, 0, 0, 0, 453, 454, 5, 46, 0, 0, 454, + 4, 1, 0, 0, 0, 455, 456, 5, 40, 0, 0, 456, 6, 1, 0, 0, 0, 457, 458, 5, + 41, 0, 0, 458, 8, 1, 0, 0, 0, 459, 460, 5, 44, 0, 0, 460, 10, 1, 0, 0, + 0, 461, 462, 5, 61, 0, 0, 462, 12, 1, 0, 0, 0, 463, 464, 5, 42, 0, 0, 464, + 14, 1, 0, 0, 0, 465, 466, 5, 43, 0, 0, 466, 16, 1, 0, 0, 0, 467, 468, 5, + 45, 0, 0, 468, 469, 5, 62, 0, 0, 469, 470, 5, 62, 0, 0, 470, 18, 1, 0, + 0, 0, 471, 472, 5, 45, 0, 0, 472, 473, 5, 62, 0, 0, 473, 20, 1, 0, 0, 0, + 474, 475, 5, 45, 0, 0, 475, 22, 1, 0, 0, 0, 476, 477, 5, 126, 0, 0, 477, + 24, 1, 0, 0, 0, 478, 479, 5, 124, 0, 0, 479, 480, 5, 124, 0, 0, 480, 26, + 1, 0, 0, 0, 481, 482, 5, 47, 0, 0, 482, 28, 1, 0, 0, 0, 483, 484, 5, 37, + 0, 0, 484, 30, 1, 0, 0, 0, 485, 486, 5, 60, 0, 0, 486, 487, 5, 60, 0, 0, + 487, 32, 1, 0, 0, 0, 488, 489, 5, 62, 0, 0, 489, 490, 5, 62, 0, 0, 490, + 34, 1, 0, 0, 0, 491, 492, 5, 38, 0, 0, 492, 36, 1, 0, 0, 0, 493, 494, 5, + 124, 0, 0, 494, 38, 1, 0, 0, 0, 495, 496, 5, 60, 0, 0, 496, 40, 1, 0, 0, + 0, 497, 498, 5, 60, 0, 0, 498, 499, 5, 61, 0, 0, 499, 42, 1, 0, 0, 0, 500, + 501, 5, 62, 0, 0, 501, 44, 1, 0, 0, 0, 502, 503, 5, 62, 0, 0, 503, 504, + 5, 61, 0, 0, 504, 46, 1, 0, 0, 0, 505, 506, 5, 61, 0, 0, 506, 507, 5, 61, + 0, 0, 507, 48, 1, 0, 0, 0, 508, 509, 5, 33, 0, 0, 509, 510, 5, 61, 0, 0, + 510, 50, 1, 0, 0, 0, 511, 512, 5, 60, 0, 0, 512, 513, 5, 62, 0, 0, 513, + 52, 1, 0, 0, 0, 514, 515, 3, 399, 199, 0, 515, 516, 3, 401, 200, 0, 516, + 517, 3, 427, 213, 0, 517, 518, 3, 433, 216, 0, 518, 519, 3, 437, 218, 0, + 519, 54, 1, 0, 0, 0, 520, 521, 3, 399, 199, 0, 521, 522, 3, 403, 201, 0, + 522, 523, 3, 437, 218, 0, 523, 524, 3, 415, 207, 0, 524, 525, 3, 427, 213, + 0, 525, 526, 3, 425, 212, 0, 526, 56, 1, 0, 0, 0, 527, 528, 3, 399, 199, + 0, 528, 529, 3, 405, 202, 0, 529, 530, 3, 405, 202, 0, 530, 58, 1, 0, 0, + 0, 531, 532, 3, 399, 199, 0, 532, 533, 3, 409, 204, 0, 533, 534, 3, 437, + 218, 0, 534, 535, 3, 407, 203, 0, 535, 536, 3, 433, 216, 0, 536, 60, 1, + 0, 0, 0, 537, 538, 3, 399, 199, 0, 538, 539, 3, 421, 210, 0, 539, 540, + 3, 421, 210, 0, 540, 62, 1, 0, 0, 0, 541, 542, 3, 399, 199, 0, 542, 543, + 3, 421, 210, 0, 543, 544, 3, 437, 218, 0, 544, 545, 3, 407, 203, 0, 545, + 546, 3, 433, 216, 0, 546, 64, 1, 0, 0, 0, 547, 548, 3, 399, 199, 0, 548, + 549, 3, 425, 212, 0, 549, 550, 3, 399, 199, 0, 550, 551, 3, 421, 210, 0, + 551, 552, 3, 447, 223, 0, 552, 553, 3, 449, 224, 0, 553, 554, 3, 407, 203, + 0, 554, 66, 1, 0, 0, 0, 555, 556, 3, 399, 199, 0, 556, 557, 3, 425, 212, + 0, 557, 558, 3, 405, 202, 0, 558, 68, 1, 0, 0, 0, 559, 560, 3, 399, 199, + 0, 560, 561, 3, 435, 217, 0, 561, 70, 1, 0, 0, 0, 562, 563, 3, 399, 199, + 0, 563, 564, 3, 435, 217, 0, 564, 565, 3, 403, 201, 0, 565, 72, 1, 0, 0, + 0, 566, 567, 3, 399, 199, 0, 567, 568, 3, 437, 218, 0, 568, 569, 3, 437, + 218, 0, 569, 570, 3, 399, 199, 0, 570, 571, 3, 403, 201, 0, 571, 572, 3, + 413, 206, 0, 572, 74, 1, 0, 0, 0, 573, 574, 3, 399, 199, 0, 574, 575, 3, + 439, 219, 0, 575, 576, 3, 437, 218, 0, 576, 577, 3, 427, 213, 0, 577, 578, + 3, 415, 207, 0, 578, 579, 3, 425, 212, 0, 579, 580, 3, 403, 201, 0, 580, + 581, 3, 433, 216, 0, 581, 582, 3, 407, 203, 0, 582, 583, 3, 423, 211, 0, + 583, 584, 3, 407, 203, 0, 584, 585, 3, 425, 212, 0, 585, 586, 3, 437, 218, + 0, 586, 76, 1, 0, 0, 0, 587, 588, 3, 401, 200, 0, 588, 589, 3, 407, 203, + 0, 589, 590, 3, 409, 204, 0, 590, 591, 3, 427, 213, 0, 591, 592, 3, 433, + 216, 0, 592, 593, 3, 407, 203, 0, 593, 78, 1, 0, 0, 0, 594, 595, 3, 401, + 200, 0, 595, 596, 3, 407, 203, 0, 596, 597, 3, 411, 205, 0, 597, 598, 3, + 415, 207, 0, 598, 599, 3, 425, 212, 0, 599, 80, 1, 0, 0, 0, 600, 601, 3, + 401, 200, 0, 601, 602, 3, 407, 203, 0, 602, 603, 3, 437, 218, 0, 603, 604, + 3, 443, 221, 0, 604, 605, 3, 407, 203, 0, 605, 606, 3, 407, 203, 0, 606, + 607, 3, 425, 212, 0, 607, 82, 1, 0, 0, 0, 608, 609, 3, 401, 200, 0, 609, + 610, 3, 447, 223, 0, 610, 84, 1, 0, 0, 0, 611, 612, 3, 403, 201, 0, 612, + 613, 3, 399, 199, 0, 613, 614, 3, 435, 217, 0, 614, 615, 3, 403, 201, 0, + 615, 616, 3, 399, 199, 0, 616, 617, 3, 405, 202, 0, 617, 618, 3, 407, 203, + 0, 618, 86, 1, 0, 0, 0, 619, 620, 3, 403, 201, 0, 620, 621, 3, 399, 199, + 0, 621, 622, 3, 435, 217, 0, 622, 623, 3, 407, 203, 0, 623, 88, 1, 0, 0, + 0, 624, 625, 3, 403, 201, 0, 625, 626, 3, 399, 199, 0, 626, 627, 3, 435, + 217, 0, 627, 628, 3, 437, 218, 0, 628, 90, 1, 0, 0, 0, 629, 630, 3, 403, + 201, 0, 630, 631, 3, 413, 206, 0, 631, 632, 3, 407, 203, 0, 632, 633, 3, + 403, 201, 0, 633, 634, 3, 419, 209, 0, 634, 92, 1, 0, 0, 0, 635, 636, 3, + 403, 201, 0, 636, 637, 3, 427, 213, 0, 637, 638, 3, 421, 210, 0, 638, 639, + 3, 421, 210, 0, 639, 640, 3, 399, 199, 0, 640, 641, 3, 437, 218, 0, 641, + 642, 3, 407, 203, 0, 642, 94, 1, 0, 0, 0, 643, 644, 3, 403, 201, 0, 644, + 645, 3, 427, 213, 0, 645, 646, 3, 421, 210, 0, 646, 647, 3, 439, 219, 0, + 647, 648, 3, 423, 211, 0, 648, 649, 3, 425, 212, 0, 649, 96, 1, 0, 0, 0, + 650, 651, 3, 403, 201, 0, 651, 652, 3, 427, 213, 0, 652, 653, 3, 423, 211, + 0, 653, 654, 3, 423, 211, 0, 654, 655, 3, 415, 207, 0, 655, 656, 3, 437, + 218, 0, 656, 98, 1, 0, 0, 0, 657, 658, 3, 403, 201, 0, 658, 659, 3, 427, + 213, 0, 659, 660, 3, 425, 212, 0, 660, 661, 3, 409, 204, 0, 661, 662, 3, + 421, 210, 0, 662, 663, 3, 415, 207, 0, 663, 664, 3, 403, 201, 0, 664, 665, + 3, 437, 218, 0, 665, 100, 1, 0, 0, 0, 666, 667, 3, 403, 201, 0, 667, 668, + 3, 427, 213, 0, 668, 669, 3, 425, 212, 0, 669, 670, 3, 435, 217, 0, 670, + 671, 3, 437, 218, 0, 671, 672, 3, 433, 216, 0, 672, 673, 3, 399, 199, 0, + 673, 674, 3, 415, 207, 0, 674, 675, 3, 425, 212, 0, 675, 676, 3, 437, 218, + 0, 676, 102, 1, 0, 0, 0, 677, 678, 3, 403, 201, 0, 678, 679, 3, 433, 216, + 0, 679, 680, 3, 407, 203, 0, 680, 681, 3, 399, 199, 0, 681, 682, 3, 437, + 218, 0, 682, 683, 3, 407, 203, 0, 683, 104, 1, 0, 0, 0, 684, 685, 3, 403, + 201, 0, 685, 686, 3, 433, 216, 0, 686, 687, 3, 427, 213, 0, 687, 688, 3, + 435, 217, 0, 688, 689, 3, 435, 217, 0, 689, 106, 1, 0, 0, 0, 690, 691, + 3, 403, 201, 0, 691, 692, 3, 439, 219, 0, 692, 693, 3, 433, 216, 0, 693, + 694, 3, 433, 216, 0, 694, 695, 3, 407, 203, 0, 695, 696, 3, 425, 212, 0, + 696, 697, 3, 437, 218, 0, 697, 698, 5, 95, 0, 0, 698, 699, 3, 405, 202, + 0, 699, 700, 3, 399, 199, 0, 700, 701, 3, 437, 218, 0, 701, 702, 3, 407, + 203, 0, 702, 108, 1, 0, 0, 0, 703, 704, 3, 403, 201, 0, 704, 705, 3, 439, + 219, 0, 705, 706, 3, 433, 216, 0, 706, 707, 3, 433, 216, 0, 707, 708, 3, + 407, 203, 0, 708, 709, 3, 425, 212, 0, 709, 710, 3, 437, 218, 0, 710, 711, + 5, 95, 0, 0, 711, 712, 3, 437, 218, 0, 712, 713, 3, 415, 207, 0, 713, 714, + 3, 423, 211, 0, 714, 715, 3, 407, 203, 0, 715, 110, 1, 0, 0, 0, 716, 717, + 3, 403, 201, 0, 717, 718, 3, 439, 219, 0, 718, 719, 3, 433, 216, 0, 719, + 720, 3, 433, 216, 0, 720, 721, 3, 407, 203, 0, 721, 722, 3, 425, 212, 0, + 722, 723, 3, 437, 218, 0, 723, 724, 5, 95, 0, 0, 724, 725, 3, 437, 218, + 0, 725, 726, 3, 415, 207, 0, 726, 727, 3, 423, 211, 0, 727, 728, 3, 407, + 203, 0, 728, 729, 3, 435, 217, 0, 729, 730, 3, 437, 218, 0, 730, 731, 3, + 399, 199, 0, 731, 732, 3, 423, 211, 0, 732, 733, 3, 429, 214, 0, 733, 112, + 1, 0, 0, 0, 734, 735, 3, 405, 202, 0, 735, 736, 3, 399, 199, 0, 736, 737, + 3, 437, 218, 0, 737, 738, 3, 399, 199, 0, 738, 739, 3, 401, 200, 0, 739, + 740, 3, 399, 199, 0, 740, 741, 3, 435, 217, 0, 741, 742, 3, 407, 203, 0, + 742, 114, 1, 0, 0, 0, 743, 744, 3, 405, 202, 0, 744, 745, 3, 407, 203, + 0, 745, 746, 3, 409, 204, 0, 746, 747, 3, 399, 199, 0, 747, 748, 3, 439, + 219, 0, 748, 749, 3, 421, 210, 0, 749, 750, 3, 437, 218, 0, 750, 116, 1, + 0, 0, 0, 751, 752, 3, 405, 202, 0, 752, 753, 3, 407, 203, 0, 753, 754, + 3, 409, 204, 0, 754, 755, 3, 407, 203, 0, 755, 756, 3, 433, 216, 0, 756, + 757, 3, 433, 216, 0, 757, 758, 3, 399, 199, 0, 758, 759, 3, 401, 200, 0, + 759, 760, 3, 421, 210, 0, 760, 761, 3, 407, 203, 0, 761, 118, 1, 0, 0, + 0, 762, 763, 3, 405, 202, 0, 763, 764, 3, 407, 203, 0, 764, 765, 3, 409, + 204, 0, 765, 766, 3, 407, 203, 0, 766, 767, 3, 433, 216, 0, 767, 768, 3, + 433, 216, 0, 768, 769, 3, 407, 203, 0, 769, 770, 3, 405, 202, 0, 770, 120, + 1, 0, 0, 0, 771, 772, 3, 405, 202, 0, 772, 773, 3, 407, 203, 0, 773, 774, + 3, 421, 210, 0, 774, 775, 3, 407, 203, 0, 775, 776, 3, 437, 218, 0, 776, + 777, 3, 407, 203, 0, 777, 122, 1, 0, 0, 0, 778, 779, 3, 405, 202, 0, 779, + 780, 3, 407, 203, 0, 780, 781, 3, 435, 217, 0, 781, 782, 3, 403, 201, 0, + 782, 124, 1, 0, 0, 0, 783, 784, 3, 405, 202, 0, 784, 785, 3, 407, 203, + 0, 785, 786, 3, 437, 218, 0, 786, 787, 3, 399, 199, 0, 787, 788, 3, 403, + 201, 0, 788, 789, 3, 413, 206, 0, 789, 126, 1, 0, 0, 0, 790, 791, 3, 405, + 202, 0, 791, 792, 3, 415, 207, 0, 792, 793, 3, 435, 217, 0, 793, 794, 3, + 437, 218, 0, 794, 795, 3, 415, 207, 0, 795, 796, 3, 425, 212, 0, 796, 797, + 3, 403, 201, 0, 797, 798, 3, 437, 218, 0, 798, 128, 1, 0, 0, 0, 799, 800, + 3, 405, 202, 0, 800, 801, 3, 433, 216, 0, 801, 802, 3, 427, 213, 0, 802, + 803, 3, 429, 214, 0, 803, 130, 1, 0, 0, 0, 804, 805, 3, 407, 203, 0, 805, + 806, 3, 399, 199, 0, 806, 807, 3, 403, 201, 0, 807, 808, 3, 413, 206, 0, + 808, 132, 1, 0, 0, 0, 809, 810, 3, 407, 203, 0, 810, 811, 3, 421, 210, + 0, 811, 812, 3, 435, 217, 0, 812, 813, 3, 407, 203, 0, 813, 134, 1, 0, + 0, 0, 814, 815, 3, 407, 203, 0, 815, 816, 3, 425, 212, 0, 816, 817, 3, + 405, 202, 0, 817, 136, 1, 0, 0, 0, 818, 819, 3, 407, 203, 0, 819, 820, + 3, 435, 217, 0, 820, 821, 3, 403, 201, 0, 821, 822, 3, 399, 199, 0, 822, + 823, 3, 429, 214, 0, 823, 824, 3, 407, 203, 0, 824, 138, 1, 0, 0, 0, 825, + 826, 3, 407, 203, 0, 826, 827, 3, 445, 222, 0, 827, 828, 3, 403, 201, 0, + 828, 829, 3, 407, 203, 0, 829, 830, 3, 429, 214, 0, 830, 831, 3, 437, 218, + 0, 831, 140, 1, 0, 0, 0, 832, 833, 3, 407, 203, 0, 833, 834, 3, 445, 222, + 0, 834, 835, 3, 403, 201, 0, 835, 836, 3, 421, 210, 0, 836, 837, 3, 439, + 219, 0, 837, 838, 3, 435, 217, 0, 838, 839, 3, 415, 207, 0, 839, 840, 3, + 441, 220, 0, 840, 841, 3, 407, 203, 0, 841, 142, 1, 0, 0, 0, 842, 843, + 3, 407, 203, 0, 843, 844, 3, 445, 222, 0, 844, 845, 3, 415, 207, 0, 845, + 846, 3, 435, 217, 0, 846, 847, 3, 437, 218, 0, 847, 848, 3, 435, 217, 0, + 848, 144, 1, 0, 0, 0, 849, 850, 3, 407, 203, 0, 850, 851, 3, 445, 222, + 0, 851, 852, 3, 429, 214, 0, 852, 853, 3, 421, 210, 0, 853, 854, 3, 399, + 199, 0, 854, 855, 3, 415, 207, 0, 855, 856, 3, 425, 212, 0, 856, 146, 1, + 0, 0, 0, 857, 858, 3, 409, 204, 0, 858, 859, 3, 399, 199, 0, 859, 860, + 3, 415, 207, 0, 860, 861, 3, 421, 210, 0, 861, 148, 1, 0, 0, 0, 862, 863, + 3, 409, 204, 0, 863, 864, 3, 427, 213, 0, 864, 865, 3, 433, 216, 0, 865, + 150, 1, 0, 0, 0, 866, 867, 3, 409, 204, 0, 867, 868, 3, 427, 213, 0, 868, + 869, 3, 433, 216, 0, 869, 870, 3, 407, 203, 0, 870, 871, 3, 415, 207, 0, + 871, 872, 3, 411, 205, 0, 872, 873, 3, 425, 212, 0, 873, 152, 1, 0, 0, + 0, 874, 875, 3, 409, 204, 0, 875, 876, 3, 433, 216, 0, 876, 877, 3, 427, + 213, 0, 877, 878, 3, 423, 211, 0, 878, 154, 1, 0, 0, 0, 879, 880, 3, 409, + 204, 0, 880, 881, 3, 439, 219, 0, 881, 882, 3, 421, 210, 0, 882, 883, 3, + 421, 210, 0, 883, 156, 1, 0, 0, 0, 884, 885, 3, 411, 205, 0, 885, 886, + 3, 421, 210, 0, 886, 887, 3, 427, 213, 0, 887, 888, 3, 401, 200, 0, 888, + 158, 1, 0, 0, 0, 889, 890, 3, 411, 205, 0, 890, 891, 3, 433, 216, 0, 891, + 892, 3, 427, 213, 0, 892, 893, 3, 439, 219, 0, 893, 894, 3, 429, 214, 0, + 894, 160, 1, 0, 0, 0, 895, 896, 3, 413, 206, 0, 896, 897, 3, 399, 199, + 0, 897, 898, 3, 441, 220, 0, 898, 899, 3, 415, 207, 0, 899, 900, 3, 425, + 212, 0, 900, 901, 3, 411, 205, 0, 901, 162, 1, 0, 0, 0, 902, 903, 3, 415, + 207, 0, 903, 904, 3, 409, 204, 0, 904, 164, 1, 0, 0, 0, 905, 906, 3, 415, + 207, 0, 906, 907, 3, 411, 205, 0, 907, 908, 3, 425, 212, 0, 908, 909, 3, + 427, 213, 0, 909, 910, 3, 433, 216, 0, 910, 911, 3, 407, 203, 0, 911, 166, + 1, 0, 0, 0, 912, 913, 3, 415, 207, 0, 913, 914, 3, 423, 211, 0, 914, 915, + 3, 423, 211, 0, 915, 916, 3, 407, 203, 0, 916, 917, 3, 405, 202, 0, 917, + 918, 3, 415, 207, 0, 918, 919, 3, 399, 199, 0, 919, 920, 3, 437, 218, 0, + 920, 921, 3, 407, 203, 0, 921, 168, 1, 0, 0, 0, 922, 923, 3, 415, 207, + 0, 923, 924, 3, 425, 212, 0, 924, 170, 1, 0, 0, 0, 925, 926, 3, 415, 207, + 0, 926, 927, 3, 425, 212, 0, 927, 928, 3, 405, 202, 0, 928, 929, 3, 407, + 203, 0, 929, 930, 3, 445, 222, 0, 930, 172, 1, 0, 0, 0, 931, 932, 3, 415, + 207, 0, 932, 933, 3, 425, 212, 0, 933, 934, 3, 405, 202, 0, 934, 935, 3, + 407, 203, 0, 935, 936, 3, 445, 222, 0, 936, 937, 3, 407, 203, 0, 937, 938, + 3, 405, 202, 0, 938, 174, 1, 0, 0, 0, 939, 940, 3, 415, 207, 0, 940, 941, + 3, 425, 212, 0, 941, 942, 3, 415, 207, 0, 942, 943, 3, 437, 218, 0, 943, + 944, 3, 415, 207, 0, 944, 945, 3, 399, 199, 0, 945, 946, 3, 421, 210, 0, + 946, 947, 3, 421, 210, 0, 947, 948, 3, 447, 223, 0, 948, 176, 1, 0, 0, + 0, 949, 950, 3, 415, 207, 0, 950, 951, 3, 425, 212, 0, 951, 952, 3, 425, + 212, 0, 952, 953, 3, 407, 203, 0, 953, 954, 3, 433, 216, 0, 954, 178, 1, + 0, 0, 0, 955, 956, 3, 415, 207, 0, 956, 957, 3, 425, 212, 0, 957, 958, + 3, 435, 217, 0, 958, 959, 3, 407, 203, 0, 959, 960, 3, 433, 216, 0, 960, + 961, 3, 437, 218, 0, 961, 180, 1, 0, 0, 0, 962, 963, 3, 415, 207, 0, 963, + 964, 3, 425, 212, 0, 964, 965, 3, 435, 217, 0, 965, 966, 3, 437, 218, 0, + 966, 967, 3, 407, 203, 0, 967, 968, 3, 399, 199, 0, 968, 969, 3, 405, 202, + 0, 969, 182, 1, 0, 0, 0, 970, 971, 3, 415, 207, 0, 971, 972, 3, 425, 212, + 0, 972, 973, 3, 437, 218, 0, 973, 974, 3, 407, 203, 0, 974, 975, 3, 433, + 216, 0, 975, 976, 3, 435, 217, 0, 976, 977, 3, 407, 203, 0, 977, 978, 3, + 403, 201, 0, 978, 979, 3, 437, 218, 0, 979, 184, 1, 0, 0, 0, 980, 981, + 3, 415, 207, 0, 981, 982, 3, 425, 212, 0, 982, 983, 3, 437, 218, 0, 983, + 984, 3, 427, 213, 0, 984, 186, 1, 0, 0, 0, 985, 986, 3, 415, 207, 0, 986, + 987, 3, 435, 217, 0, 987, 188, 1, 0, 0, 0, 988, 989, 3, 415, 207, 0, 989, + 990, 3, 435, 217, 0, 990, 991, 3, 425, 212, 0, 991, 992, 3, 439, 219, 0, + 992, 993, 3, 421, 210, 0, 993, 994, 3, 421, 210, 0, 994, 190, 1, 0, 0, + 0, 995, 996, 3, 417, 208, 0, 996, 997, 3, 427, 213, 0, 997, 998, 3, 415, + 207, 0, 998, 999, 3, 425, 212, 0, 999, 192, 1, 0, 0, 0, 1000, 1001, 3, + 419, 209, 0, 1001, 1002, 3, 407, 203, 0, 1002, 1003, 3, 447, 223, 0, 1003, + 194, 1, 0, 0, 0, 1004, 1005, 3, 421, 210, 0, 1005, 1006, 3, 407, 203, 0, + 1006, 1007, 3, 409, 204, 0, 1007, 1008, 3, 437, 218, 0, 1008, 196, 1, 0, + 0, 0, 1009, 1010, 3, 421, 210, 0, 1010, 1011, 3, 415, 207, 0, 1011, 1012, + 3, 419, 209, 0, 1012, 1013, 3, 407, 203, 0, 1013, 198, 1, 0, 0, 0, 1014, + 1015, 3, 421, 210, 0, 1015, 1016, 3, 415, 207, 0, 1016, 1017, 3, 423, 211, + 0, 1017, 1018, 3, 415, 207, 0, 1018, 1019, 3, 437, 218, 0, 1019, 200, 1, + 0, 0, 0, 1020, 1021, 3, 423, 211, 0, 1021, 1022, 3, 399, 199, 0, 1022, + 1023, 3, 437, 218, 0, 1023, 1024, 3, 403, 201, 0, 1024, 1025, 3, 413, 206, + 0, 1025, 202, 1, 0, 0, 0, 1026, 1027, 3, 425, 212, 0, 1027, 1028, 3, 399, + 199, 0, 1028, 1029, 3, 437, 218, 0, 1029, 1030, 3, 439, 219, 0, 1030, 1031, + 3, 433, 216, 0, 1031, 1032, 3, 399, 199, 0, 1032, 1033, 3, 421, 210, 0, + 1033, 204, 1, 0, 0, 0, 1034, 1035, 3, 425, 212, 0, 1035, 1036, 3, 427, + 213, 0, 1036, 206, 1, 0, 0, 0, 1037, 1038, 3, 425, 212, 0, 1038, 1039, + 3, 427, 213, 0, 1039, 1040, 3, 437, 218, 0, 1040, 208, 1, 0, 0, 0, 1041, + 1042, 3, 425, 212, 0, 1042, 1043, 3, 427, 213, 0, 1043, 1044, 3, 437, 218, + 0, 1044, 1045, 3, 425, 212, 0, 1045, 1046, 3, 439, 219, 0, 1046, 1047, + 3, 421, 210, 0, 1047, 1048, 3, 421, 210, 0, 1048, 210, 1, 0, 0, 0, 1049, + 1050, 3, 425, 212, 0, 1050, 1051, 3, 439, 219, 0, 1051, 1052, 3, 421, 210, + 0, 1052, 1053, 3, 421, 210, 0, 1053, 212, 1, 0, 0, 0, 1054, 1055, 3, 427, + 213, 0, 1055, 1056, 3, 409, 204, 0, 1056, 214, 1, 0, 0, 0, 1057, 1058, + 3, 427, 213, 0, 1058, 1059, 3, 409, 204, 0, 1059, 1060, 3, 409, 204, 0, + 1060, 1061, 3, 435, 217, 0, 1061, 1062, 3, 407, 203, 0, 1062, 1063, 3, + 437, 218, 0, 1063, 216, 1, 0, 0, 0, 1064, 1065, 3, 427, 213, 0, 1065, 1066, + 3, 425, 212, 0, 1066, 218, 1, 0, 0, 0, 1067, 1068, 3, 427, 213, 0, 1068, + 1069, 3, 433, 216, 0, 1069, 220, 1, 0, 0, 0, 1070, 1071, 3, 427, 213, 0, + 1071, 1072, 3, 433, 216, 0, 1072, 1073, 3, 405, 202, 0, 1073, 1074, 3, + 407, 203, 0, 1074, 1075, 3, 433, 216, 0, 1075, 222, 1, 0, 0, 0, 1076, 1077, + 3, 427, 213, 0, 1077, 1078, 3, 439, 219, 0, 1078, 1079, 3, 437, 218, 0, + 1079, 1080, 3, 407, 203, 0, 1080, 1081, 3, 433, 216, 0, 1081, 224, 1, 0, + 0, 0, 1082, 1083, 3, 429, 214, 0, 1083, 1084, 3, 421, 210, 0, 1084, 1085, + 3, 399, 199, 0, 1085, 1086, 3, 425, 212, 0, 1086, 226, 1, 0, 0, 0, 1087, + 1088, 3, 429, 214, 0, 1088, 1089, 3, 433, 216, 0, 1089, 1090, 3, 399, 199, + 0, 1090, 1091, 3, 411, 205, 0, 1091, 1092, 3, 423, 211, 0, 1092, 1093, + 3, 399, 199, 0, 1093, 228, 1, 0, 0, 0, 1094, 1095, 3, 429, 214, 0, 1095, + 1096, 3, 433, 216, 0, 1096, 1097, 3, 415, 207, 0, 1097, 1098, 3, 423, 211, + 0, 1098, 1099, 3, 399, 199, 0, 1099, 1100, 3, 433, 216, 0, 1100, 1101, + 3, 447, 223, 0, 1101, 230, 1, 0, 0, 0, 1102, 1103, 3, 431, 215, 0, 1103, + 1104, 3, 439, 219, 0, 1104, 1105, 3, 407, 203, 0, 1105, 1106, 3, 433, 216, + 0, 1106, 1107, 3, 447, 223, 0, 1107, 232, 1, 0, 0, 0, 1108, 1109, 3, 433, + 216, 0, 1109, 1110, 3, 399, 199, 0, 1110, 1111, 3, 415, 207, 0, 1111, 1112, + 3, 435, 217, 0, 1112, 1113, 3, 407, 203, 0, 1113, 234, 1, 0, 0, 0, 1114, + 1115, 3, 433, 216, 0, 1115, 1116, 3, 407, 203, 0, 1116, 1117, 3, 403, 201, + 0, 1117, 1118, 3, 439, 219, 0, 1118, 1119, 3, 433, 216, 0, 1119, 1120, + 3, 435, 217, 0, 1120, 1121, 3, 415, 207, 0, 1121, 1122, 3, 441, 220, 0, + 1122, 1123, 3, 407, 203, 0, 1123, 236, 1, 0, 0, 0, 1124, 1125, 3, 433, + 216, 0, 1125, 1126, 3, 407, 203, 0, 1126, 1127, 3, 409, 204, 0, 1127, 1128, + 3, 407, 203, 0, 1128, 1129, 3, 433, 216, 0, 1129, 1130, 3, 407, 203, 0, + 1130, 1131, 3, 425, 212, 0, 1131, 1132, 3, 403, 201, 0, 1132, 1133, 3, + 407, 203, 0, 1133, 1134, 3, 435, 217, 0, 1134, 238, 1, 0, 0, 0, 1135, 1136, + 3, 433, 216, 0, 1136, 1137, 3, 407, 203, 0, 1137, 1138, 3, 411, 205, 0, + 1138, 1139, 3, 407, 203, 0, 1139, 1140, 3, 445, 222, 0, 1140, 1141, 3, + 429, 214, 0, 1141, 240, 1, 0, 0, 0, 1142, 1143, 3, 433, 216, 0, 1143, 1144, + 3, 407, 203, 0, 1144, 1145, 3, 415, 207, 0, 1145, 1146, 3, 425, 212, 0, + 1146, 1147, 3, 405, 202, 0, 1147, 1148, 3, 407, 203, 0, 1148, 1149, 3, + 445, 222, 0, 1149, 242, 1, 0, 0, 0, 1150, 1151, 3, 433, 216, 0, 1151, 1152, + 3, 407, 203, 0, 1152, 1153, 3, 421, 210, 0, 1153, 1154, 3, 407, 203, 0, + 1154, 1155, 3, 399, 199, 0, 1155, 1156, 3, 435, 217, 0, 1156, 1157, 3, + 407, 203, 0, 1157, 244, 1, 0, 0, 0, 1158, 1159, 3, 433, 216, 0, 1159, 1160, + 3, 407, 203, 0, 1160, 1161, 3, 425, 212, 0, 1161, 1162, 3, 399, 199, 0, + 1162, 1163, 3, 423, 211, 0, 1163, 1164, 3, 407, 203, 0, 1164, 246, 1, 0, + 0, 0, 1165, 1166, 3, 433, 216, 0, 1166, 1167, 3, 407, 203, 0, 1167, 1168, + 3, 429, 214, 0, 1168, 1169, 3, 421, 210, 0, 1169, 1170, 3, 399, 199, 0, + 1170, 1171, 3, 403, 201, 0, 1171, 1172, 3, 407, 203, 0, 1172, 248, 1, 0, + 0, 0, 1173, 1174, 3, 433, 216, 0, 1174, 1175, 3, 407, 203, 0, 1175, 1176, + 3, 435, 217, 0, 1176, 1177, 3, 437, 218, 0, 1177, 1178, 3, 433, 216, 0, + 1178, 1179, 3, 415, 207, 0, 1179, 1180, 3, 403, 201, 0, 1180, 1181, 3, + 437, 218, 0, 1181, 250, 1, 0, 0, 0, 1182, 1183, 3, 433, 216, 0, 1183, 1184, + 3, 407, 203, 0, 1184, 1185, 3, 437, 218, 0, 1185, 1186, 3, 439, 219, 0, + 1186, 1187, 3, 433, 216, 0, 1187, 1188, 3, 425, 212, 0, 1188, 1189, 3, + 415, 207, 0, 1189, 1190, 3, 425, 212, 0, 1190, 1191, 3, 411, 205, 0, 1191, + 252, 1, 0, 0, 0, 1192, 1193, 3, 433, 216, 0, 1193, 1194, 3, 415, 207, 0, + 1194, 1195, 3, 411, 205, 0, 1195, 1196, 3, 413, 206, 0, 1196, 1197, 3, + 437, 218, 0, 1197, 254, 1, 0, 0, 0, 1198, 1199, 3, 433, 216, 0, 1199, 1200, + 3, 427, 213, 0, 1200, 1201, 3, 421, 210, 0, 1201, 1202, 3, 421, 210, 0, + 1202, 1203, 3, 401, 200, 0, 1203, 1204, 3, 399, 199, 0, 1204, 1205, 3, + 403, 201, 0, 1205, 1206, 3, 419, 209, 0, 1206, 256, 1, 0, 0, 0, 1207, 1208, + 3, 433, 216, 0, 1208, 1209, 3, 427, 213, 0, 1209, 1210, 3, 443, 221, 0, + 1210, 258, 1, 0, 0, 0, 1211, 1212, 3, 433, 216, 0, 1212, 1213, 3, 427, + 213, 0, 1213, 1214, 3, 443, 221, 0, 1214, 1215, 3, 435, 217, 0, 1215, 260, + 1, 0, 0, 0, 1216, 1217, 3, 435, 217, 0, 1217, 1218, 3, 399, 199, 0, 1218, + 1219, 3, 441, 220, 0, 1219, 1220, 3, 407, 203, 0, 1220, 1221, 3, 429, 214, + 0, 1221, 1222, 3, 427, 213, 0, 1222, 1223, 3, 415, 207, 0, 1223, 1224, + 3, 425, 212, 0, 1224, 1225, 3, 437, 218, 0, 1225, 262, 1, 0, 0, 0, 1226, + 1227, 3, 435, 217, 0, 1227, 1228, 3, 407, 203, 0, 1228, 1229, 3, 421, 210, + 0, 1229, 1230, 3, 407, 203, 0, 1230, 1231, 3, 403, 201, 0, 1231, 1232, + 3, 437, 218, 0, 1232, 264, 1, 0, 0, 0, 1233, 1234, 3, 435, 217, 0, 1234, + 1235, 3, 407, 203, 0, 1235, 1236, 3, 437, 218, 0, 1236, 266, 1, 0, 0, 0, + 1237, 1238, 3, 435, 217, 0, 1238, 1239, 3, 437, 218, 0, 1239, 1240, 3, + 433, 216, 0, 1240, 1241, 3, 415, 207, 0, 1241, 1242, 3, 403, 201, 0, 1242, + 1243, 3, 437, 218, 0, 1243, 268, 1, 0, 0, 0, 1244, 1245, 3, 437, 218, 0, + 1245, 1246, 3, 399, 199, 0, 1246, 1247, 3, 401, 200, 0, 1247, 1248, 3, + 421, 210, 0, 1248, 1249, 3, 407, 203, 0, 1249, 270, 1, 0, 0, 0, 1250, 1251, + 3, 437, 218, 0, 1251, 1252, 3, 407, 203, 0, 1252, 1253, 3, 423, 211, 0, + 1253, 1254, 3, 429, 214, 0, 1254, 272, 1, 0, 0, 0, 1255, 1256, 3, 437, + 218, 0, 1256, 1257, 3, 407, 203, 0, 1257, 1258, 3, 423, 211, 0, 1258, 1259, + 3, 429, 214, 0, 1259, 1260, 3, 427, 213, 0, 1260, 1261, 3, 433, 216, 0, + 1261, 1262, 3, 399, 199, 0, 1262, 1263, 3, 433, 216, 0, 1263, 1264, 3, + 447, 223, 0, 1264, 274, 1, 0, 0, 0, 1265, 1266, 3, 437, 218, 0, 1266, 1267, + 3, 413, 206, 0, 1267, 1268, 3, 407, 203, 0, 1268, 1269, 3, 425, 212, 0, + 1269, 276, 1, 0, 0, 0, 1270, 1271, 3, 437, 218, 0, 1271, 1272, 3, 427, + 213, 0, 1272, 278, 1, 0, 0, 0, 1273, 1274, 3, 437, 218, 0, 1274, 1275, + 3, 433, 216, 0, 1275, 1276, 3, 399, 199, 0, 1276, 1277, 3, 425, 212, 0, + 1277, 1278, 3, 435, 217, 0, 1278, 1279, 3, 399, 199, 0, 1279, 1280, 3, + 403, 201, 0, 1280, 1281, 3, 437, 218, 0, 1281, 1282, 3, 415, 207, 0, 1282, + 1283, 3, 427, 213, 0, 1283, 1284, 3, 425, 212, 0, 1284, 280, 1, 0, 0, 0, + 1285, 1286, 3, 437, 218, 0, 1286, 1287, 3, 433, 216, 0, 1287, 1288, 3, + 415, 207, 0, 1288, 1289, 3, 411, 205, 0, 1289, 1290, 3, 411, 205, 0, 1290, + 1291, 3, 407, 203, 0, 1291, 1292, 3, 433, 216, 0, 1292, 282, 1, 0, 0, 0, + 1293, 1294, 3, 439, 219, 0, 1294, 1295, 3, 425, 212, 0, 1295, 1296, 3, + 415, 207, 0, 1296, 1297, 3, 427, 213, 0, 1297, 1298, 3, 425, 212, 0, 1298, + 284, 1, 0, 0, 0, 1299, 1300, 3, 439, 219, 0, 1300, 1301, 3, 425, 212, 0, + 1301, 1302, 3, 415, 207, 0, 1302, 1303, 3, 431, 215, 0, 1303, 1304, 3, + 439, 219, 0, 1304, 1305, 3, 407, 203, 0, 1305, 286, 1, 0, 0, 0, 1306, 1307, + 3, 439, 219, 0, 1307, 1308, 3, 429, 214, 0, 1308, 1309, 3, 405, 202, 0, + 1309, 1310, 3, 399, 199, 0, 1310, 1311, 3, 437, 218, 0, 1311, 1312, 3, + 407, 203, 0, 1312, 288, 1, 0, 0, 0, 1313, 1314, 3, 439, 219, 0, 1314, 1315, + 3, 435, 217, 0, 1315, 1316, 3, 415, 207, 0, 1316, 1317, 3, 425, 212, 0, + 1317, 1318, 3, 411, 205, 0, 1318, 290, 1, 0, 0, 0, 1319, 1320, 3, 441, + 220, 0, 1320, 1321, 3, 399, 199, 0, 1321, 1322, 3, 403, 201, 0, 1322, 1323, + 3, 439, 219, 0, 1323, 1324, 3, 439, 219, 0, 1324, 1325, 3, 423, 211, 0, + 1325, 292, 1, 0, 0, 0, 1326, 1327, 3, 441, 220, 0, 1327, 1328, 3, 399, + 199, 0, 1328, 1329, 3, 421, 210, 0, 1329, 1330, 3, 439, 219, 0, 1330, 1331, + 3, 407, 203, 0, 1331, 1332, 3, 435, 217, 0, 1332, 294, 1, 0, 0, 0, 1333, + 1334, 3, 441, 220, 0, 1334, 1335, 3, 415, 207, 0, 1335, 1336, 3, 407, 203, + 0, 1336, 1337, 3, 443, 221, 0, 1337, 296, 1, 0, 0, 0, 1338, 1339, 3, 441, + 220, 0, 1339, 1340, 3, 415, 207, 0, 1340, 1341, 3, 433, 216, 0, 1341, 1342, + 3, 437, 218, 0, 1342, 1343, 3, 439, 219, 0, 1343, 1344, 3, 399, 199, 0, + 1344, 1345, 3, 421, 210, 0, 1345, 298, 1, 0, 0, 0, 1346, 1347, 3, 443, + 221, 0, 1347, 1348, 3, 413, 206, 0, 1348, 1349, 3, 407, 203, 0, 1349, 1350, + 3, 425, 212, 0, 1350, 300, 1, 0, 0, 0, 1351, 1352, 3, 443, 221, 0, 1352, + 1353, 3, 413, 206, 0, 1353, 1354, 3, 407, 203, 0, 1354, 1355, 3, 433, 216, + 0, 1355, 1356, 3, 407, 203, 0, 1356, 302, 1, 0, 0, 0, 1357, 1358, 3, 443, + 221, 0, 1358, 1359, 3, 415, 207, 0, 1359, 1360, 3, 437, 218, 0, 1360, 1361, + 3, 413, 206, 0, 1361, 304, 1, 0, 0, 0, 1362, 1363, 3, 443, 221, 0, 1363, + 1364, 3, 415, 207, 0, 1364, 1365, 3, 437, 218, 0, 1365, 1366, 3, 413, 206, + 0, 1366, 1367, 3, 427, 213, 0, 1367, 1368, 3, 439, 219, 0, 1368, 1369, + 3, 437, 218, 0, 1369, 306, 1, 0, 0, 0, 1370, 1371, 3, 409, 204, 0, 1371, + 1372, 3, 415, 207, 0, 1372, 1373, 3, 433, 216, 0, 1373, 1374, 3, 435, 217, + 0, 1374, 1375, 3, 437, 218, 0, 1375, 1376, 5, 95, 0, 0, 1376, 1377, 3, + 441, 220, 0, 1377, 1378, 3, 399, 199, 0, 1378, 1379, 3, 421, 210, 0, 1379, + 1380, 3, 439, 219, 0, 1380, 1381, 3, 407, 203, 0, 1381, 308, 1, 0, 0, 0, + 1382, 1383, 3, 427, 213, 0, 1383, 1384, 3, 441, 220, 0, 1384, 1385, 3, + 407, 203, 0, 1385, 1386, 3, 433, 216, 0, 1386, 310, 1, 0, 0, 0, 1387, 1388, + 3, 429, 214, 0, 1388, 1389, 3, 399, 199, 0, 1389, 1390, 3, 433, 216, 0, + 1390, 1391, 3, 437, 218, 0, 1391, 1392, 3, 415, 207, 0, 1392, 1393, 3, + 437, 218, 0, 1393, 1394, 3, 415, 207, 0, 1394, 1395, 3, 427, 213, 0, 1395, + 1396, 3, 425, 212, 0, 1396, 312, 1, 0, 0, 0, 1397, 1398, 3, 433, 216, 0, + 1398, 1399, 3, 399, 199, 0, 1399, 1400, 3, 425, 212, 0, 1400, 1401, 3, + 411, 205, 0, 1401, 1402, 3, 407, 203, 0, 1402, 314, 1, 0, 0, 0, 1403, 1404, + 3, 429, 214, 0, 1404, 1405, 3, 433, 216, 0, 1405, 1406, 3, 407, 203, 0, + 1406, 1407, 3, 403, 201, 0, 1407, 1408, 3, 407, 203, 0, 1408, 1409, 3, + 405, 202, 0, 1409, 1410, 3, 415, 207, 0, 1410, 1411, 3, 425, 212, 0, 1411, + 1412, 3, 411, 205, 0, 1412, 316, 1, 0, 0, 0, 1413, 1414, 3, 439, 219, 0, + 1414, 1415, 3, 425, 212, 0, 1415, 1416, 3, 401, 200, 0, 1416, 1417, 3, + 427, 213, 0, 1417, 1418, 3, 439, 219, 0, 1418, 1419, 3, 425, 212, 0, 1419, + 1420, 3, 405, 202, 0, 1420, 1421, 3, 407, 203, 0, 1421, 1422, 3, 405, 202, + 0, 1422, 318, 1, 0, 0, 0, 1423, 1424, 3, 403, 201, 0, 1424, 1425, 3, 439, + 219, 0, 1425, 1426, 3, 433, 216, 0, 1426, 1427, 3, 433, 216, 0, 1427, 1428, + 3, 407, 203, 0, 1428, 1429, 3, 425, 212, 0, 1429, 1430, 3, 437, 218, 0, + 1430, 320, 1, 0, 0, 0, 1431, 1432, 3, 409, 204, 0, 1432, 1433, 3, 427, + 213, 0, 1433, 1434, 3, 421, 210, 0, 1434, 1435, 3, 421, 210, 0, 1435, 1436, + 3, 427, 213, 0, 1436, 1437, 3, 443, 221, 0, 1437, 1438, 3, 415, 207, 0, + 1438, 1439, 3, 425, 212, 0, 1439, 1440, 3, 411, 205, 0, 1440, 322, 1, 0, + 0, 0, 1441, 1442, 3, 403, 201, 0, 1442, 1443, 3, 439, 219, 0, 1443, 1444, + 3, 423, 211, 0, 1444, 1445, 3, 407, 203, 0, 1445, 1446, 5, 95, 0, 0, 1446, + 1447, 3, 405, 202, 0, 1447, 1448, 3, 415, 207, 0, 1448, 1449, 3, 435, 217, + 0, 1449, 1450, 3, 437, 218, 0, 1450, 324, 1, 0, 0, 0, 1451, 1452, 3, 405, + 202, 0, 1452, 1453, 3, 407, 203, 0, 1453, 1454, 3, 425, 212, 0, 1454, 1455, + 3, 435, 217, 0, 1455, 1456, 3, 407, 203, 0, 1456, 1457, 5, 95, 0, 0, 1457, + 1458, 3, 433, 216, 0, 1458, 1459, 3, 399, 199, 0, 1459, 1460, 3, 425, 212, + 0, 1460, 1461, 3, 419, 209, 0, 1461, 326, 1, 0, 0, 0, 1462, 1463, 3, 421, + 210, 0, 1463, 1464, 3, 399, 199, 0, 1464, 1465, 3, 411, 205, 0, 1465, 328, + 1, 0, 0, 0, 1466, 1467, 3, 421, 210, 0, 1467, 1468, 3, 399, 199, 0, 1468, + 1469, 3, 435, 217, 0, 1469, 1470, 3, 437, 218, 0, 1470, 1471, 5, 95, 0, + 0, 1471, 1472, 3, 441, 220, 0, 1472, 1473, 3, 399, 199, 0, 1473, 1474, + 3, 421, 210, 0, 1474, 1475, 3, 439, 219, 0, 1475, 1476, 3, 407, 203, 0, + 1476, 330, 1, 0, 0, 0, 1477, 1478, 3, 421, 210, 0, 1478, 1479, 3, 407, + 203, 0, 1479, 1480, 3, 399, 199, 0, 1480, 1481, 3, 405, 202, 0, 1481, 332, + 1, 0, 0, 0, 1482, 1483, 3, 425, 212, 0, 1483, 1484, 3, 437, 218, 0, 1484, + 1485, 3, 413, 206, 0, 1485, 1486, 5, 95, 0, 0, 1486, 1487, 3, 441, 220, + 0, 1487, 1488, 3, 399, 199, 0, 1488, 1489, 3, 421, 210, 0, 1489, 1490, + 3, 439, 219, 0, 1490, 1491, 3, 407, 203, 0, 1491, 334, 1, 0, 0, 0, 1492, + 1493, 3, 425, 212, 0, 1493, 1494, 3, 437, 218, 0, 1494, 1495, 3, 415, 207, + 0, 1495, 1496, 3, 421, 210, 0, 1496, 1497, 3, 407, 203, 0, 1497, 336, 1, + 0, 0, 0, 1498, 1499, 3, 429, 214, 0, 1499, 1500, 3, 407, 203, 0, 1500, + 1501, 3, 433, 216, 0, 1501, 1502, 3, 403, 201, 0, 1502, 1503, 3, 407, 203, + 0, 1503, 1504, 3, 425, 212, 0, 1504, 1505, 3, 437, 218, 0, 1505, 1506, + 5, 95, 0, 0, 1506, 1507, 3, 433, 216, 0, 1507, 1508, 3, 399, 199, 0, 1508, + 1509, 3, 425, 212, 0, 1509, 1510, 3, 419, 209, 0, 1510, 338, 1, 0, 0, 0, + 1511, 1512, 3, 433, 216, 0, 1512, 1513, 3, 399, 199, 0, 1513, 1514, 3, + 425, 212, 0, 1514, 1515, 3, 419, 209, 0, 1515, 340, 1, 0, 0, 0, 1516, 1517, + 3, 433, 216, 0, 1517, 1518, 3, 427, 213, 0, 1518, 1519, 3, 443, 221, 0, + 1519, 1520, 5, 95, 0, 0, 1520, 1521, 3, 425, 212, 0, 1521, 1522, 3, 439, + 219, 0, 1522, 1523, 3, 423, 211, 0, 1523, 1524, 3, 401, 200, 0, 1524, 1525, + 3, 407, 203, 0, 1525, 1526, 3, 433, 216, 0, 1526, 342, 1, 0, 0, 0, 1527, + 1528, 3, 411, 205, 0, 1528, 1529, 3, 407, 203, 0, 1529, 1530, 3, 425, 212, + 0, 1530, 1531, 3, 407, 203, 0, 1531, 1532, 3, 433, 216, 0, 1532, 1533, + 3, 399, 199, 0, 1533, 1534, 3, 437, 218, 0, 1534, 1535, 3, 407, 203, 0, + 1535, 1536, 3, 405, 202, 0, 1536, 344, 1, 0, 0, 0, 1537, 1538, 3, 399, + 199, 0, 1538, 1539, 3, 421, 210, 0, 1539, 1540, 3, 443, 221, 0, 1540, 1541, + 3, 399, 199, 0, 1541, 1542, 3, 447, 223, 0, 1542, 1543, 3, 435, 217, 0, + 1543, 346, 1, 0, 0, 0, 1544, 1545, 3, 435, 217, 0, 1545, 1546, 3, 437, + 218, 0, 1546, 1547, 3, 427, 213, 0, 1547, 1548, 3, 433, 216, 0, 1548, 1549, + 3, 407, 203, 0, 1549, 1550, 3, 405, 202, 0, 1550, 348, 1, 0, 0, 0, 1551, + 1552, 3, 437, 218, 0, 1552, 1553, 3, 433, 216, 0, 1553, 1554, 3, 439, 219, + 0, 1554, 1555, 3, 407, 203, 0, 1555, 350, 1, 0, 0, 0, 1556, 1557, 3, 409, + 204, 0, 1557, 1558, 3, 399, 199, 0, 1558, 1559, 3, 421, 210, 0, 1559, 1560, + 3, 435, 217, 0, 1560, 1561, 3, 407, 203, 0, 1561, 352, 1, 0, 0, 0, 1562, + 1563, 3, 443, 221, 0, 1563, 1564, 3, 415, 207, 0, 1564, 1565, 3, 425, 212, + 0, 1565, 1566, 3, 405, 202, 0, 1566, 1567, 3, 427, 213, 0, 1567, 1568, + 3, 443, 221, 0, 1568, 354, 1, 0, 0, 0, 1569, 1570, 3, 425, 212, 0, 1570, + 1571, 3, 439, 219, 0, 1571, 1572, 3, 421, 210, 0, 1572, 1573, 3, 421, 210, + 0, 1573, 1574, 3, 435, 217, 0, 1574, 356, 1, 0, 0, 0, 1575, 1576, 3, 409, + 204, 0, 1576, 1577, 3, 415, 207, 0, 1577, 1578, 3, 433, 216, 0, 1578, 1579, + 3, 435, 217, 0, 1579, 1580, 3, 437, 218, 0, 1580, 358, 1, 0, 0, 0, 1581, + 1582, 3, 421, 210, 0, 1582, 1583, 3, 399, 199, 0, 1583, 1584, 3, 435, 217, + 0, 1584, 1585, 3, 437, 218, 0, 1585, 360, 1, 0, 0, 0, 1586, 1587, 3, 409, + 204, 0, 1587, 1588, 3, 415, 207, 0, 1588, 1589, 3, 421, 210, 0, 1589, 1590, + 3, 437, 218, 0, 1590, 1591, 3, 407, 203, 0, 1591, 1592, 3, 433, 216, 0, + 1592, 362, 1, 0, 0, 0, 1593, 1594, 3, 411, 205, 0, 1594, 1595, 3, 433, + 216, 0, 1595, 1596, 3, 427, 213, 0, 1596, 1597, 3, 439, 219, 0, 1597, 1598, + 3, 429, 214, 0, 1598, 1599, 3, 435, 217, 0, 1599, 364, 1, 0, 0, 0, 1600, + 1601, 3, 407, 203, 0, 1601, 1602, 3, 445, 222, 0, 1602, 1603, 3, 403, 201, + 0, 1603, 1604, 3, 421, 210, 0, 1604, 1605, 3, 439, 219, 0, 1605, 1606, + 3, 405, 202, 0, 1606, 1607, 3, 407, 203, 0, 1607, 366, 1, 0, 0, 0, 1608, + 1609, 3, 437, 218, 0, 1609, 1610, 3, 415, 207, 0, 1610, 1611, 3, 407, 203, + 0, 1611, 1612, 3, 435, 217, 0, 1612, 368, 1, 0, 0, 0, 1613, 1614, 3, 427, + 213, 0, 1614, 1615, 3, 437, 218, 0, 1615, 1616, 3, 413, 206, 0, 1616, 1617, + 3, 407, 203, 0, 1617, 1618, 3, 433, 216, 0, 1618, 1619, 3, 435, 217, 0, + 1619, 370, 1, 0, 0, 0, 1620, 1621, 3, 405, 202, 0, 1621, 1622, 3, 427, + 213, 0, 1622, 372, 1, 0, 0, 0, 1623, 1624, 3, 425, 212, 0, 1624, 1625, + 3, 427, 213, 0, 1625, 1626, 3, 437, 218, 0, 1626, 1627, 3, 413, 206, 0, + 1627, 1628, 3, 415, 207, 0, 1628, 1629, 3, 425, 212, 0, 1629, 1630, 3, + 411, 205, 0, 1630, 374, 1, 0, 0, 0, 1631, 1637, 5, 34, 0, 0, 1632, 1636, + 8, 0, 0, 0, 1633, 1634, 5, 34, 0, 0, 1634, 1636, 5, 34, 0, 0, 1635, 1632, + 1, 0, 0, 0, 1635, 1633, 1, 0, 0, 0, 1636, 1639, 1, 0, 0, 0, 1637, 1635, + 1, 0, 0, 0, 1637, 1638, 1, 0, 0, 0, 1638, 1640, 1, 0, 0, 0, 1639, 1637, + 1, 0, 0, 0, 1640, 1667, 5, 34, 0, 0, 1641, 1647, 5, 96, 0, 0, 1642, 1646, + 8, 1, 0, 0, 1643, 1644, 5, 96, 0, 0, 1644, 1646, 5, 96, 0, 0, 1645, 1642, + 1, 0, 0, 0, 1645, 1643, 1, 0, 0, 0, 1646, 1649, 1, 0, 0, 0, 1647, 1645, + 1, 0, 0, 0, 1647, 1648, 1, 0, 0, 0, 1648, 1650, 1, 0, 0, 0, 1649, 1647, + 1, 0, 0, 0, 1650, 1667, 5, 96, 0, 0, 1651, 1655, 5, 91, 0, 0, 1652, 1654, + 8, 2, 0, 0, 1653, 1652, 1, 0, 0, 0, 1654, 1657, 1, 0, 0, 0, 1655, 1653, + 1, 0, 0, 0, 1655, 1656, 1, 0, 0, 0, 1656, 1658, 1, 0, 0, 0, 1657, 1655, + 1, 0, 0, 0, 1658, 1667, 5, 93, 0, 0, 1659, 1663, 7, 3, 0, 0, 1660, 1662, + 7, 4, 0, 0, 1661, 1660, 1, 0, 0, 0, 1662, 1665, 1, 0, 0, 0, 1663, 1661, + 1, 0, 0, 0, 1663, 1664, 1, 0, 0, 0, 1664, 1667, 1, 0, 0, 0, 1665, 1663, + 1, 0, 0, 0, 1666, 1631, 1, 0, 0, 0, 1666, 1641, 1, 0, 0, 0, 1666, 1651, + 1, 0, 0, 0, 1666, 1659, 1, 0, 0, 0, 1667, 376, 1, 0, 0, 0, 1668, 1670, + 3, 397, 198, 0, 1669, 1668, 1, 0, 0, 0, 1670, 1671, 1, 0, 0, 0, 1671, 1669, + 1, 0, 0, 0, 1671, 1672, 1, 0, 0, 0, 1672, 1680, 1, 0, 0, 0, 1673, 1677, + 5, 46, 0, 0, 1674, 1676, 3, 397, 198, 0, 1675, 1674, 1, 0, 0, 0, 1676, + 1679, 1, 0, 0, 0, 1677, 1675, 1, 0, 0, 0, 1677, 1678, 1, 0, 0, 0, 1678, + 1681, 1, 0, 0, 0, 1679, 1677, 1, 0, 0, 0, 1680, 1673, 1, 0, 0, 0, 1680, + 1681, 1, 0, 0, 0, 1681, 1689, 1, 0, 0, 0, 1682, 1684, 5, 46, 0, 0, 1683, + 1685, 3, 397, 198, 0, 1684, 1683, 1, 0, 0, 0, 1685, 1686, 1, 0, 0, 0, 1686, + 1684, 1, 0, 0, 0, 1686, 1687, 1, 0, 0, 0, 1687, 1689, 1, 0, 0, 0, 1688, + 1669, 1, 0, 0, 0, 1688, 1682, 1, 0, 0, 0, 1689, 1699, 1, 0, 0, 0, 1690, + 1692, 3, 407, 203, 0, 1691, 1693, 7, 5, 0, 0, 1692, 1691, 1, 0, 0, 0, 1692, + 1693, 1, 0, 0, 0, 1693, 1695, 1, 0, 0, 0, 1694, 1696, 3, 397, 198, 0, 1695, + 1694, 1, 0, 0, 0, 1696, 1697, 1, 0, 0, 0, 1697, 1695, 1, 0, 0, 0, 1697, + 1698, 1, 0, 0, 0, 1698, 1700, 1, 0, 0, 0, 1699, 1690, 1, 0, 0, 0, 1699, + 1700, 1, 0, 0, 0, 1700, 1710, 1, 0, 0, 0, 1701, 1702, 5, 48, 0, 0, 1702, + 1703, 5, 120, 0, 0, 1703, 1705, 1, 0, 0, 0, 1704, 1706, 3, 395, 197, 0, + 1705, 1704, 1, 0, 0, 0, 1706, 1707, 1, 0, 0, 0, 1707, 1705, 1, 0, 0, 0, + 1707, 1708, 1, 0, 0, 0, 1708, 1710, 1, 0, 0, 0, 1709, 1688, 1, 0, 0, 0, + 1709, 1701, 1, 0, 0, 0, 1710, 378, 1, 0, 0, 0, 1711, 1715, 5, 63, 0, 0, + 1712, 1714, 3, 397, 198, 0, 1713, 1712, 1, 0, 0, 0, 1714, 1717, 1, 0, 0, + 0, 1715, 1713, 1, 0, 0, 0, 1715, 1716, 1, 0, 0, 0, 1716, 380, 1, 0, 0, + 0, 1717, 1715, 1, 0, 0, 0, 1718, 1719, 7, 6, 0, 0, 1719, 1720, 3, 375, + 187, 0, 1720, 382, 1, 0, 0, 0, 1721, 1727, 5, 39, 0, 0, 1722, 1726, 8, + 7, 0, 0, 1723, 1724, 5, 39, 0, 0, 1724, 1726, 5, 39, 0, 0, 1725, 1722, + 1, 0, 0, 0, 1725, 1723, 1, 0, 0, 0, 1726, 1729, 1, 0, 0, 0, 1727, 1725, + 1, 0, 0, 0, 1727, 1728, 1, 0, 0, 0, 1728, 1730, 1, 0, 0, 0, 1729, 1727, + 1, 0, 0, 0, 1730, 1731, 5, 39, 0, 0, 1731, 384, 1, 0, 0, 0, 1732, 1733, + 3, 445, 222, 0, 1733, 1734, 3, 383, 191, 0, 1734, 386, 1, 0, 0, 0, 1735, + 1736, 5, 45, 0, 0, 1736, 1737, 5, 45, 0, 0, 1737, 1741, 1, 0, 0, 0, 1738, + 1740, 8, 8, 0, 0, 1739, 1738, 1, 0, 0, 0, 1740, 1743, 1, 0, 0, 0, 1741, + 1739, 1, 0, 0, 0, 1741, 1742, 1, 0, 0, 0, 1742, 1749, 1, 0, 0, 0, 1743, + 1741, 1, 0, 0, 0, 1744, 1746, 5, 13, 0, 0, 1745, 1744, 1, 0, 0, 0, 1745, + 1746, 1, 0, 0, 0, 1746, 1747, 1, 0, 0, 0, 1747, 1750, 5, 10, 0, 0, 1748, + 1750, 5, 0, 0, 1, 1749, 1745, 1, 0, 0, 0, 1749, 1748, 1, 0, 0, 0, 1750, + 1751, 1, 0, 0, 0, 1751, 1752, 6, 193, 0, 0, 1752, 388, 1, 0, 0, 0, 1753, + 1754, 5, 47, 0, 0, 1754, 1755, 5, 42, 0, 0, 1755, 1759, 1, 0, 0, 0, 1756, + 1758, 9, 0, 0, 0, 1757, 1756, 1, 0, 0, 0, 1758, 1761, 1, 0, 0, 0, 1759, + 1760, 1, 0, 0, 0, 1759, 1757, 1, 0, 0, 0, 1760, 1762, 1, 0, 0, 0, 1761, + 1759, 1, 0, 0, 0, 1762, 1763, 5, 42, 0, 0, 1763, 1764, 5, 47, 0, 0, 1764, + 1765, 1, 0, 0, 0, 1765, 1766, 6, 194, 0, 0, 1766, 390, 1, 0, 0, 0, 1767, + 1768, 7, 9, 0, 0, 1768, 1769, 1, 0, 0, 0, 1769, 1770, 6, 195, 0, 0, 1770, + 392, 1, 0, 0, 0, 1771, 1772, 9, 0, 0, 0, 1772, 394, 1, 0, 0, 0, 1773, 1774, + 7, 10, 0, 0, 1774, 396, 1, 0, 0, 0, 1775, 1776, 7, 11, 0, 0, 1776, 398, + 1, 0, 0, 0, 1777, 1778, 7, 12, 0, 0, 1778, 400, 1, 0, 0, 0, 1779, 1780, + 7, 13, 0, 0, 1780, 402, 1, 0, 0, 0, 1781, 1782, 7, 14, 0, 0, 1782, 404, + 1, 0, 0, 0, 1783, 1784, 7, 15, 0, 0, 1784, 406, 1, 0, 0, 0, 1785, 1786, + 7, 16, 0, 0, 1786, 408, 1, 0, 0, 0, 1787, 1788, 7, 17, 0, 0, 1788, 410, + 1, 0, 0, 0, 1789, 1790, 7, 18, 0, 0, 1790, 412, 1, 0, 0, 0, 1791, 1792, + 7, 19, 0, 0, 1792, 414, 1, 0, 0, 0, 1793, 1794, 7, 20, 0, 0, 1794, 416, + 1, 0, 0, 0, 1795, 1796, 7, 21, 0, 0, 1796, 418, 1, 0, 0, 0, 1797, 1798, + 7, 22, 0, 0, 1798, 420, 1, 0, 0, 0, 1799, 1800, 7, 23, 0, 0, 1800, 422, + 1, 0, 0, 0, 1801, 1802, 7, 24, 0, 0, 1802, 424, 1, 0, 0, 0, 1803, 1804, + 7, 25, 0, 0, 1804, 426, 1, 0, 0, 0, 1805, 1806, 7, 26, 0, 0, 1806, 428, + 1, 0, 0, 0, 1807, 1808, 7, 27, 0, 0, 1808, 430, 1, 0, 0, 0, 1809, 1810, + 7, 28, 0, 0, 1810, 432, 1, 0, 0, 0, 1811, 1812, 7, 29, 0, 0, 1812, 434, + 1, 0, 0, 0, 1813, 1814, 7, 30, 0, 0, 1814, 436, 1, 0, 0, 0, 1815, 1816, + 7, 31, 0, 0, 1816, 438, 1, 0, 0, 0, 1817, 1818, 7, 32, 0, 0, 1818, 440, + 1, 0, 0, 0, 1819, 1820, 7, 33, 0, 0, 1820, 442, 1, 0, 0, 0, 1821, 1822, + 7, 34, 0, 0, 1822, 444, 1, 0, 0, 0, 1823, 1824, 7, 35, 0, 0, 1824, 446, + 1, 0, 0, 0, 1825, 1826, 7, 36, 0, 0, 1826, 448, 1, 0, 0, 0, 1827, 1828, + 7, 37, 0, 0, 1828, 450, 1, 0, 0, 0, 25, 0, 1635, 1637, 1645, 1647, 1655, + 1663, 1666, 1671, 1677, 1680, 1686, 1688, 1692, 1697, 1699, 1707, 1709, + 1715, 1725, 1727, 1741, 1745, 1749, 1759, 1, 0, 1, 0, } deserializer := antlr.NewATNDeserializer(nil) staticData.atn = deserializer.Deserialize(staticData.serializedATN) @@ -984,7 +988,7 @@ func sqlitelexerLexerInit() { // NewSQLiteLexer(). You can call this function if you wish to initialize the static state ahead // of time. func SQLiteLexerInit() { - staticData := &sqlitelexerLexerStaticData + staticData := &SQLiteLexerLexerStaticData staticData.once.Do(sqlitelexerLexerInit) } @@ -993,13 +997,13 @@ func NewSQLiteLexer(input antlr.CharStream) *SQLiteLexer { SQLiteLexerInit() l := new(SQLiteLexer) l.BaseLexer = antlr.NewBaseLexer(input) - staticData := &sqlitelexerLexerStaticData - l.Interpreter = antlr.NewLexerATNSimulator(l, staticData.atn, staticData.decisionToDFA, staticData.predictionContextCache) - l.channelNames = staticData.channelNames - l.modeNames = staticData.modeNames - l.RuleNames = staticData.ruleNames - l.LiteralNames = staticData.literalNames - l.SymbolicNames = staticData.symbolicNames + staticData := &SQLiteLexerLexerStaticData + l.Interpreter = antlr.NewLexerATNSimulator(l, staticData.atn, staticData.decisionToDFA, staticData.PredictionContextCache) + l.channelNames = staticData.ChannelNames + l.modeNames = staticData.ModeNames + l.RuleNames = staticData.RuleNames + l.LiteralNames = staticData.LiteralNames + l.SymbolicNames = staticData.SymbolicNames l.GrammarFileName = "SQLiteLexer.g4" // TODO: l.EOF = antlr.TokenEOF @@ -1016,191 +1020,193 @@ const ( SQLiteLexerASSIGN = 6 SQLiteLexerSTAR = 7 SQLiteLexerPLUS = 8 - SQLiteLexerMINUS = 9 - SQLiteLexerTILDE = 10 - SQLiteLexerPIPE2 = 11 - SQLiteLexerDIV = 12 - SQLiteLexerMOD = 13 - SQLiteLexerLT2 = 14 - SQLiteLexerGT2 = 15 - SQLiteLexerAMP = 16 - SQLiteLexerPIPE = 17 - SQLiteLexerLT = 18 - SQLiteLexerLT_EQ = 19 - SQLiteLexerGT = 20 - SQLiteLexerGT_EQ = 21 - SQLiteLexerEQ = 22 - SQLiteLexerNOT_EQ1 = 23 - SQLiteLexerNOT_EQ2 = 24 - SQLiteLexerABORT_ = 25 - SQLiteLexerACTION_ = 26 - SQLiteLexerADD_ = 27 - SQLiteLexerAFTER_ = 28 - SQLiteLexerALL_ = 29 - SQLiteLexerALTER_ = 30 - SQLiteLexerANALYZE_ = 31 - SQLiteLexerAND_ = 32 - SQLiteLexerAS_ = 33 - SQLiteLexerASC_ = 34 - SQLiteLexerATTACH_ = 35 - SQLiteLexerAUTOINCREMENT_ = 36 - SQLiteLexerBEFORE_ = 37 - SQLiteLexerBEGIN_ = 38 - SQLiteLexerBETWEEN_ = 39 - SQLiteLexerBY_ = 40 - SQLiteLexerCASCADE_ = 41 - SQLiteLexerCASE_ = 42 - SQLiteLexerCAST_ = 43 - SQLiteLexerCHECK_ = 44 - SQLiteLexerCOLLATE_ = 45 - SQLiteLexerCOLUMN_ = 46 - SQLiteLexerCOMMIT_ = 47 - SQLiteLexerCONFLICT_ = 48 - SQLiteLexerCONSTRAINT_ = 49 - SQLiteLexerCREATE_ = 50 - SQLiteLexerCROSS_ = 51 - SQLiteLexerCURRENT_DATE_ = 52 - SQLiteLexerCURRENT_TIME_ = 53 - SQLiteLexerCURRENT_TIMESTAMP_ = 54 - SQLiteLexerDATABASE_ = 55 - SQLiteLexerDEFAULT_ = 56 - SQLiteLexerDEFERRABLE_ = 57 - SQLiteLexerDEFERRED_ = 58 - SQLiteLexerDELETE_ = 59 - SQLiteLexerDESC_ = 60 - SQLiteLexerDETACH_ = 61 - SQLiteLexerDISTINCT_ = 62 - SQLiteLexerDROP_ = 63 - SQLiteLexerEACH_ = 64 - SQLiteLexerELSE_ = 65 - SQLiteLexerEND_ = 66 - SQLiteLexerESCAPE_ = 67 - SQLiteLexerEXCEPT_ = 68 - SQLiteLexerEXCLUSIVE_ = 69 - SQLiteLexerEXISTS_ = 70 - SQLiteLexerEXPLAIN_ = 71 - SQLiteLexerFAIL_ = 72 - SQLiteLexerFOR_ = 73 - SQLiteLexerFOREIGN_ = 74 - SQLiteLexerFROM_ = 75 - SQLiteLexerFULL_ = 76 - SQLiteLexerGLOB_ = 77 - SQLiteLexerGROUP_ = 78 - SQLiteLexerHAVING_ = 79 - SQLiteLexerIF_ = 80 - SQLiteLexerIGNORE_ = 81 - SQLiteLexerIMMEDIATE_ = 82 - SQLiteLexerIN_ = 83 - SQLiteLexerINDEX_ = 84 - SQLiteLexerINDEXED_ = 85 - SQLiteLexerINITIALLY_ = 86 - SQLiteLexerINNER_ = 87 - SQLiteLexerINSERT_ = 88 - SQLiteLexerINSTEAD_ = 89 - SQLiteLexerINTERSECT_ = 90 - SQLiteLexerINTO_ = 91 - SQLiteLexerIS_ = 92 - SQLiteLexerISNULL_ = 93 - SQLiteLexerJOIN_ = 94 - SQLiteLexerKEY_ = 95 - SQLiteLexerLEFT_ = 96 - SQLiteLexerLIKE_ = 97 - SQLiteLexerLIMIT_ = 98 - SQLiteLexerMATCH_ = 99 - SQLiteLexerNATURAL_ = 100 - SQLiteLexerNO_ = 101 - SQLiteLexerNOT_ = 102 - SQLiteLexerNOTNULL_ = 103 - SQLiteLexerNULL_ = 104 - SQLiteLexerOF_ = 105 - SQLiteLexerOFFSET_ = 106 - SQLiteLexerON_ = 107 - SQLiteLexerOR_ = 108 - SQLiteLexerORDER_ = 109 - SQLiteLexerOUTER_ = 110 - SQLiteLexerPLAN_ = 111 - SQLiteLexerPRAGMA_ = 112 - SQLiteLexerPRIMARY_ = 113 - SQLiteLexerQUERY_ = 114 - SQLiteLexerRAISE_ = 115 - SQLiteLexerRECURSIVE_ = 116 - SQLiteLexerREFERENCES_ = 117 - SQLiteLexerREGEXP_ = 118 - SQLiteLexerREINDEX_ = 119 - SQLiteLexerRELEASE_ = 120 - SQLiteLexerRENAME_ = 121 - SQLiteLexerREPLACE_ = 122 - SQLiteLexerRESTRICT_ = 123 - SQLiteLexerRETURNING_ = 124 - SQLiteLexerRIGHT_ = 125 - SQLiteLexerROLLBACK_ = 126 - SQLiteLexerROW_ = 127 - SQLiteLexerROWS_ = 128 - SQLiteLexerSAVEPOINT_ = 129 - SQLiteLexerSELECT_ = 130 - SQLiteLexerSET_ = 131 - SQLiteLexerSTRICT_ = 132 - SQLiteLexerTABLE_ = 133 - SQLiteLexerTEMP_ = 134 - SQLiteLexerTEMPORARY_ = 135 - SQLiteLexerTHEN_ = 136 - SQLiteLexerTO_ = 137 - SQLiteLexerTRANSACTION_ = 138 - SQLiteLexerTRIGGER_ = 139 - SQLiteLexerUNION_ = 140 - SQLiteLexerUNIQUE_ = 141 - SQLiteLexerUPDATE_ = 142 - SQLiteLexerUSING_ = 143 - SQLiteLexerVACUUM_ = 144 - SQLiteLexerVALUES_ = 145 - SQLiteLexerVIEW_ = 146 - SQLiteLexerVIRTUAL_ = 147 - SQLiteLexerWHEN_ = 148 - SQLiteLexerWHERE_ = 149 - SQLiteLexerWITH_ = 150 - SQLiteLexerWITHOUT_ = 151 - SQLiteLexerFIRST_VALUE_ = 152 - SQLiteLexerOVER_ = 153 - SQLiteLexerPARTITION_ = 154 - SQLiteLexerRANGE_ = 155 - SQLiteLexerPRECEDING_ = 156 - SQLiteLexerUNBOUNDED_ = 157 - SQLiteLexerCURRENT_ = 158 - SQLiteLexerFOLLOWING_ = 159 - SQLiteLexerCUME_DIST_ = 160 - SQLiteLexerDENSE_RANK_ = 161 - SQLiteLexerLAG_ = 162 - SQLiteLexerLAST_VALUE_ = 163 - SQLiteLexerLEAD_ = 164 - SQLiteLexerNTH_VALUE_ = 165 - SQLiteLexerNTILE_ = 166 - SQLiteLexerPERCENT_RANK_ = 167 - SQLiteLexerRANK_ = 168 - SQLiteLexerROW_NUMBER_ = 169 - SQLiteLexerGENERATED_ = 170 - SQLiteLexerALWAYS_ = 171 - SQLiteLexerSTORED_ = 172 - SQLiteLexerTRUE_ = 173 - SQLiteLexerFALSE_ = 174 - SQLiteLexerWINDOW_ = 175 - SQLiteLexerNULLS_ = 176 - SQLiteLexerFIRST_ = 177 - SQLiteLexerLAST_ = 178 - SQLiteLexerFILTER_ = 179 - SQLiteLexerGROUPS_ = 180 - SQLiteLexerEXCLUDE_ = 181 - SQLiteLexerTIES_ = 182 - SQLiteLexerOTHERS_ = 183 - SQLiteLexerDO_ = 184 - SQLiteLexerNOTHING_ = 185 - SQLiteLexerIDENTIFIER = 186 - SQLiteLexerNUMERIC_LITERAL = 187 - SQLiteLexerNUMBERED_BIND_PARAMETER = 188 - SQLiteLexerNAMED_BIND_PARAMETER = 189 - SQLiteLexerSTRING_LITERAL = 190 - SQLiteLexerBLOB_LITERAL = 191 - SQLiteLexerSINGLE_LINE_COMMENT = 192 - SQLiteLexerMULTILINE_COMMENT = 193 - SQLiteLexerSPACES = 194 - SQLiteLexerUNEXPECTED_CHAR = 195 + SQLiteLexerPTR2 = 9 + SQLiteLexerPTR = 10 + SQLiteLexerMINUS = 11 + SQLiteLexerTILDE = 12 + SQLiteLexerPIPE2 = 13 + SQLiteLexerDIV = 14 + SQLiteLexerMOD = 15 + SQLiteLexerLT2 = 16 + SQLiteLexerGT2 = 17 + SQLiteLexerAMP = 18 + SQLiteLexerPIPE = 19 + SQLiteLexerLT = 20 + SQLiteLexerLT_EQ = 21 + SQLiteLexerGT = 22 + SQLiteLexerGT_EQ = 23 + SQLiteLexerEQ = 24 + SQLiteLexerNOT_EQ1 = 25 + SQLiteLexerNOT_EQ2 = 26 + SQLiteLexerABORT_ = 27 + SQLiteLexerACTION_ = 28 + SQLiteLexerADD_ = 29 + SQLiteLexerAFTER_ = 30 + SQLiteLexerALL_ = 31 + SQLiteLexerALTER_ = 32 + SQLiteLexerANALYZE_ = 33 + SQLiteLexerAND_ = 34 + SQLiteLexerAS_ = 35 + SQLiteLexerASC_ = 36 + SQLiteLexerATTACH_ = 37 + SQLiteLexerAUTOINCREMENT_ = 38 + SQLiteLexerBEFORE_ = 39 + SQLiteLexerBEGIN_ = 40 + SQLiteLexerBETWEEN_ = 41 + SQLiteLexerBY_ = 42 + SQLiteLexerCASCADE_ = 43 + SQLiteLexerCASE_ = 44 + SQLiteLexerCAST_ = 45 + SQLiteLexerCHECK_ = 46 + SQLiteLexerCOLLATE_ = 47 + SQLiteLexerCOLUMN_ = 48 + SQLiteLexerCOMMIT_ = 49 + SQLiteLexerCONFLICT_ = 50 + SQLiteLexerCONSTRAINT_ = 51 + SQLiteLexerCREATE_ = 52 + SQLiteLexerCROSS_ = 53 + SQLiteLexerCURRENT_DATE_ = 54 + SQLiteLexerCURRENT_TIME_ = 55 + SQLiteLexerCURRENT_TIMESTAMP_ = 56 + SQLiteLexerDATABASE_ = 57 + SQLiteLexerDEFAULT_ = 58 + SQLiteLexerDEFERRABLE_ = 59 + SQLiteLexerDEFERRED_ = 60 + SQLiteLexerDELETE_ = 61 + SQLiteLexerDESC_ = 62 + SQLiteLexerDETACH_ = 63 + SQLiteLexerDISTINCT_ = 64 + SQLiteLexerDROP_ = 65 + SQLiteLexerEACH_ = 66 + SQLiteLexerELSE_ = 67 + SQLiteLexerEND_ = 68 + SQLiteLexerESCAPE_ = 69 + SQLiteLexerEXCEPT_ = 70 + SQLiteLexerEXCLUSIVE_ = 71 + SQLiteLexerEXISTS_ = 72 + SQLiteLexerEXPLAIN_ = 73 + SQLiteLexerFAIL_ = 74 + SQLiteLexerFOR_ = 75 + SQLiteLexerFOREIGN_ = 76 + SQLiteLexerFROM_ = 77 + SQLiteLexerFULL_ = 78 + SQLiteLexerGLOB_ = 79 + SQLiteLexerGROUP_ = 80 + SQLiteLexerHAVING_ = 81 + SQLiteLexerIF_ = 82 + SQLiteLexerIGNORE_ = 83 + SQLiteLexerIMMEDIATE_ = 84 + SQLiteLexerIN_ = 85 + SQLiteLexerINDEX_ = 86 + SQLiteLexerINDEXED_ = 87 + SQLiteLexerINITIALLY_ = 88 + SQLiteLexerINNER_ = 89 + SQLiteLexerINSERT_ = 90 + SQLiteLexerINSTEAD_ = 91 + SQLiteLexerINTERSECT_ = 92 + SQLiteLexerINTO_ = 93 + SQLiteLexerIS_ = 94 + SQLiteLexerISNULL_ = 95 + SQLiteLexerJOIN_ = 96 + SQLiteLexerKEY_ = 97 + SQLiteLexerLEFT_ = 98 + SQLiteLexerLIKE_ = 99 + SQLiteLexerLIMIT_ = 100 + SQLiteLexerMATCH_ = 101 + SQLiteLexerNATURAL_ = 102 + SQLiteLexerNO_ = 103 + SQLiteLexerNOT_ = 104 + SQLiteLexerNOTNULL_ = 105 + SQLiteLexerNULL_ = 106 + SQLiteLexerOF_ = 107 + SQLiteLexerOFFSET_ = 108 + SQLiteLexerON_ = 109 + SQLiteLexerOR_ = 110 + SQLiteLexerORDER_ = 111 + SQLiteLexerOUTER_ = 112 + SQLiteLexerPLAN_ = 113 + SQLiteLexerPRAGMA_ = 114 + SQLiteLexerPRIMARY_ = 115 + SQLiteLexerQUERY_ = 116 + SQLiteLexerRAISE_ = 117 + SQLiteLexerRECURSIVE_ = 118 + SQLiteLexerREFERENCES_ = 119 + SQLiteLexerREGEXP_ = 120 + SQLiteLexerREINDEX_ = 121 + SQLiteLexerRELEASE_ = 122 + SQLiteLexerRENAME_ = 123 + SQLiteLexerREPLACE_ = 124 + SQLiteLexerRESTRICT_ = 125 + SQLiteLexerRETURNING_ = 126 + SQLiteLexerRIGHT_ = 127 + SQLiteLexerROLLBACK_ = 128 + SQLiteLexerROW_ = 129 + SQLiteLexerROWS_ = 130 + SQLiteLexerSAVEPOINT_ = 131 + SQLiteLexerSELECT_ = 132 + SQLiteLexerSET_ = 133 + SQLiteLexerSTRICT_ = 134 + SQLiteLexerTABLE_ = 135 + SQLiteLexerTEMP_ = 136 + SQLiteLexerTEMPORARY_ = 137 + SQLiteLexerTHEN_ = 138 + SQLiteLexerTO_ = 139 + SQLiteLexerTRANSACTION_ = 140 + SQLiteLexerTRIGGER_ = 141 + SQLiteLexerUNION_ = 142 + SQLiteLexerUNIQUE_ = 143 + SQLiteLexerUPDATE_ = 144 + SQLiteLexerUSING_ = 145 + SQLiteLexerVACUUM_ = 146 + SQLiteLexerVALUES_ = 147 + SQLiteLexerVIEW_ = 148 + SQLiteLexerVIRTUAL_ = 149 + SQLiteLexerWHEN_ = 150 + SQLiteLexerWHERE_ = 151 + SQLiteLexerWITH_ = 152 + SQLiteLexerWITHOUT_ = 153 + SQLiteLexerFIRST_VALUE_ = 154 + SQLiteLexerOVER_ = 155 + SQLiteLexerPARTITION_ = 156 + SQLiteLexerRANGE_ = 157 + SQLiteLexerPRECEDING_ = 158 + SQLiteLexerUNBOUNDED_ = 159 + SQLiteLexerCURRENT_ = 160 + SQLiteLexerFOLLOWING_ = 161 + SQLiteLexerCUME_DIST_ = 162 + SQLiteLexerDENSE_RANK_ = 163 + SQLiteLexerLAG_ = 164 + SQLiteLexerLAST_VALUE_ = 165 + SQLiteLexerLEAD_ = 166 + SQLiteLexerNTH_VALUE_ = 167 + SQLiteLexerNTILE_ = 168 + SQLiteLexerPERCENT_RANK_ = 169 + SQLiteLexerRANK_ = 170 + SQLiteLexerROW_NUMBER_ = 171 + SQLiteLexerGENERATED_ = 172 + SQLiteLexerALWAYS_ = 173 + SQLiteLexerSTORED_ = 174 + SQLiteLexerTRUE_ = 175 + SQLiteLexerFALSE_ = 176 + SQLiteLexerWINDOW_ = 177 + SQLiteLexerNULLS_ = 178 + SQLiteLexerFIRST_ = 179 + SQLiteLexerLAST_ = 180 + SQLiteLexerFILTER_ = 181 + SQLiteLexerGROUPS_ = 182 + SQLiteLexerEXCLUDE_ = 183 + SQLiteLexerTIES_ = 184 + SQLiteLexerOTHERS_ = 185 + SQLiteLexerDO_ = 186 + SQLiteLexerNOTHING_ = 187 + SQLiteLexerIDENTIFIER = 188 + SQLiteLexerNUMERIC_LITERAL = 189 + SQLiteLexerNUMBERED_BIND_PARAMETER = 190 + SQLiteLexerNAMED_BIND_PARAMETER = 191 + SQLiteLexerSTRING_LITERAL = 192 + SQLiteLexerBLOB_LITERAL = 193 + SQLiteLexerSINGLE_LINE_COMMENT = 194 + SQLiteLexerMULTILINE_COMMENT = 195 + SQLiteLexerSPACES = 196 + SQLiteLexerUNEXPECTED_CHAR = 197 ) diff --git a/internal/engine/sqlite/parser/sqlite_parser.go b/internal/engine/sqlite/parser/sqlite_parser.go index 2ee498f565..dba28c22e4 100644 --- a/internal/engine/sqlite/parser/sqlite_parser.go +++ b/internal/engine/sqlite/parser/sqlite_parser.go @@ -1,4 +1,4 @@ -// Code generated from SQLiteParser.g4 by ANTLR 4.12.0. DO NOT EDIT. +// Code generated from SQLiteParser.g4 by ANTLR 4.13.1. DO NOT EDIT. package parser // SQLiteParser @@ -7,7 +7,7 @@ import ( "strconv" "sync" - "github.com/antlr/antlr4/runtime/Go/antlr/v4" + "github.com/antlr4-go/antlr/v4" ) // Suppress unused import errors @@ -19,57 +19,57 @@ type SQLiteParser struct { *antlr.BaseParser } -var sqliteparserParserStaticData struct { +var SQLiteParserParserStaticData struct { once sync.Once serializedATN []int32 - literalNames []string - symbolicNames []string - ruleNames []string - predictionContextCache *antlr.PredictionContextCache + LiteralNames []string + SymbolicNames []string + RuleNames []string + PredictionContextCache *antlr.PredictionContextCache atn *antlr.ATN decisionToDFA []*antlr.DFA } func sqliteparserParserInit() { - staticData := &sqliteparserParserStaticData - staticData.literalNames = []string{ - "", "';'", "'.'", "'('", "')'", "','", "'='", "'*'", "'+'", "'-'", "'~'", - "'||'", "'/'", "'%'", "'<<'", "'>>'", "'&'", "'|'", "'<'", "'<='", "'>'", - "'>='", "'=='", "'!='", "'<>'", + staticData := &SQLiteParserParserStaticData + staticData.LiteralNames = []string{ + "", "';'", "'.'", "'('", "')'", "','", "'='", "'*'", "'+'", "'->>'", + "'->'", "'-'", "'~'", "'||'", "'/'", "'%'", "'<<'", "'>>'", "'&'", "'|'", + "'<'", "'<='", "'>'", "'>='", "'=='", "'!='", "'<>'", } - staticData.symbolicNames = []string{ + staticData.SymbolicNames = []string{ "", "SCOL", "DOT", "OPEN_PAR", "CLOSE_PAR", "COMMA", "ASSIGN", "STAR", - "PLUS", "MINUS", "TILDE", "PIPE2", "DIV", "MOD", "LT2", "GT2", "AMP", - "PIPE", "LT", "LT_EQ", "GT", "GT_EQ", "EQ", "NOT_EQ1", "NOT_EQ2", "ABORT_", - "ACTION_", "ADD_", "AFTER_", "ALL_", "ALTER_", "ANALYZE_", "AND_", "AS_", - "ASC_", "ATTACH_", "AUTOINCREMENT_", "BEFORE_", "BEGIN_", "BETWEEN_", - "BY_", "CASCADE_", "CASE_", "CAST_", "CHECK_", "COLLATE_", "COLUMN_", - "COMMIT_", "CONFLICT_", "CONSTRAINT_", "CREATE_", "CROSS_", "CURRENT_DATE_", - "CURRENT_TIME_", "CURRENT_TIMESTAMP_", "DATABASE_", "DEFAULT_", "DEFERRABLE_", - "DEFERRED_", "DELETE_", "DESC_", "DETACH_", "DISTINCT_", "DROP_", "EACH_", - "ELSE_", "END_", "ESCAPE_", "EXCEPT_", "EXCLUSIVE_", "EXISTS_", "EXPLAIN_", - "FAIL_", "FOR_", "FOREIGN_", "FROM_", "FULL_", "GLOB_", "GROUP_", "HAVING_", - "IF_", "IGNORE_", "IMMEDIATE_", "IN_", "INDEX_", "INDEXED_", "INITIALLY_", - "INNER_", "INSERT_", "INSTEAD_", "INTERSECT_", "INTO_", "IS_", "ISNULL_", - "JOIN_", "KEY_", "LEFT_", "LIKE_", "LIMIT_", "MATCH_", "NATURAL_", "NO_", - "NOT_", "NOTNULL_", "NULL_", "OF_", "OFFSET_", "ON_", "OR_", "ORDER_", - "OUTER_", "PLAN_", "PRAGMA_", "PRIMARY_", "QUERY_", "RAISE_", "RECURSIVE_", - "REFERENCES_", "REGEXP_", "REINDEX_", "RELEASE_", "RENAME_", "REPLACE_", - "RESTRICT_", "RETURNING_", "RIGHT_", "ROLLBACK_", "ROW_", "ROWS_", "SAVEPOINT_", - "SELECT_", "SET_", "STRICT_", "TABLE_", "TEMP_", "TEMPORARY_", "THEN_", - "TO_", "TRANSACTION_", "TRIGGER_", "UNION_", "UNIQUE_", "UPDATE_", "USING_", - "VACUUM_", "VALUES_", "VIEW_", "VIRTUAL_", "WHEN_", "WHERE_", "WITH_", - "WITHOUT_", "FIRST_VALUE_", "OVER_", "PARTITION_", "RANGE_", "PRECEDING_", - "UNBOUNDED_", "CURRENT_", "FOLLOWING_", "CUME_DIST_", "DENSE_RANK_", - "LAG_", "LAST_VALUE_", "LEAD_", "NTH_VALUE_", "NTILE_", "PERCENT_RANK_", - "RANK_", "ROW_NUMBER_", "GENERATED_", "ALWAYS_", "STORED_", "TRUE_", - "FALSE_", "WINDOW_", "NULLS_", "FIRST_", "LAST_", "FILTER_", "GROUPS_", - "EXCLUDE_", "TIES_", "OTHERS_", "DO_", "NOTHING_", "IDENTIFIER", "NUMERIC_LITERAL", - "NUMBERED_BIND_PARAMETER", "NAMED_BIND_PARAMETER", "STRING_LITERAL", - "BLOB_LITERAL", "SINGLE_LINE_COMMENT", "MULTILINE_COMMENT", "SPACES", - "UNEXPECTED_CHAR", - } - staticData.ruleNames = []string{ + "PLUS", "PTR2", "PTR", "MINUS", "TILDE", "PIPE2", "DIV", "MOD", "LT2", + "GT2", "AMP", "PIPE", "LT", "LT_EQ", "GT", "GT_EQ", "EQ", "NOT_EQ1", + "NOT_EQ2", "ABORT_", "ACTION_", "ADD_", "AFTER_", "ALL_", "ALTER_", + "ANALYZE_", "AND_", "AS_", "ASC_", "ATTACH_", "AUTOINCREMENT_", "BEFORE_", + "BEGIN_", "BETWEEN_", "BY_", "CASCADE_", "CASE_", "CAST_", "CHECK_", + "COLLATE_", "COLUMN_", "COMMIT_", "CONFLICT_", "CONSTRAINT_", "CREATE_", + "CROSS_", "CURRENT_DATE_", "CURRENT_TIME_", "CURRENT_TIMESTAMP_", "DATABASE_", + "DEFAULT_", "DEFERRABLE_", "DEFERRED_", "DELETE_", "DESC_", "DETACH_", + "DISTINCT_", "DROP_", "EACH_", "ELSE_", "END_", "ESCAPE_", "EXCEPT_", + "EXCLUSIVE_", "EXISTS_", "EXPLAIN_", "FAIL_", "FOR_", "FOREIGN_", "FROM_", + "FULL_", "GLOB_", "GROUP_", "HAVING_", "IF_", "IGNORE_", "IMMEDIATE_", + "IN_", "INDEX_", "INDEXED_", "INITIALLY_", "INNER_", "INSERT_", "INSTEAD_", + "INTERSECT_", "INTO_", "IS_", "ISNULL_", "JOIN_", "KEY_", "LEFT_", "LIKE_", + "LIMIT_", "MATCH_", "NATURAL_", "NO_", "NOT_", "NOTNULL_", "NULL_", + "OF_", "OFFSET_", "ON_", "OR_", "ORDER_", "OUTER_", "PLAN_", "PRAGMA_", + "PRIMARY_", "QUERY_", "RAISE_", "RECURSIVE_", "REFERENCES_", "REGEXP_", + "REINDEX_", "RELEASE_", "RENAME_", "REPLACE_", "RESTRICT_", "RETURNING_", + "RIGHT_", "ROLLBACK_", "ROW_", "ROWS_", "SAVEPOINT_", "SELECT_", "SET_", + "STRICT_", "TABLE_", "TEMP_", "TEMPORARY_", "THEN_", "TO_", "TRANSACTION_", + "TRIGGER_", "UNION_", "UNIQUE_", "UPDATE_", "USING_", "VACUUM_", "VALUES_", + "VIEW_", "VIRTUAL_", "WHEN_", "WHERE_", "WITH_", "WITHOUT_", "FIRST_VALUE_", + "OVER_", "PARTITION_", "RANGE_", "PRECEDING_", "UNBOUNDED_", "CURRENT_", + "FOLLOWING_", "CUME_DIST_", "DENSE_RANK_", "LAG_", "LAST_VALUE_", "LEAD_", + "NTH_VALUE_", "NTILE_", "PERCENT_RANK_", "RANK_", "ROW_NUMBER_", "GENERATED_", + "ALWAYS_", "STORED_", "TRUE_", "FALSE_", "WINDOW_", "NULLS_", "FIRST_", + "LAST_", "FILTER_", "GROUPS_", "EXCLUDE_", "TIES_", "OTHERS_", "DO_", + "NOTHING_", "IDENTIFIER", "NUMERIC_LITERAL", "NUMBERED_BIND_PARAMETER", + "NAMED_BIND_PARAMETER", "STRING_LITERAL", "BLOB_LITERAL", "SINGLE_LINE_COMMENT", + "MULTILINE_COMMENT", "SPACES", "UNEXPECTED_CHAR", + } + staticData.RuleNames = []string{ "parse", "sql_stmt_list", "sql_stmt", "alter_table_stmt", "analyze_stmt", "attach_stmt", "begin_stmt", "commit_stmt", "rollback_stmt", "savepoint_stmt", "release_stmt", "create_index_stmt", "indexed_column", "table_option", @@ -98,9 +98,9 @@ func sqliteparserParserInit() { "window_name", "alias", "filename", "base_window_name", "simple_func", "aggregate_func", "table_function_name", "any_name", } - staticData.predictionContextCache = antlr.NewPredictionContextCache() + staticData.PredictionContextCache = antlr.NewPredictionContextCache() staticData.serializedATN = []int32{ - 4, 1, 195, 2175, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, + 4, 1, 197, 2176, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, @@ -209,137 +209,137 @@ func sqliteparserParserInit() { 12, 34, 996, 1, 34, 1, 34, 3, 34, 1001, 8, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1006, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, - 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1032, 8, 34, 1, 34, 1, 34, - 1, 34, 1, 34, 1, 34, 3, 34, 1039, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, - 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1050, 8, 34, 1, 34, 1, 34, 1, 34, - 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1059, 8, 34, 1, 34, 1, 34, 1, 34, 1, - 34, 1, 34, 1, 34, 5, 34, 1067, 8, 34, 10, 34, 12, 34, 1070, 9, 34, 3, 34, - 1072, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1078, 8, 34, 1, 34, 1, - 34, 1, 34, 1, 34, 3, 34, 1084, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, - 5, 34, 1091, 8, 34, 10, 34, 12, 34, 1094, 9, 34, 3, 34, 1096, 8, 34, 1, - 34, 1, 34, 3, 34, 1100, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, - 1107, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1113, 8, 34, 1, 34, 1, - 34, 1, 34, 1, 34, 1, 34, 3, 34, 1120, 8, 34, 5, 34, 1122, 8, 34, 10, 34, - 12, 34, 1125, 9, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 3, 35, 1133, - 8, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 37, 3, 37, 1140, 8, 37, 1, 37, 1, - 37, 1, 37, 1, 37, 1, 37, 3, 37, 1147, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, - 3, 37, 1153, 8, 37, 1, 37, 1, 37, 1, 37, 3, 37, 1158, 8, 37, 1, 37, 1, - 37, 1, 37, 1, 37, 5, 37, 1164, 8, 37, 10, 37, 12, 37, 1167, 9, 37, 1, 37, - 1, 37, 3, 37, 1171, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 5, 37, 1178, - 8, 37, 10, 37, 12, 37, 1181, 9, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, - 1, 37, 5, 37, 1189, 8, 37, 10, 37, 12, 37, 1192, 9, 37, 1, 37, 1, 37, 5, - 37, 1196, 8, 37, 10, 37, 12, 37, 1199, 9, 37, 1, 37, 3, 37, 1202, 8, 37, - 1, 37, 3, 37, 1205, 8, 37, 1, 37, 3, 37, 1208, 8, 37, 1, 37, 1, 37, 3, - 37, 1212, 8, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 5, 38, 1220, - 8, 38, 10, 38, 12, 38, 1223, 9, 38, 1, 38, 1, 38, 1, 38, 3, 38, 1228, 8, - 38, 3, 38, 1230, 8, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, - 1238, 8, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 1245, 8, 38, 1, - 38, 1, 38, 1, 38, 5, 38, 1250, 8, 38, 10, 38, 12, 38, 1253, 9, 38, 1, 38, - 1, 38, 3, 38, 1257, 8, 38, 3, 38, 1259, 8, 38, 1, 39, 1, 39, 1, 39, 1, - 39, 3, 39, 1265, 8, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, - 3, 39, 1274, 8, 39, 1, 40, 1, 40, 1, 40, 3, 40, 1279, 8, 40, 1, 41, 1, - 41, 1, 41, 1, 41, 1, 41, 3, 41, 1286, 8, 41, 1, 41, 1, 41, 3, 41, 1290, - 8, 41, 3, 41, 1292, 8, 41, 1, 42, 3, 42, 1295, 8, 42, 1, 42, 1, 42, 1, - 42, 1, 42, 5, 42, 1301, 8, 42, 10, 42, 12, 42, 1304, 9, 42, 1, 42, 3, 42, - 1307, 8, 42, 1, 42, 3, 42, 1310, 8, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, - 43, 5, 43, 1317, 8, 43, 10, 43, 12, 43, 1320, 9, 43, 1, 44, 1, 44, 3, 44, - 1324, 8, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1329, 8, 44, 10, 44, 12, 44, 1332, - 9, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1338, 8, 44, 10, 44, 12, 44, - 1341, 9, 44, 1, 44, 3, 44, 1344, 8, 44, 3, 44, 1346, 8, 44, 1, 44, 1, 44, - 3, 44, 1350, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1357, 8, - 44, 10, 44, 12, 44, 1360, 9, 44, 1, 44, 1, 44, 3, 44, 1364, 8, 44, 3, 44, - 1366, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, - 44, 5, 44, 1377, 8, 44, 10, 44, 12, 44, 1380, 9, 44, 3, 44, 1382, 8, 44, - 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1389, 8, 44, 10, 44, 12, 44, - 1392, 9, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1400, 8, - 44, 10, 44, 12, 44, 1403, 9, 44, 1, 44, 1, 44, 5, 44, 1407, 8, 44, 10, - 44, 12, 44, 1410, 9, 44, 3, 44, 1412, 8, 44, 1, 45, 1, 45, 1, 46, 3, 46, - 1417, 8, 46, 1, 46, 1, 46, 3, 46, 1421, 8, 46, 1, 46, 3, 46, 1424, 8, 46, - 1, 47, 3, 47, 1427, 8, 47, 1, 47, 1, 47, 1, 47, 3, 47, 1432, 8, 47, 1, - 47, 1, 47, 3, 47, 1436, 8, 47, 1, 47, 4, 47, 1439, 8, 47, 11, 47, 12, 47, - 1440, 1, 47, 3, 47, 1444, 8, 47, 1, 47, 3, 47, 1447, 8, 47, 1, 48, 1, 48, - 1, 48, 3, 48, 1452, 8, 48, 1, 48, 1, 48, 3, 48, 1456, 8, 48, 1, 48, 3, - 48, 1459, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1466, 8, 48, - 1, 48, 1, 48, 1, 48, 3, 48, 1471, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, - 48, 5, 48, 1478, 8, 48, 10, 48, 12, 48, 1481, 9, 48, 1, 48, 1, 48, 3, 48, - 1485, 8, 48, 1, 48, 3, 48, 1488, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, - 48, 1494, 8, 48, 10, 48, 12, 48, 1497, 9, 48, 1, 48, 3, 48, 1500, 8, 48, - 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1508, 8, 48, 1, 48, 3, - 48, 1511, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1516, 8, 48, 1, 48, 1, 48, - 3, 48, 1520, 8, 48, 1, 48, 3, 48, 1523, 8, 48, 1, 48, 1, 48, 1, 48, 1, - 48, 1, 48, 3, 48, 1530, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1535, 8, 48, - 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1542, 8, 48, 10, 48, 12, 48, - 1545, 9, 48, 1, 48, 1, 48, 3, 48, 1549, 8, 48, 1, 48, 3, 48, 1552, 8, 48, - 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1558, 8, 48, 10, 48, 12, 48, 1561, 9, - 48, 1, 48, 3, 48, 1564, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, - 3, 48, 1572, 8, 48, 1, 48, 3, 48, 1575, 8, 48, 3, 48, 1577, 8, 48, 1, 49, - 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 3, 49, 1586, 8, 49, 1, 49, 3, - 49, 1589, 8, 49, 3, 49, 1591, 8, 49, 1, 50, 1, 50, 3, 50, 1595, 8, 50, - 1, 50, 1, 50, 3, 50, 1599, 8, 50, 1, 50, 3, 50, 1602, 8, 50, 1, 50, 1, - 50, 1, 50, 3, 50, 1607, 8, 50, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, - 1, 51, 5, 51, 1616, 8, 51, 10, 51, 12, 51, 1619, 9, 51, 1, 51, 1, 51, 3, - 51, 1623, 8, 51, 1, 52, 1, 52, 3, 52, 1627, 8, 52, 1, 52, 1, 52, 3, 52, - 1631, 8, 52, 1, 53, 3, 53, 1634, 8, 53, 1, 53, 1, 53, 1, 53, 3, 53, 1639, - 8, 53, 1, 53, 1, 53, 1, 53, 1, 53, 3, 53, 1645, 8, 53, 1, 53, 1, 53, 1, - 53, 1, 53, 1, 53, 3, 53, 1652, 8, 53, 1, 53, 1, 53, 1, 53, 5, 53, 1657, - 8, 53, 10, 53, 12, 53, 1660, 9, 53, 1, 53, 1, 53, 3, 53, 1664, 8, 53, 1, - 53, 3, 53, 1667, 8, 53, 1, 54, 1, 54, 1, 54, 1, 54, 5, 54, 1673, 8, 54, - 10, 54, 12, 54, 1676, 9, 54, 1, 54, 1, 54, 1, 55, 3, 55, 1681, 8, 55, 1, - 55, 1, 55, 1, 55, 3, 55, 1686, 8, 55, 1, 55, 1, 55, 1, 55, 1, 55, 3, 55, - 1692, 8, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 3, 55, 1699, 8, 55, 1, - 55, 1, 55, 1, 55, 5, 55, 1704, 8, 55, 10, 55, 12, 55, 1707, 9, 55, 1, 55, - 1, 55, 3, 55, 1711, 8, 55, 1, 55, 3, 55, 1714, 8, 55, 1, 55, 3, 55, 1717, - 8, 55, 1, 56, 1, 56, 1, 56, 3, 56, 1722, 8, 56, 1, 56, 1, 56, 1, 56, 3, - 56, 1727, 8, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 3, 56, 1734, 8, 56, - 1, 57, 1, 57, 3, 57, 1738, 8, 57, 1, 57, 1, 57, 3, 57, 1742, 8, 57, 1, - 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 3, 59, 1752, 8, 59, - 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 5, 59, 1759, 8, 59, 10, 59, 12, 59, - 1762, 9, 59, 3, 59, 1764, 8, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 5, - 59, 1771, 8, 59, 10, 59, 12, 59, 1774, 9, 59, 1, 59, 3, 59, 1777, 8, 59, - 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 60, 3, 60, 1785, 8, 60, 1, 60, 1, - 60, 1, 60, 1, 60, 1, 60, 5, 60, 1792, 8, 60, 10, 60, 12, 60, 1795, 9, 60, - 3, 60, 1797, 8, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 5, 60, 1804, 8, - 60, 10, 60, 12, 60, 1807, 9, 60, 3, 60, 1809, 8, 60, 1, 60, 3, 60, 1812, - 8, 60, 1, 60, 3, 60, 1815, 8, 60, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, - 61, 1, 61, 1, 61, 3, 61, 1825, 8, 61, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, - 1, 62, 1, 62, 3, 62, 1834, 8, 62, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 5, - 63, 1841, 8, 63, 10, 63, 12, 63, 1844, 9, 63, 1, 63, 3, 63, 1847, 8, 63, - 1, 63, 1, 63, 1, 64, 1, 64, 1, 64, 3, 64, 1854, 8, 64, 1, 64, 1, 64, 1, - 64, 5, 64, 1859, 8, 64, 10, 64, 12, 64, 1862, 9, 64, 1, 64, 3, 64, 1865, - 8, 64, 1, 64, 1, 64, 3, 64, 1869, 8, 64, 1, 65, 1, 65, 1, 65, 1, 65, 1, - 65, 5, 65, 1876, 8, 65, 10, 65, 12, 65, 1879, 9, 65, 1, 65, 3, 65, 1882, - 8, 65, 1, 65, 1, 65, 3, 65, 1886, 8, 65, 1, 65, 1, 65, 1, 65, 3, 65, 1891, - 8, 65, 1, 66, 1, 66, 3, 66, 1895, 8, 66, 1, 66, 1, 66, 1, 66, 5, 66, 1900, - 8, 66, 10, 66, 12, 66, 1903, 9, 66, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, - 5, 67, 1910, 8, 67, 10, 67, 12, 67, 1913, 9, 67, 1, 68, 1, 68, 1, 68, 1, - 68, 3, 68, 1919, 8, 68, 1, 69, 1, 69, 1, 69, 3, 69, 1924, 8, 69, 1, 69, - 3, 69, 1927, 8, 69, 1, 69, 1, 69, 3, 69, 1931, 8, 69, 1, 70, 1, 70, 1, + 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1035, + 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1042, 8, 34, 1, 34, 1, + 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1053, 8, 34, + 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1062, 8, 34, 1, + 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 5, 34, 1070, 8, 34, 10, 34, 12, + 34, 1073, 9, 34, 3, 34, 1075, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, + 1081, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1087, 8, 34, 1, 34, 1, + 34, 1, 34, 1, 34, 1, 34, 5, 34, 1094, 8, 34, 10, 34, 12, 34, 1097, 9, 34, + 3, 34, 1099, 8, 34, 1, 34, 1, 34, 3, 34, 1103, 8, 34, 1, 34, 1, 34, 1, + 34, 1, 34, 1, 34, 3, 34, 1110, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, + 1116, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1123, 8, 34, 5, + 34, 1125, 8, 34, 10, 34, 12, 34, 1128, 9, 34, 1, 35, 1, 35, 1, 35, 1, 35, + 1, 35, 1, 35, 3, 35, 1136, 8, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 37, 3, + 37, 1143, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 1150, 8, 37, + 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 1156, 8, 37, 1, 37, 1, 37, 1, 37, 3, + 37, 1161, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 5, 37, 1167, 8, 37, 10, 37, + 12, 37, 1170, 9, 37, 1, 37, 1, 37, 3, 37, 1174, 8, 37, 1, 37, 1, 37, 1, + 37, 1, 37, 1, 37, 5, 37, 1181, 8, 37, 10, 37, 12, 37, 1184, 9, 37, 1, 37, + 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 5, 37, 1192, 8, 37, 10, 37, 12, 37, + 1195, 9, 37, 1, 37, 1, 37, 5, 37, 1199, 8, 37, 10, 37, 12, 37, 1202, 9, + 37, 1, 37, 1, 37, 1, 37, 3, 37, 1207, 8, 37, 1, 37, 3, 37, 1210, 8, 37, + 1, 37, 3, 37, 1213, 8, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 5, + 38, 1221, 8, 38, 10, 38, 12, 38, 1224, 9, 38, 1, 38, 1, 38, 1, 38, 3, 38, + 1229, 8, 38, 3, 38, 1231, 8, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, + 38, 3, 38, 1239, 8, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 1246, + 8, 38, 1, 38, 1, 38, 1, 38, 5, 38, 1251, 8, 38, 10, 38, 12, 38, 1254, 9, + 38, 1, 38, 1, 38, 3, 38, 1258, 8, 38, 3, 38, 1260, 8, 38, 1, 39, 1, 39, + 1, 39, 1, 39, 3, 39, 1266, 8, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, + 39, 1, 39, 3, 39, 1275, 8, 39, 1, 40, 1, 40, 1, 40, 3, 40, 1280, 8, 40, + 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 3, 41, 1287, 8, 41, 1, 41, 1, 41, 3, + 41, 1291, 8, 41, 3, 41, 1293, 8, 41, 1, 42, 3, 42, 1296, 8, 42, 1, 42, + 1, 42, 1, 42, 1, 42, 5, 42, 1302, 8, 42, 10, 42, 12, 42, 1305, 9, 42, 1, + 42, 3, 42, 1308, 8, 42, 1, 42, 3, 42, 1311, 8, 42, 1, 43, 1, 43, 1, 43, + 1, 43, 1, 43, 5, 43, 1318, 8, 43, 10, 43, 12, 43, 1321, 9, 43, 1, 44, 1, + 44, 3, 44, 1325, 8, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1330, 8, 44, 10, 44, + 12, 44, 1333, 9, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1339, 8, 44, 10, + 44, 12, 44, 1342, 9, 44, 1, 44, 3, 44, 1345, 8, 44, 3, 44, 1347, 8, 44, + 1, 44, 1, 44, 3, 44, 1351, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, + 44, 1358, 8, 44, 10, 44, 12, 44, 1361, 9, 44, 1, 44, 1, 44, 3, 44, 1365, + 8, 44, 3, 44, 1367, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, + 44, 1, 44, 1, 44, 5, 44, 1378, 8, 44, 10, 44, 12, 44, 1381, 9, 44, 3, 44, + 1383, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1390, 8, 44, 10, + 44, 12, 44, 1393, 9, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, + 1401, 8, 44, 10, 44, 12, 44, 1404, 9, 44, 1, 44, 1, 44, 5, 44, 1408, 8, + 44, 10, 44, 12, 44, 1411, 9, 44, 3, 44, 1413, 8, 44, 1, 45, 1, 45, 1, 46, + 3, 46, 1418, 8, 46, 1, 46, 1, 46, 3, 46, 1422, 8, 46, 1, 46, 3, 46, 1425, + 8, 46, 1, 47, 3, 47, 1428, 8, 47, 1, 47, 1, 47, 1, 47, 3, 47, 1433, 8, + 47, 1, 47, 1, 47, 3, 47, 1437, 8, 47, 1, 47, 4, 47, 1440, 8, 47, 11, 47, + 12, 47, 1441, 1, 47, 3, 47, 1445, 8, 47, 1, 47, 3, 47, 1448, 8, 47, 1, + 48, 1, 48, 1, 48, 3, 48, 1453, 8, 48, 1, 48, 1, 48, 3, 48, 1457, 8, 48, + 1, 48, 3, 48, 1460, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1467, + 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1472, 8, 48, 1, 48, 1, 48, 1, 48, 1, + 48, 1, 48, 5, 48, 1479, 8, 48, 10, 48, 12, 48, 1482, 9, 48, 1, 48, 1, 48, + 3, 48, 1486, 8, 48, 1, 48, 3, 48, 1489, 8, 48, 1, 48, 1, 48, 1, 48, 1, + 48, 5, 48, 1495, 8, 48, 10, 48, 12, 48, 1498, 9, 48, 1, 48, 3, 48, 1501, + 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1509, 8, 48, 1, + 48, 3, 48, 1512, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1517, 8, 48, 1, 48, + 1, 48, 3, 48, 1521, 8, 48, 1, 48, 3, 48, 1524, 8, 48, 1, 48, 1, 48, 1, + 48, 1, 48, 1, 48, 3, 48, 1531, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1536, + 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1543, 8, 48, 10, 48, 12, + 48, 1546, 9, 48, 1, 48, 1, 48, 3, 48, 1550, 8, 48, 1, 48, 3, 48, 1553, + 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1559, 8, 48, 10, 48, 12, 48, + 1562, 9, 48, 1, 48, 3, 48, 1565, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, + 48, 1, 48, 3, 48, 1573, 8, 48, 1, 48, 3, 48, 1576, 8, 48, 3, 48, 1578, + 8, 48, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 3, 49, 1587, 8, + 49, 1, 49, 3, 49, 1590, 8, 49, 3, 49, 1592, 8, 49, 1, 50, 1, 50, 3, 50, + 1596, 8, 50, 1, 50, 1, 50, 3, 50, 1600, 8, 50, 1, 50, 3, 50, 1603, 8, 50, + 1, 50, 1, 50, 1, 50, 3, 50, 1608, 8, 50, 1, 51, 1, 51, 1, 51, 1, 51, 1, + 51, 1, 51, 1, 51, 5, 51, 1617, 8, 51, 10, 51, 12, 51, 1620, 9, 51, 1, 51, + 1, 51, 3, 51, 1624, 8, 51, 1, 52, 1, 52, 3, 52, 1628, 8, 52, 1, 52, 1, + 52, 3, 52, 1632, 8, 52, 1, 53, 3, 53, 1635, 8, 53, 1, 53, 1, 53, 1, 53, + 3, 53, 1640, 8, 53, 1, 53, 1, 53, 1, 53, 1, 53, 3, 53, 1646, 8, 53, 1, + 53, 1, 53, 1, 53, 1, 53, 1, 53, 3, 53, 1653, 8, 53, 1, 53, 1, 53, 1, 53, + 5, 53, 1658, 8, 53, 10, 53, 12, 53, 1661, 9, 53, 1, 53, 1, 53, 3, 53, 1665, + 8, 53, 1, 53, 3, 53, 1668, 8, 53, 1, 54, 1, 54, 1, 54, 1, 54, 5, 54, 1674, + 8, 54, 10, 54, 12, 54, 1677, 9, 54, 1, 54, 1, 54, 1, 55, 3, 55, 1682, 8, + 55, 1, 55, 1, 55, 1, 55, 3, 55, 1687, 8, 55, 1, 55, 1, 55, 1, 55, 1, 55, + 3, 55, 1693, 8, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 3, 55, 1700, 8, + 55, 1, 55, 1, 55, 1, 55, 5, 55, 1705, 8, 55, 10, 55, 12, 55, 1708, 9, 55, + 1, 55, 1, 55, 3, 55, 1712, 8, 55, 1, 55, 3, 55, 1715, 8, 55, 1, 55, 3, + 55, 1718, 8, 55, 1, 56, 1, 56, 1, 56, 3, 56, 1723, 8, 56, 1, 56, 1, 56, + 1, 56, 3, 56, 1728, 8, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 3, 56, 1735, + 8, 56, 1, 57, 1, 57, 3, 57, 1739, 8, 57, 1, 57, 1, 57, 3, 57, 1743, 8, + 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 3, 59, 1753, + 8, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 5, 59, 1760, 8, 59, 10, 59, 12, + 59, 1763, 9, 59, 3, 59, 1765, 8, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, + 5, 59, 1772, 8, 59, 10, 59, 12, 59, 1775, 9, 59, 1, 59, 3, 59, 1778, 8, + 59, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 60, 3, 60, 1786, 8, 60, 1, 60, + 1, 60, 1, 60, 1, 60, 1, 60, 5, 60, 1793, 8, 60, 10, 60, 12, 60, 1796, 9, + 60, 3, 60, 1798, 8, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 5, 60, 1805, + 8, 60, 10, 60, 12, 60, 1808, 9, 60, 3, 60, 1810, 8, 60, 1, 60, 3, 60, 1813, + 8, 60, 1, 60, 3, 60, 1816, 8, 60, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, + 61, 1, 61, 1, 61, 3, 61, 1826, 8, 61, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, + 1, 62, 1, 62, 3, 62, 1835, 8, 62, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 5, + 63, 1842, 8, 63, 10, 63, 12, 63, 1845, 9, 63, 1, 63, 3, 63, 1848, 8, 63, + 1, 63, 1, 63, 1, 64, 1, 64, 1, 64, 3, 64, 1855, 8, 64, 1, 64, 1, 64, 1, + 64, 5, 64, 1860, 8, 64, 10, 64, 12, 64, 1863, 9, 64, 1, 64, 3, 64, 1866, + 8, 64, 1, 64, 1, 64, 3, 64, 1870, 8, 64, 1, 65, 1, 65, 1, 65, 1, 65, 1, + 65, 5, 65, 1877, 8, 65, 10, 65, 12, 65, 1880, 9, 65, 1, 65, 3, 65, 1883, + 8, 65, 1, 65, 1, 65, 3, 65, 1887, 8, 65, 1, 65, 1, 65, 1, 65, 3, 65, 1892, + 8, 65, 1, 66, 1, 66, 3, 66, 1896, 8, 66, 1, 66, 1, 66, 1, 66, 5, 66, 1901, + 8, 66, 10, 66, 12, 66, 1904, 9, 66, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, + 5, 67, 1911, 8, 67, 10, 67, 12, 67, 1914, 9, 67, 1, 68, 1, 68, 1, 68, 1, + 68, 3, 68, 1920, 8, 68, 1, 69, 1, 69, 1, 69, 3, 69, 1925, 8, 69, 1, 69, + 3, 69, 1928, 8, 69, 1, 69, 1, 69, 3, 69, 1932, 8, 69, 1, 70, 1, 70, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 3, 71, - 1945, 8, 71, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, - 72, 1, 72, 3, 72, 1957, 8, 72, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, - 1, 73, 3, 73, 1966, 8, 73, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, - 74, 3, 74, 1975, 8, 74, 1, 74, 1, 74, 3, 74, 1979, 8, 74, 1, 74, 1, 74, - 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 1989, 8, 74, 1, 74, 3, - 74, 1992, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, - 2001, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2010, - 8, 74, 1, 74, 3, 74, 2013, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2019, + 1946, 8, 71, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, + 72, 1, 72, 3, 72, 1958, 8, 72, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, + 1, 73, 3, 73, 1967, 8, 73, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, + 74, 3, 74, 1976, 8, 74, 1, 74, 1, 74, 3, 74, 1980, 8, 74, 1, 74, 1, 74, + 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 1990, 8, 74, 1, 74, 3, + 74, 1993, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, + 2002, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2011, + 8, 74, 1, 74, 3, 74, 2014, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2020, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, - 74, 1, 74, 1, 74, 3, 74, 2033, 8, 74, 1, 74, 1, 74, 3, 74, 2037, 8, 74, - 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2048, - 8, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2053, 8, 74, 1, 75, 1, 75, 1, 75, 1, - 76, 1, 76, 1, 76, 1, 77, 1, 77, 1, 77, 4, 77, 2064, 8, 77, 11, 77, 12, - 77, 2065, 1, 78, 1, 78, 1, 78, 4, 78, 2071, 8, 78, 11, 78, 12, 78, 2072, - 1, 79, 1, 79, 1, 79, 1, 79, 1, 80, 1, 80, 3, 80, 2081, 8, 80, 1, 80, 1, - 80, 1, 80, 3, 80, 2086, 8, 80, 5, 80, 2088, 8, 80, 10, 80, 12, 80, 2091, + 74, 1, 74, 1, 74, 3, 74, 2034, 8, 74, 1, 74, 1, 74, 3, 74, 2038, 8, 74, + 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2049, + 8, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2054, 8, 74, 1, 75, 1, 75, 1, 75, 1, + 76, 1, 76, 1, 76, 1, 77, 1, 77, 1, 77, 4, 77, 2065, 8, 77, 11, 77, 12, + 77, 2066, 1, 78, 1, 78, 1, 78, 4, 78, 2072, 8, 78, 11, 78, 12, 78, 2073, + 1, 79, 1, 79, 1, 79, 1, 79, 1, 80, 1, 80, 3, 80, 2082, 8, 80, 1, 80, 1, + 80, 1, 80, 3, 80, 2087, 8, 80, 5, 80, 2089, 8, 80, 10, 80, 12, 80, 2092, 9, 80, 1, 81, 1, 81, 1, 82, 1, 82, 1, 83, 1, 83, 1, 84, 1, 84, 1, 85, 1, - 85, 3, 85, 2103, 8, 85, 1, 86, 1, 86, 1, 87, 1, 87, 1, 88, 1, 88, 1, 89, - 1, 89, 1, 90, 1, 90, 1, 90, 3, 90, 2116, 8, 90, 1, 90, 1, 90, 1, 91, 1, + 85, 3, 85, 2104, 8, 85, 1, 86, 1, 86, 1, 87, 1, 87, 1, 88, 1, 88, 1, 89, + 1, 89, 1, 90, 1, 90, 1, 90, 3, 90, 2117, 8, 90, 1, 90, 1, 90, 1, 91, 1, 91, 1, 92, 1, 92, 1, 93, 1, 93, 1, 94, 1, 94, 1, 95, 1, 95, 1, 96, 1, 96, 1, 97, 1, 97, 1, 98, 1, 98, 1, 99, 1, 99, 1, 100, 1, 100, 1, 101, 1, 101, 1, 102, 1, 102, 1, 103, 1, 103, 1, 104, 1, 104, 1, 105, 1, 105, 1, 106, 1, 106, 1, 107, 1, 107, 1, 108, 1, 108, 1, 109, 1, 109, 1, 110, 1, 110, 1, 111, 1, 111, 1, 112, 1, 112, 1, 113, 1, 113, 1, 114, 1, 114, 1, 114, - 1, 114, 1, 114, 1, 114, 1, 114, 3, 114, 2173, 8, 114, 1, 114, 2, 449, 487, + 1, 114, 1, 114, 1, 114, 1, 114, 3, 114, 2174, 8, 114, 1, 114, 2, 449, 487, 1, 68, 115, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, @@ -347,827 +347,828 @@ func sqliteparserParserInit() { 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, - 224, 226, 228, 0, 29, 3, 0, 58, 58, 69, 69, 82, 82, 2, 0, 47, 47, 66, 66, - 1, 0, 134, 135, 2, 0, 147, 147, 172, 172, 1, 0, 8, 9, 2, 0, 59, 59, 142, - 142, 2, 0, 56, 56, 104, 104, 2, 0, 58, 58, 82, 82, 5, 0, 25, 25, 72, 72, - 81, 81, 122, 122, 126, 126, 4, 0, 84, 84, 133, 133, 139, 139, 146, 146, - 2, 0, 7, 7, 12, 13, 1, 0, 14, 17, 1, 0, 18, 21, 4, 0, 77, 77, 97, 97, 99, - 99, 118, 118, 3, 0, 25, 25, 72, 72, 126, 126, 5, 0, 52, 54, 104, 104, 173, - 174, 187, 187, 190, 191, 2, 0, 29, 29, 62, 62, 3, 0, 76, 76, 96, 96, 125, - 125, 3, 0, 128, 128, 155, 155, 180, 180, 2, 0, 5, 5, 106, 106, 1, 0, 177, - 178, 2, 0, 34, 34, 60, 60, 2, 0, 152, 152, 163, 163, 2, 0, 160, 160, 167, - 167, 2, 0, 161, 161, 168, 169, 2, 0, 162, 162, 164, 164, 2, 0, 8, 10, 102, - 102, 2, 0, 186, 186, 190, 190, 1, 0, 25, 181, 2480, 0, 233, 1, 0, 0, 0, - 2, 241, 1, 0, 0, 0, 4, 267, 1, 0, 0, 0, 6, 295, 1, 0, 0, 0, 8, 327, 1, - 0, 0, 0, 10, 337, 1, 0, 0, 0, 12, 345, 1, 0, 0, 0, 14, 355, 1, 0, 0, 0, - 16, 359, 1, 0, 0, 0, 18, 370, 1, 0, 0, 0, 20, 373, 1, 0, 0, 0, 22, 379, - 1, 0, 0, 0, 24, 413, 1, 0, 0, 0, 26, 425, 1, 0, 0, 0, 28, 427, 1, 0, 0, - 0, 30, 474, 1, 0, 0, 0, 32, 485, 1, 0, 0, 0, 34, 503, 1, 0, 0, 0, 36, 555, - 1, 0, 0, 0, 38, 561, 1, 0, 0, 0, 40, 602, 1, 0, 0, 0, 42, 644, 1, 0, 0, - 0, 44, 648, 1, 0, 0, 0, 46, 712, 1, 0, 0, 0, 48, 744, 1, 0, 0, 0, 50, 773, - 1, 0, 0, 0, 52, 794, 1, 0, 0, 0, 54, 808, 1, 0, 0, 0, 56, 819, 1, 0, 0, - 0, 58, 838, 1, 0, 0, 0, 60, 866, 1, 0, 0, 0, 62, 879, 1, 0, 0, 0, 64, 897, - 1, 0, 0, 0, 66, 903, 1, 0, 0, 0, 68, 1005, 1, 0, 0, 0, 70, 1126, 1, 0, - 0, 0, 72, 1136, 1, 0, 0, 0, 74, 1211, 1, 0, 0, 0, 76, 1213, 1, 0, 0, 0, - 78, 1260, 1, 0, 0, 0, 80, 1278, 1, 0, 0, 0, 82, 1280, 1, 0, 0, 0, 84, 1294, - 1, 0, 0, 0, 86, 1311, 1, 0, 0, 0, 88, 1411, 1, 0, 0, 0, 90, 1413, 1, 0, - 0, 0, 92, 1416, 1, 0, 0, 0, 94, 1426, 1, 0, 0, 0, 96, 1576, 1, 0, 0, 0, - 98, 1590, 1, 0, 0, 0, 100, 1606, 1, 0, 0, 0, 102, 1622, 1, 0, 0, 0, 104, - 1630, 1, 0, 0, 0, 106, 1633, 1, 0, 0, 0, 108, 1668, 1, 0, 0, 0, 110, 1680, - 1, 0, 0, 0, 112, 1721, 1, 0, 0, 0, 114, 1735, 1, 0, 0, 0, 116, 1743, 1, - 0, 0, 0, 118, 1749, 1, 0, 0, 0, 120, 1780, 1, 0, 0, 0, 122, 1816, 1, 0, - 0, 0, 124, 1826, 1, 0, 0, 0, 126, 1835, 1, 0, 0, 0, 128, 1850, 1, 0, 0, - 0, 130, 1870, 1, 0, 0, 0, 132, 1892, 1, 0, 0, 0, 134, 1904, 1, 0, 0, 0, - 136, 1914, 1, 0, 0, 0, 138, 1920, 1, 0, 0, 0, 140, 1932, 1, 0, 0, 0, 142, - 1944, 1, 0, 0, 0, 144, 1956, 1, 0, 0, 0, 146, 1965, 1, 0, 0, 0, 148, 2052, - 1, 0, 0, 0, 150, 2054, 1, 0, 0, 0, 152, 2057, 1, 0, 0, 0, 154, 2060, 1, - 0, 0, 0, 156, 2067, 1, 0, 0, 0, 158, 2074, 1, 0, 0, 0, 160, 2078, 1, 0, - 0, 0, 162, 2092, 1, 0, 0, 0, 164, 2094, 1, 0, 0, 0, 166, 2096, 1, 0, 0, - 0, 168, 2098, 1, 0, 0, 0, 170, 2102, 1, 0, 0, 0, 172, 2104, 1, 0, 0, 0, - 174, 2106, 1, 0, 0, 0, 176, 2108, 1, 0, 0, 0, 178, 2110, 1, 0, 0, 0, 180, - 2115, 1, 0, 0, 0, 182, 2119, 1, 0, 0, 0, 184, 2121, 1, 0, 0, 0, 186, 2123, - 1, 0, 0, 0, 188, 2125, 1, 0, 0, 0, 190, 2127, 1, 0, 0, 0, 192, 2129, 1, - 0, 0, 0, 194, 2131, 1, 0, 0, 0, 196, 2133, 1, 0, 0, 0, 198, 2135, 1, 0, - 0, 0, 200, 2137, 1, 0, 0, 0, 202, 2139, 1, 0, 0, 0, 204, 2141, 1, 0, 0, - 0, 206, 2143, 1, 0, 0, 0, 208, 2145, 1, 0, 0, 0, 210, 2147, 1, 0, 0, 0, - 212, 2149, 1, 0, 0, 0, 214, 2151, 1, 0, 0, 0, 216, 2153, 1, 0, 0, 0, 218, - 2155, 1, 0, 0, 0, 220, 2157, 1, 0, 0, 0, 222, 2159, 1, 0, 0, 0, 224, 2161, - 1, 0, 0, 0, 226, 2163, 1, 0, 0, 0, 228, 2172, 1, 0, 0, 0, 230, 232, 3, - 2, 1, 0, 231, 230, 1, 0, 0, 0, 232, 235, 1, 0, 0, 0, 233, 231, 1, 0, 0, - 0, 233, 234, 1, 0, 0, 0, 234, 236, 1, 0, 0, 0, 235, 233, 1, 0, 0, 0, 236, - 237, 5, 0, 0, 1, 237, 1, 1, 0, 0, 0, 238, 240, 5, 1, 0, 0, 239, 238, 1, - 0, 0, 0, 240, 243, 1, 0, 0, 0, 241, 239, 1, 0, 0, 0, 241, 242, 1, 0, 0, - 0, 242, 244, 1, 0, 0, 0, 243, 241, 1, 0, 0, 0, 244, 253, 3, 4, 2, 0, 245, - 247, 5, 1, 0, 0, 246, 245, 1, 0, 0, 0, 247, 248, 1, 0, 0, 0, 248, 246, - 1, 0, 0, 0, 248, 249, 1, 0, 0, 0, 249, 250, 1, 0, 0, 0, 250, 252, 3, 4, - 2, 0, 251, 246, 1, 0, 0, 0, 252, 255, 1, 0, 0, 0, 253, 251, 1, 0, 0, 0, - 253, 254, 1, 0, 0, 0, 254, 259, 1, 0, 0, 0, 255, 253, 1, 0, 0, 0, 256, - 258, 5, 1, 0, 0, 257, 256, 1, 0, 0, 0, 258, 261, 1, 0, 0, 0, 259, 257, - 1, 0, 0, 0, 259, 260, 1, 0, 0, 0, 260, 3, 1, 0, 0, 0, 261, 259, 1, 0, 0, - 0, 262, 265, 5, 71, 0, 0, 263, 264, 5, 114, 0, 0, 264, 266, 5, 111, 0, - 0, 265, 263, 1, 0, 0, 0, 265, 266, 1, 0, 0, 0, 266, 268, 1, 0, 0, 0, 267, - 262, 1, 0, 0, 0, 267, 268, 1, 0, 0, 0, 268, 293, 1, 0, 0, 0, 269, 294, - 3, 6, 3, 0, 270, 294, 3, 8, 4, 0, 271, 294, 3, 10, 5, 0, 272, 294, 3, 12, - 6, 0, 273, 294, 3, 14, 7, 0, 274, 294, 3, 22, 11, 0, 275, 294, 3, 28, 14, - 0, 276, 294, 3, 44, 22, 0, 277, 294, 3, 46, 23, 0, 278, 294, 3, 48, 24, - 0, 279, 294, 3, 60, 30, 0, 280, 294, 3, 62, 31, 0, 281, 294, 3, 64, 32, - 0, 282, 294, 3, 66, 33, 0, 283, 294, 3, 74, 37, 0, 284, 294, 3, 78, 39, - 0, 285, 294, 3, 82, 41, 0, 286, 294, 3, 20, 10, 0, 287, 294, 3, 16, 8, - 0, 288, 294, 3, 18, 9, 0, 289, 294, 3, 84, 42, 0, 290, 294, 3, 106, 53, - 0, 291, 294, 3, 110, 55, 0, 292, 294, 3, 114, 57, 0, 293, 269, 1, 0, 0, - 0, 293, 270, 1, 0, 0, 0, 293, 271, 1, 0, 0, 0, 293, 272, 1, 0, 0, 0, 293, - 273, 1, 0, 0, 0, 293, 274, 1, 0, 0, 0, 293, 275, 1, 0, 0, 0, 293, 276, - 1, 0, 0, 0, 293, 277, 1, 0, 0, 0, 293, 278, 1, 0, 0, 0, 293, 279, 1, 0, - 0, 0, 293, 280, 1, 0, 0, 0, 293, 281, 1, 0, 0, 0, 293, 282, 1, 0, 0, 0, - 293, 283, 1, 0, 0, 0, 293, 284, 1, 0, 0, 0, 293, 285, 1, 0, 0, 0, 293, - 286, 1, 0, 0, 0, 293, 287, 1, 0, 0, 0, 293, 288, 1, 0, 0, 0, 293, 289, - 1, 0, 0, 0, 293, 290, 1, 0, 0, 0, 293, 291, 1, 0, 0, 0, 293, 292, 1, 0, - 0, 0, 294, 5, 1, 0, 0, 0, 295, 296, 5, 30, 0, 0, 296, 300, 5, 133, 0, 0, - 297, 298, 3, 182, 91, 0, 298, 299, 5, 2, 0, 0, 299, 301, 1, 0, 0, 0, 300, - 297, 1, 0, 0, 0, 300, 301, 1, 0, 0, 0, 301, 302, 1, 0, 0, 0, 302, 325, - 3, 184, 92, 0, 303, 313, 5, 121, 0, 0, 304, 305, 5, 137, 0, 0, 305, 314, - 3, 188, 94, 0, 306, 308, 5, 46, 0, 0, 307, 306, 1, 0, 0, 0, 307, 308, 1, - 0, 0, 0, 308, 309, 1, 0, 0, 0, 309, 310, 3, 190, 95, 0, 310, 311, 5, 137, - 0, 0, 311, 312, 3, 190, 95, 0, 312, 314, 1, 0, 0, 0, 313, 304, 1, 0, 0, - 0, 313, 307, 1, 0, 0, 0, 314, 326, 1, 0, 0, 0, 315, 317, 5, 27, 0, 0, 316, - 318, 5, 46, 0, 0, 317, 316, 1, 0, 0, 0, 317, 318, 1, 0, 0, 0, 318, 319, - 1, 0, 0, 0, 319, 326, 3, 30, 15, 0, 320, 322, 5, 63, 0, 0, 321, 323, 5, - 46, 0, 0, 322, 321, 1, 0, 0, 0, 322, 323, 1, 0, 0, 0, 323, 324, 1, 0, 0, - 0, 324, 326, 3, 190, 95, 0, 325, 303, 1, 0, 0, 0, 325, 315, 1, 0, 0, 0, - 325, 320, 1, 0, 0, 0, 326, 7, 1, 0, 0, 0, 327, 335, 5, 31, 0, 0, 328, 336, - 3, 182, 91, 0, 329, 330, 3, 182, 91, 0, 330, 331, 5, 2, 0, 0, 331, 333, - 1, 0, 0, 0, 332, 329, 1, 0, 0, 0, 332, 333, 1, 0, 0, 0, 333, 334, 1, 0, - 0, 0, 334, 336, 3, 186, 93, 0, 335, 328, 1, 0, 0, 0, 335, 332, 1, 0, 0, - 0, 335, 336, 1, 0, 0, 0, 336, 9, 1, 0, 0, 0, 337, 339, 5, 35, 0, 0, 338, - 340, 5, 55, 0, 0, 339, 338, 1, 0, 0, 0, 339, 340, 1, 0, 0, 0, 340, 341, - 1, 0, 0, 0, 341, 342, 3, 68, 34, 0, 342, 343, 5, 33, 0, 0, 343, 344, 3, - 182, 91, 0, 344, 11, 1, 0, 0, 0, 345, 347, 5, 38, 0, 0, 346, 348, 7, 0, - 0, 0, 347, 346, 1, 0, 0, 0, 347, 348, 1, 0, 0, 0, 348, 353, 1, 0, 0, 0, - 349, 351, 5, 138, 0, 0, 350, 352, 3, 212, 106, 0, 351, 350, 1, 0, 0, 0, - 351, 352, 1, 0, 0, 0, 352, 354, 1, 0, 0, 0, 353, 349, 1, 0, 0, 0, 353, - 354, 1, 0, 0, 0, 354, 13, 1, 0, 0, 0, 355, 357, 7, 1, 0, 0, 356, 358, 5, - 138, 0, 0, 357, 356, 1, 0, 0, 0, 357, 358, 1, 0, 0, 0, 358, 15, 1, 0, 0, - 0, 359, 361, 5, 126, 0, 0, 360, 362, 5, 138, 0, 0, 361, 360, 1, 0, 0, 0, - 361, 362, 1, 0, 0, 0, 362, 368, 1, 0, 0, 0, 363, 365, 5, 137, 0, 0, 364, - 366, 5, 129, 0, 0, 365, 364, 1, 0, 0, 0, 365, 366, 1, 0, 0, 0, 366, 367, - 1, 0, 0, 0, 367, 369, 3, 206, 103, 0, 368, 363, 1, 0, 0, 0, 368, 369, 1, - 0, 0, 0, 369, 17, 1, 0, 0, 0, 370, 371, 5, 129, 0, 0, 371, 372, 3, 206, - 103, 0, 372, 19, 1, 0, 0, 0, 373, 375, 5, 120, 0, 0, 374, 376, 5, 129, - 0, 0, 375, 374, 1, 0, 0, 0, 375, 376, 1, 0, 0, 0, 376, 377, 1, 0, 0, 0, - 377, 378, 3, 206, 103, 0, 378, 21, 1, 0, 0, 0, 379, 381, 5, 50, 0, 0, 380, - 382, 5, 141, 0, 0, 381, 380, 1, 0, 0, 0, 381, 382, 1, 0, 0, 0, 382, 383, - 1, 0, 0, 0, 383, 387, 5, 84, 0, 0, 384, 385, 5, 80, 0, 0, 385, 386, 5, - 102, 0, 0, 386, 388, 5, 70, 0, 0, 387, 384, 1, 0, 0, 0, 387, 388, 1, 0, - 0, 0, 388, 392, 1, 0, 0, 0, 389, 390, 3, 182, 91, 0, 390, 391, 5, 2, 0, - 0, 391, 393, 1, 0, 0, 0, 392, 389, 1, 0, 0, 0, 392, 393, 1, 0, 0, 0, 393, - 394, 1, 0, 0, 0, 394, 395, 3, 196, 98, 0, 395, 396, 5, 107, 0, 0, 396, - 397, 3, 184, 92, 0, 397, 398, 5, 3, 0, 0, 398, 403, 3, 24, 12, 0, 399, - 400, 5, 5, 0, 0, 400, 402, 3, 24, 12, 0, 401, 399, 1, 0, 0, 0, 402, 405, - 1, 0, 0, 0, 403, 401, 1, 0, 0, 0, 403, 404, 1, 0, 0, 0, 404, 406, 1, 0, - 0, 0, 405, 403, 1, 0, 0, 0, 406, 409, 5, 4, 0, 0, 407, 408, 5, 149, 0, - 0, 408, 410, 3, 68, 34, 0, 409, 407, 1, 0, 0, 0, 409, 410, 1, 0, 0, 0, - 410, 23, 1, 0, 0, 0, 411, 414, 3, 190, 95, 0, 412, 414, 3, 68, 34, 0, 413, - 411, 1, 0, 0, 0, 413, 412, 1, 0, 0, 0, 414, 417, 1, 0, 0, 0, 415, 416, - 5, 45, 0, 0, 416, 418, 3, 192, 96, 0, 417, 415, 1, 0, 0, 0, 417, 418, 1, - 0, 0, 0, 418, 420, 1, 0, 0, 0, 419, 421, 3, 140, 70, 0, 420, 419, 1, 0, - 0, 0, 420, 421, 1, 0, 0, 0, 421, 25, 1, 0, 0, 0, 422, 423, 5, 151, 0, 0, - 423, 426, 5, 186, 0, 0, 424, 426, 5, 132, 0, 0, 425, 422, 1, 0, 0, 0, 425, - 424, 1, 0, 0, 0, 426, 27, 1, 0, 0, 0, 427, 429, 5, 50, 0, 0, 428, 430, - 7, 2, 0, 0, 429, 428, 1, 0, 0, 0, 429, 430, 1, 0, 0, 0, 430, 431, 1, 0, - 0, 0, 431, 435, 5, 133, 0, 0, 432, 433, 5, 80, 0, 0, 433, 434, 5, 102, - 0, 0, 434, 436, 5, 70, 0, 0, 435, 432, 1, 0, 0, 0, 435, 436, 1, 0, 0, 0, - 436, 440, 1, 0, 0, 0, 437, 438, 3, 182, 91, 0, 438, 439, 5, 2, 0, 0, 439, - 441, 1, 0, 0, 0, 440, 437, 1, 0, 0, 0, 440, 441, 1, 0, 0, 0, 441, 442, - 1, 0, 0, 0, 442, 472, 3, 184, 92, 0, 443, 444, 5, 3, 0, 0, 444, 449, 3, - 30, 15, 0, 445, 446, 5, 5, 0, 0, 446, 448, 3, 30, 15, 0, 447, 445, 1, 0, - 0, 0, 448, 451, 1, 0, 0, 0, 449, 450, 1, 0, 0, 0, 449, 447, 1, 0, 0, 0, - 450, 456, 1, 0, 0, 0, 451, 449, 1, 0, 0, 0, 452, 453, 5, 5, 0, 0, 453, - 455, 3, 38, 19, 0, 454, 452, 1, 0, 0, 0, 455, 458, 1, 0, 0, 0, 456, 454, - 1, 0, 0, 0, 456, 457, 1, 0, 0, 0, 457, 459, 1, 0, 0, 0, 458, 456, 1, 0, - 0, 0, 459, 468, 5, 4, 0, 0, 460, 465, 3, 26, 13, 0, 461, 462, 5, 5, 0, - 0, 462, 464, 3, 26, 13, 0, 463, 461, 1, 0, 0, 0, 464, 467, 1, 0, 0, 0, - 465, 463, 1, 0, 0, 0, 465, 466, 1, 0, 0, 0, 466, 469, 1, 0, 0, 0, 467, - 465, 1, 0, 0, 0, 468, 460, 1, 0, 0, 0, 468, 469, 1, 0, 0, 0, 469, 473, - 1, 0, 0, 0, 470, 471, 5, 33, 0, 0, 471, 473, 3, 84, 42, 0, 472, 443, 1, - 0, 0, 0, 472, 470, 1, 0, 0, 0, 473, 29, 1, 0, 0, 0, 474, 476, 3, 190, 95, - 0, 475, 477, 3, 32, 16, 0, 476, 475, 1, 0, 0, 0, 476, 477, 1, 0, 0, 0, - 477, 481, 1, 0, 0, 0, 478, 480, 3, 34, 17, 0, 479, 478, 1, 0, 0, 0, 480, - 483, 1, 0, 0, 0, 481, 479, 1, 0, 0, 0, 481, 482, 1, 0, 0, 0, 482, 31, 1, - 0, 0, 0, 483, 481, 1, 0, 0, 0, 484, 486, 3, 176, 88, 0, 485, 484, 1, 0, - 0, 0, 486, 487, 1, 0, 0, 0, 487, 488, 1, 0, 0, 0, 487, 485, 1, 0, 0, 0, - 488, 499, 1, 0, 0, 0, 489, 490, 5, 3, 0, 0, 490, 491, 3, 36, 18, 0, 491, - 492, 5, 4, 0, 0, 492, 500, 1, 0, 0, 0, 493, 494, 5, 3, 0, 0, 494, 495, - 3, 36, 18, 0, 495, 496, 5, 5, 0, 0, 496, 497, 3, 36, 18, 0, 497, 498, 5, - 4, 0, 0, 498, 500, 1, 0, 0, 0, 499, 489, 1, 0, 0, 0, 499, 493, 1, 0, 0, - 0, 499, 500, 1, 0, 0, 0, 500, 33, 1, 0, 0, 0, 501, 502, 5, 49, 0, 0, 502, - 504, 3, 176, 88, 0, 503, 501, 1, 0, 0, 0, 503, 504, 1, 0, 0, 0, 504, 552, - 1, 0, 0, 0, 505, 506, 5, 113, 0, 0, 506, 508, 5, 95, 0, 0, 507, 509, 3, - 140, 70, 0, 508, 507, 1, 0, 0, 0, 508, 509, 1, 0, 0, 0, 509, 511, 1, 0, - 0, 0, 510, 512, 3, 42, 21, 0, 511, 510, 1, 0, 0, 0, 511, 512, 1, 0, 0, - 0, 512, 514, 1, 0, 0, 0, 513, 515, 5, 36, 0, 0, 514, 513, 1, 0, 0, 0, 514, - 515, 1, 0, 0, 0, 515, 553, 1, 0, 0, 0, 516, 517, 5, 102, 0, 0, 517, 520, - 5, 104, 0, 0, 518, 520, 5, 141, 0, 0, 519, 516, 1, 0, 0, 0, 519, 518, 1, - 0, 0, 0, 520, 522, 1, 0, 0, 0, 521, 523, 3, 42, 21, 0, 522, 521, 1, 0, - 0, 0, 522, 523, 1, 0, 0, 0, 523, 553, 1, 0, 0, 0, 524, 525, 5, 44, 0, 0, - 525, 526, 5, 3, 0, 0, 526, 527, 3, 68, 34, 0, 527, 528, 5, 4, 0, 0, 528, - 553, 1, 0, 0, 0, 529, 536, 5, 56, 0, 0, 530, 537, 3, 36, 18, 0, 531, 537, - 3, 72, 36, 0, 532, 533, 5, 3, 0, 0, 533, 534, 3, 68, 34, 0, 534, 535, 5, - 4, 0, 0, 535, 537, 1, 0, 0, 0, 536, 530, 1, 0, 0, 0, 536, 531, 1, 0, 0, - 0, 536, 532, 1, 0, 0, 0, 537, 553, 1, 0, 0, 0, 538, 539, 5, 45, 0, 0, 539, - 553, 3, 192, 96, 0, 540, 553, 3, 40, 20, 0, 541, 542, 5, 170, 0, 0, 542, - 544, 5, 171, 0, 0, 543, 541, 1, 0, 0, 0, 543, 544, 1, 0, 0, 0, 544, 545, - 1, 0, 0, 0, 545, 546, 5, 33, 0, 0, 546, 547, 5, 3, 0, 0, 547, 548, 3, 68, - 34, 0, 548, 550, 5, 4, 0, 0, 549, 551, 7, 3, 0, 0, 550, 549, 1, 0, 0, 0, - 550, 551, 1, 0, 0, 0, 551, 553, 1, 0, 0, 0, 552, 505, 1, 0, 0, 0, 552, - 519, 1, 0, 0, 0, 552, 524, 1, 0, 0, 0, 552, 529, 1, 0, 0, 0, 552, 538, - 1, 0, 0, 0, 552, 540, 1, 0, 0, 0, 552, 543, 1, 0, 0, 0, 553, 35, 1, 0, - 0, 0, 554, 556, 7, 4, 0, 0, 555, 554, 1, 0, 0, 0, 555, 556, 1, 0, 0, 0, - 556, 557, 1, 0, 0, 0, 557, 558, 5, 187, 0, 0, 558, 37, 1, 0, 0, 0, 559, - 560, 5, 49, 0, 0, 560, 562, 3, 176, 88, 0, 561, 559, 1, 0, 0, 0, 561, 562, - 1, 0, 0, 0, 562, 600, 1, 0, 0, 0, 563, 564, 5, 113, 0, 0, 564, 567, 5, - 95, 0, 0, 565, 567, 5, 141, 0, 0, 566, 563, 1, 0, 0, 0, 566, 565, 1, 0, - 0, 0, 567, 568, 1, 0, 0, 0, 568, 569, 5, 3, 0, 0, 569, 574, 3, 24, 12, - 0, 570, 571, 5, 5, 0, 0, 571, 573, 3, 24, 12, 0, 572, 570, 1, 0, 0, 0, - 573, 576, 1, 0, 0, 0, 574, 572, 1, 0, 0, 0, 574, 575, 1, 0, 0, 0, 575, - 577, 1, 0, 0, 0, 576, 574, 1, 0, 0, 0, 577, 579, 5, 4, 0, 0, 578, 580, - 3, 42, 21, 0, 579, 578, 1, 0, 0, 0, 579, 580, 1, 0, 0, 0, 580, 601, 1, - 0, 0, 0, 581, 582, 5, 44, 0, 0, 582, 583, 5, 3, 0, 0, 583, 584, 3, 68, - 34, 0, 584, 585, 5, 4, 0, 0, 585, 601, 1, 0, 0, 0, 586, 587, 5, 74, 0, - 0, 587, 588, 5, 95, 0, 0, 588, 589, 5, 3, 0, 0, 589, 594, 3, 190, 95, 0, - 590, 591, 5, 5, 0, 0, 591, 593, 3, 190, 95, 0, 592, 590, 1, 0, 0, 0, 593, - 596, 1, 0, 0, 0, 594, 592, 1, 0, 0, 0, 594, 595, 1, 0, 0, 0, 595, 597, - 1, 0, 0, 0, 596, 594, 1, 0, 0, 0, 597, 598, 5, 4, 0, 0, 598, 599, 3, 40, - 20, 0, 599, 601, 1, 0, 0, 0, 600, 566, 1, 0, 0, 0, 600, 581, 1, 0, 0, 0, - 600, 586, 1, 0, 0, 0, 601, 39, 1, 0, 0, 0, 602, 603, 5, 117, 0, 0, 603, - 615, 3, 194, 97, 0, 604, 605, 5, 3, 0, 0, 605, 610, 3, 190, 95, 0, 606, - 607, 5, 5, 0, 0, 607, 609, 3, 190, 95, 0, 608, 606, 1, 0, 0, 0, 609, 612, - 1, 0, 0, 0, 610, 608, 1, 0, 0, 0, 610, 611, 1, 0, 0, 0, 611, 613, 1, 0, - 0, 0, 612, 610, 1, 0, 0, 0, 613, 614, 5, 4, 0, 0, 614, 616, 1, 0, 0, 0, - 615, 604, 1, 0, 0, 0, 615, 616, 1, 0, 0, 0, 616, 631, 1, 0, 0, 0, 617, - 618, 5, 107, 0, 0, 618, 625, 7, 5, 0, 0, 619, 620, 5, 131, 0, 0, 620, 626, - 7, 6, 0, 0, 621, 626, 5, 41, 0, 0, 622, 626, 5, 123, 0, 0, 623, 624, 5, - 101, 0, 0, 624, 626, 5, 26, 0, 0, 625, 619, 1, 0, 0, 0, 625, 621, 1, 0, - 0, 0, 625, 622, 1, 0, 0, 0, 625, 623, 1, 0, 0, 0, 626, 630, 1, 0, 0, 0, - 627, 628, 5, 99, 0, 0, 628, 630, 3, 176, 88, 0, 629, 617, 1, 0, 0, 0, 629, - 627, 1, 0, 0, 0, 630, 633, 1, 0, 0, 0, 631, 629, 1, 0, 0, 0, 631, 632, - 1, 0, 0, 0, 632, 642, 1, 0, 0, 0, 633, 631, 1, 0, 0, 0, 634, 636, 5, 102, - 0, 0, 635, 634, 1, 0, 0, 0, 635, 636, 1, 0, 0, 0, 636, 637, 1, 0, 0, 0, - 637, 640, 5, 57, 0, 0, 638, 639, 5, 86, 0, 0, 639, 641, 7, 7, 0, 0, 640, - 638, 1, 0, 0, 0, 640, 641, 1, 0, 0, 0, 641, 643, 1, 0, 0, 0, 642, 635, - 1, 0, 0, 0, 642, 643, 1, 0, 0, 0, 643, 41, 1, 0, 0, 0, 644, 645, 5, 107, - 0, 0, 645, 646, 5, 48, 0, 0, 646, 647, 7, 8, 0, 0, 647, 43, 1, 0, 0, 0, - 648, 650, 5, 50, 0, 0, 649, 651, 7, 2, 0, 0, 650, 649, 1, 0, 0, 0, 650, - 651, 1, 0, 0, 0, 651, 652, 1, 0, 0, 0, 652, 656, 5, 139, 0, 0, 653, 654, - 5, 80, 0, 0, 654, 655, 5, 102, 0, 0, 655, 657, 5, 70, 0, 0, 656, 653, 1, - 0, 0, 0, 656, 657, 1, 0, 0, 0, 657, 661, 1, 0, 0, 0, 658, 659, 3, 182, - 91, 0, 659, 660, 5, 2, 0, 0, 660, 662, 1, 0, 0, 0, 661, 658, 1, 0, 0, 0, - 661, 662, 1, 0, 0, 0, 662, 663, 1, 0, 0, 0, 663, 668, 3, 198, 99, 0, 664, - 669, 5, 37, 0, 0, 665, 669, 5, 28, 0, 0, 666, 667, 5, 89, 0, 0, 667, 669, - 5, 105, 0, 0, 668, 664, 1, 0, 0, 0, 668, 665, 1, 0, 0, 0, 668, 666, 1, - 0, 0, 0, 668, 669, 1, 0, 0, 0, 669, 684, 1, 0, 0, 0, 670, 685, 5, 59, 0, - 0, 671, 685, 5, 88, 0, 0, 672, 682, 5, 142, 0, 0, 673, 674, 5, 105, 0, - 0, 674, 679, 3, 190, 95, 0, 675, 676, 5, 5, 0, 0, 676, 678, 3, 190, 95, - 0, 677, 675, 1, 0, 0, 0, 678, 681, 1, 0, 0, 0, 679, 677, 1, 0, 0, 0, 679, - 680, 1, 0, 0, 0, 680, 683, 1, 0, 0, 0, 681, 679, 1, 0, 0, 0, 682, 673, - 1, 0, 0, 0, 682, 683, 1, 0, 0, 0, 683, 685, 1, 0, 0, 0, 684, 670, 1, 0, - 0, 0, 684, 671, 1, 0, 0, 0, 684, 672, 1, 0, 0, 0, 685, 686, 1, 0, 0, 0, - 686, 687, 5, 107, 0, 0, 687, 691, 3, 184, 92, 0, 688, 689, 5, 73, 0, 0, - 689, 690, 5, 64, 0, 0, 690, 692, 5, 127, 0, 0, 691, 688, 1, 0, 0, 0, 691, - 692, 1, 0, 0, 0, 692, 695, 1, 0, 0, 0, 693, 694, 5, 148, 0, 0, 694, 696, - 3, 68, 34, 0, 695, 693, 1, 0, 0, 0, 695, 696, 1, 0, 0, 0, 696, 697, 1, - 0, 0, 0, 697, 706, 5, 38, 0, 0, 698, 703, 3, 106, 53, 0, 699, 703, 3, 74, - 37, 0, 700, 703, 3, 60, 30, 0, 701, 703, 3, 84, 42, 0, 702, 698, 1, 0, - 0, 0, 702, 699, 1, 0, 0, 0, 702, 700, 1, 0, 0, 0, 702, 701, 1, 0, 0, 0, - 703, 704, 1, 0, 0, 0, 704, 705, 5, 1, 0, 0, 705, 707, 1, 0, 0, 0, 706, - 702, 1, 0, 0, 0, 707, 708, 1, 0, 0, 0, 708, 706, 1, 0, 0, 0, 708, 709, - 1, 0, 0, 0, 709, 710, 1, 0, 0, 0, 710, 711, 5, 66, 0, 0, 711, 45, 1, 0, - 0, 0, 712, 714, 5, 50, 0, 0, 713, 715, 7, 2, 0, 0, 714, 713, 1, 0, 0, 0, - 714, 715, 1, 0, 0, 0, 715, 716, 1, 0, 0, 0, 716, 720, 5, 146, 0, 0, 717, - 718, 5, 80, 0, 0, 718, 719, 5, 102, 0, 0, 719, 721, 5, 70, 0, 0, 720, 717, - 1, 0, 0, 0, 720, 721, 1, 0, 0, 0, 721, 725, 1, 0, 0, 0, 722, 723, 3, 182, - 91, 0, 723, 724, 5, 2, 0, 0, 724, 726, 1, 0, 0, 0, 725, 722, 1, 0, 0, 0, - 725, 726, 1, 0, 0, 0, 726, 727, 1, 0, 0, 0, 727, 739, 3, 200, 100, 0, 728, - 729, 5, 3, 0, 0, 729, 734, 3, 190, 95, 0, 730, 731, 5, 5, 0, 0, 731, 733, - 3, 190, 95, 0, 732, 730, 1, 0, 0, 0, 733, 736, 1, 0, 0, 0, 734, 732, 1, - 0, 0, 0, 734, 735, 1, 0, 0, 0, 735, 737, 1, 0, 0, 0, 736, 734, 1, 0, 0, - 0, 737, 738, 5, 4, 0, 0, 738, 740, 1, 0, 0, 0, 739, 728, 1, 0, 0, 0, 739, - 740, 1, 0, 0, 0, 740, 741, 1, 0, 0, 0, 741, 742, 5, 33, 0, 0, 742, 743, - 3, 84, 42, 0, 743, 47, 1, 0, 0, 0, 744, 745, 5, 50, 0, 0, 745, 746, 5, - 147, 0, 0, 746, 750, 5, 133, 0, 0, 747, 748, 5, 80, 0, 0, 748, 749, 5, - 102, 0, 0, 749, 751, 5, 70, 0, 0, 750, 747, 1, 0, 0, 0, 750, 751, 1, 0, - 0, 0, 751, 755, 1, 0, 0, 0, 752, 753, 3, 182, 91, 0, 753, 754, 5, 2, 0, - 0, 754, 756, 1, 0, 0, 0, 755, 752, 1, 0, 0, 0, 755, 756, 1, 0, 0, 0, 756, - 757, 1, 0, 0, 0, 757, 758, 3, 184, 92, 0, 758, 759, 5, 143, 0, 0, 759, - 771, 3, 202, 101, 0, 760, 761, 5, 3, 0, 0, 761, 766, 3, 170, 85, 0, 762, - 763, 5, 5, 0, 0, 763, 765, 3, 170, 85, 0, 764, 762, 1, 0, 0, 0, 765, 768, - 1, 0, 0, 0, 766, 764, 1, 0, 0, 0, 766, 767, 1, 0, 0, 0, 767, 769, 1, 0, - 0, 0, 768, 766, 1, 0, 0, 0, 769, 770, 5, 4, 0, 0, 770, 772, 1, 0, 0, 0, - 771, 760, 1, 0, 0, 0, 771, 772, 1, 0, 0, 0, 772, 49, 1, 0, 0, 0, 773, 775, - 5, 150, 0, 0, 774, 776, 5, 116, 0, 0, 775, 774, 1, 0, 0, 0, 775, 776, 1, - 0, 0, 0, 776, 777, 1, 0, 0, 0, 777, 778, 3, 52, 26, 0, 778, 779, 5, 33, - 0, 0, 779, 780, 5, 3, 0, 0, 780, 781, 3, 84, 42, 0, 781, 791, 5, 4, 0, - 0, 782, 783, 5, 5, 0, 0, 783, 784, 3, 52, 26, 0, 784, 785, 5, 33, 0, 0, - 785, 786, 5, 3, 0, 0, 786, 787, 3, 84, 42, 0, 787, 788, 5, 4, 0, 0, 788, - 790, 1, 0, 0, 0, 789, 782, 1, 0, 0, 0, 790, 793, 1, 0, 0, 0, 791, 789, - 1, 0, 0, 0, 791, 792, 1, 0, 0, 0, 792, 51, 1, 0, 0, 0, 793, 791, 1, 0, - 0, 0, 794, 806, 3, 184, 92, 0, 795, 796, 5, 3, 0, 0, 796, 801, 3, 190, - 95, 0, 797, 798, 5, 5, 0, 0, 798, 800, 3, 190, 95, 0, 799, 797, 1, 0, 0, - 0, 800, 803, 1, 0, 0, 0, 801, 799, 1, 0, 0, 0, 801, 802, 1, 0, 0, 0, 802, - 804, 1, 0, 0, 0, 803, 801, 1, 0, 0, 0, 804, 805, 5, 4, 0, 0, 805, 807, - 1, 0, 0, 0, 806, 795, 1, 0, 0, 0, 806, 807, 1, 0, 0, 0, 807, 53, 1, 0, - 0, 0, 808, 809, 3, 52, 26, 0, 809, 810, 5, 33, 0, 0, 810, 811, 5, 3, 0, - 0, 811, 812, 3, 162, 81, 0, 812, 814, 5, 140, 0, 0, 813, 815, 5, 29, 0, - 0, 814, 813, 1, 0, 0, 0, 814, 815, 1, 0, 0, 0, 815, 816, 1, 0, 0, 0, 816, - 817, 3, 164, 82, 0, 817, 818, 5, 4, 0, 0, 818, 55, 1, 0, 0, 0, 819, 831, - 3, 184, 92, 0, 820, 821, 5, 3, 0, 0, 821, 826, 3, 190, 95, 0, 822, 823, - 5, 5, 0, 0, 823, 825, 3, 190, 95, 0, 824, 822, 1, 0, 0, 0, 825, 828, 1, - 0, 0, 0, 826, 824, 1, 0, 0, 0, 826, 827, 1, 0, 0, 0, 827, 829, 1, 0, 0, - 0, 828, 826, 1, 0, 0, 0, 829, 830, 5, 4, 0, 0, 830, 832, 1, 0, 0, 0, 831, - 820, 1, 0, 0, 0, 831, 832, 1, 0, 0, 0, 832, 833, 1, 0, 0, 0, 833, 834, - 5, 33, 0, 0, 834, 835, 5, 3, 0, 0, 835, 836, 3, 84, 42, 0, 836, 837, 5, - 4, 0, 0, 837, 57, 1, 0, 0, 0, 838, 847, 5, 124, 0, 0, 839, 848, 5, 7, 0, - 0, 840, 845, 3, 68, 34, 0, 841, 843, 5, 33, 0, 0, 842, 841, 1, 0, 0, 0, - 842, 843, 1, 0, 0, 0, 843, 844, 1, 0, 0, 0, 844, 846, 3, 172, 86, 0, 845, - 842, 1, 0, 0, 0, 845, 846, 1, 0, 0, 0, 846, 848, 1, 0, 0, 0, 847, 839, - 1, 0, 0, 0, 847, 840, 1, 0, 0, 0, 848, 862, 1, 0, 0, 0, 849, 858, 5, 5, - 0, 0, 850, 859, 5, 7, 0, 0, 851, 856, 3, 68, 34, 0, 852, 854, 5, 33, 0, - 0, 853, 852, 1, 0, 0, 0, 853, 854, 1, 0, 0, 0, 854, 855, 1, 0, 0, 0, 855, - 857, 3, 172, 86, 0, 856, 853, 1, 0, 0, 0, 856, 857, 1, 0, 0, 0, 857, 859, - 1, 0, 0, 0, 858, 850, 1, 0, 0, 0, 858, 851, 1, 0, 0, 0, 859, 861, 1, 0, - 0, 0, 860, 849, 1, 0, 0, 0, 861, 864, 1, 0, 0, 0, 862, 860, 1, 0, 0, 0, - 862, 863, 1, 0, 0, 0, 863, 59, 1, 0, 0, 0, 864, 862, 1, 0, 0, 0, 865, 867, - 3, 50, 25, 0, 866, 865, 1, 0, 0, 0, 866, 867, 1, 0, 0, 0, 867, 868, 1, - 0, 0, 0, 868, 869, 5, 59, 0, 0, 869, 870, 5, 75, 0, 0, 870, 873, 3, 112, - 56, 0, 871, 872, 5, 149, 0, 0, 872, 874, 3, 68, 34, 0, 873, 871, 1, 0, - 0, 0, 873, 874, 1, 0, 0, 0, 874, 876, 1, 0, 0, 0, 875, 877, 3, 58, 29, - 0, 876, 875, 1, 0, 0, 0, 876, 877, 1, 0, 0, 0, 877, 61, 1, 0, 0, 0, 878, - 880, 3, 50, 25, 0, 879, 878, 1, 0, 0, 0, 879, 880, 1, 0, 0, 0, 880, 881, - 1, 0, 0, 0, 881, 882, 5, 59, 0, 0, 882, 883, 5, 75, 0, 0, 883, 886, 3, - 112, 56, 0, 884, 885, 5, 149, 0, 0, 885, 887, 3, 68, 34, 0, 886, 884, 1, - 0, 0, 0, 886, 887, 1, 0, 0, 0, 887, 892, 1, 0, 0, 0, 888, 890, 3, 134, - 67, 0, 889, 888, 1, 0, 0, 0, 889, 890, 1, 0, 0, 0, 890, 891, 1, 0, 0, 0, - 891, 893, 3, 136, 68, 0, 892, 889, 1, 0, 0, 0, 892, 893, 1, 0, 0, 0, 893, - 895, 1, 0, 0, 0, 894, 896, 3, 58, 29, 0, 895, 894, 1, 0, 0, 0, 895, 896, - 1, 0, 0, 0, 896, 63, 1, 0, 0, 0, 897, 899, 5, 61, 0, 0, 898, 900, 5, 55, - 0, 0, 899, 898, 1, 0, 0, 0, 899, 900, 1, 0, 0, 0, 900, 901, 1, 0, 0, 0, - 901, 902, 3, 182, 91, 0, 902, 65, 1, 0, 0, 0, 903, 904, 5, 63, 0, 0, 904, - 907, 7, 9, 0, 0, 905, 906, 5, 80, 0, 0, 906, 908, 5, 70, 0, 0, 907, 905, - 1, 0, 0, 0, 907, 908, 1, 0, 0, 0, 908, 912, 1, 0, 0, 0, 909, 910, 3, 182, - 91, 0, 910, 911, 5, 2, 0, 0, 911, 913, 1, 0, 0, 0, 912, 909, 1, 0, 0, 0, - 912, 913, 1, 0, 0, 0, 913, 914, 1, 0, 0, 0, 914, 915, 3, 228, 114, 0, 915, - 67, 1, 0, 0, 0, 916, 917, 6, 34, -1, 0, 917, 1006, 3, 72, 36, 0, 918, 1006, - 5, 188, 0, 0, 919, 1006, 5, 189, 0, 0, 920, 921, 3, 182, 91, 0, 921, 922, - 5, 2, 0, 0, 922, 924, 1, 0, 0, 0, 923, 920, 1, 0, 0, 0, 923, 924, 1, 0, - 0, 0, 924, 925, 1, 0, 0, 0, 925, 926, 3, 184, 92, 0, 926, 927, 5, 2, 0, - 0, 927, 929, 1, 0, 0, 0, 928, 923, 1, 0, 0, 0, 928, 929, 1, 0, 0, 0, 929, - 930, 1, 0, 0, 0, 930, 1006, 3, 190, 95, 0, 931, 932, 3, 166, 83, 0, 932, - 933, 3, 68, 34, 20, 933, 1006, 1, 0, 0, 0, 934, 935, 3, 180, 90, 0, 935, - 948, 5, 3, 0, 0, 936, 938, 5, 62, 0, 0, 937, 936, 1, 0, 0, 0, 937, 938, - 1, 0, 0, 0, 938, 939, 1, 0, 0, 0, 939, 944, 3, 68, 34, 0, 940, 941, 5, - 5, 0, 0, 941, 943, 3, 68, 34, 0, 942, 940, 1, 0, 0, 0, 943, 946, 1, 0, - 0, 0, 944, 942, 1, 0, 0, 0, 944, 945, 1, 0, 0, 0, 945, 949, 1, 0, 0, 0, - 946, 944, 1, 0, 0, 0, 947, 949, 5, 7, 0, 0, 948, 937, 1, 0, 0, 0, 948, - 947, 1, 0, 0, 0, 948, 949, 1, 0, 0, 0, 949, 950, 1, 0, 0, 0, 950, 952, - 5, 4, 0, 0, 951, 953, 3, 116, 58, 0, 952, 951, 1, 0, 0, 0, 952, 953, 1, - 0, 0, 0, 953, 955, 1, 0, 0, 0, 954, 956, 3, 120, 60, 0, 955, 954, 1, 0, - 0, 0, 955, 956, 1, 0, 0, 0, 956, 1006, 1, 0, 0, 0, 957, 958, 5, 3, 0, 0, - 958, 963, 3, 68, 34, 0, 959, 960, 5, 5, 0, 0, 960, 962, 3, 68, 34, 0, 961, - 959, 1, 0, 0, 0, 962, 965, 1, 0, 0, 0, 963, 961, 1, 0, 0, 0, 963, 964, - 1, 0, 0, 0, 964, 966, 1, 0, 0, 0, 965, 963, 1, 0, 0, 0, 966, 967, 5, 4, - 0, 0, 967, 1006, 1, 0, 0, 0, 968, 969, 5, 43, 0, 0, 969, 970, 5, 3, 0, - 0, 970, 971, 3, 68, 34, 0, 971, 972, 5, 33, 0, 0, 972, 973, 3, 32, 16, - 0, 973, 974, 5, 4, 0, 0, 974, 1006, 1, 0, 0, 0, 975, 977, 5, 102, 0, 0, - 976, 975, 1, 0, 0, 0, 976, 977, 1, 0, 0, 0, 977, 978, 1, 0, 0, 0, 978, - 980, 5, 70, 0, 0, 979, 976, 1, 0, 0, 0, 979, 980, 1, 0, 0, 0, 980, 981, - 1, 0, 0, 0, 981, 982, 5, 3, 0, 0, 982, 983, 3, 84, 42, 0, 983, 984, 5, - 4, 0, 0, 984, 1006, 1, 0, 0, 0, 985, 987, 5, 42, 0, 0, 986, 988, 3, 68, - 34, 0, 987, 986, 1, 0, 0, 0, 987, 988, 1, 0, 0, 0, 988, 994, 1, 0, 0, 0, - 989, 990, 5, 148, 0, 0, 990, 991, 3, 68, 34, 0, 991, 992, 5, 136, 0, 0, - 992, 993, 3, 68, 34, 0, 993, 995, 1, 0, 0, 0, 994, 989, 1, 0, 0, 0, 995, - 996, 1, 0, 0, 0, 996, 994, 1, 0, 0, 0, 996, 997, 1, 0, 0, 0, 997, 1000, - 1, 0, 0, 0, 998, 999, 5, 65, 0, 0, 999, 1001, 3, 68, 34, 0, 1000, 998, - 1, 0, 0, 0, 1000, 1001, 1, 0, 0, 0, 1001, 1002, 1, 0, 0, 0, 1002, 1003, - 5, 66, 0, 0, 1003, 1006, 1, 0, 0, 0, 1004, 1006, 3, 70, 35, 0, 1005, 916, - 1, 0, 0, 0, 1005, 918, 1, 0, 0, 0, 1005, 919, 1, 0, 0, 0, 1005, 928, 1, - 0, 0, 0, 1005, 931, 1, 0, 0, 0, 1005, 934, 1, 0, 0, 0, 1005, 957, 1, 0, - 0, 0, 1005, 968, 1, 0, 0, 0, 1005, 979, 1, 0, 0, 0, 1005, 985, 1, 0, 0, - 0, 1005, 1004, 1, 0, 0, 0, 1006, 1123, 1, 0, 0, 0, 1007, 1008, 10, 19, - 0, 0, 1008, 1009, 5, 11, 0, 0, 1009, 1122, 3, 68, 34, 20, 1010, 1011, 10, - 18, 0, 0, 1011, 1012, 7, 10, 0, 0, 1012, 1122, 3, 68, 34, 19, 1013, 1014, - 10, 17, 0, 0, 1014, 1015, 7, 4, 0, 0, 1015, 1122, 3, 68, 34, 18, 1016, - 1017, 10, 16, 0, 0, 1017, 1018, 7, 11, 0, 0, 1018, 1122, 3, 68, 34, 17, - 1019, 1020, 10, 15, 0, 0, 1020, 1021, 7, 12, 0, 0, 1021, 1122, 3, 68, 34, - 16, 1022, 1038, 10, 14, 0, 0, 1023, 1039, 5, 6, 0, 0, 1024, 1039, 5, 22, - 0, 0, 1025, 1039, 5, 23, 0, 0, 1026, 1039, 5, 24, 0, 0, 1027, 1039, 5, - 92, 0, 0, 1028, 1029, 5, 92, 0, 0, 1029, 1039, 5, 102, 0, 0, 1030, 1032, - 5, 102, 0, 0, 1031, 1030, 1, 0, 0, 0, 1031, 1032, 1, 0, 0, 0, 1032, 1033, - 1, 0, 0, 0, 1033, 1039, 5, 83, 0, 0, 1034, 1039, 5, 97, 0, 0, 1035, 1039, - 5, 77, 0, 0, 1036, 1039, 5, 99, 0, 0, 1037, 1039, 5, 118, 0, 0, 1038, 1023, - 1, 0, 0, 0, 1038, 1024, 1, 0, 0, 0, 1038, 1025, 1, 0, 0, 0, 1038, 1026, - 1, 0, 0, 0, 1038, 1027, 1, 0, 0, 0, 1038, 1028, 1, 0, 0, 0, 1038, 1031, - 1, 0, 0, 0, 1038, 1034, 1, 0, 0, 0, 1038, 1035, 1, 0, 0, 0, 1038, 1036, - 1, 0, 0, 0, 1038, 1037, 1, 0, 0, 0, 1039, 1040, 1, 0, 0, 0, 1040, 1122, - 3, 68, 34, 15, 1041, 1042, 10, 12, 0, 0, 1042, 1043, 5, 32, 0, 0, 1043, - 1122, 3, 68, 34, 13, 1044, 1045, 10, 11, 0, 0, 1045, 1046, 5, 108, 0, 0, - 1046, 1122, 3, 68, 34, 12, 1047, 1049, 10, 4, 0, 0, 1048, 1050, 5, 102, - 0, 0, 1049, 1048, 1, 0, 0, 0, 1049, 1050, 1, 0, 0, 0, 1050, 1051, 1, 0, - 0, 0, 1051, 1052, 5, 39, 0, 0, 1052, 1053, 3, 68, 34, 0, 1053, 1054, 5, - 32, 0, 0, 1054, 1055, 3, 68, 34, 5, 1055, 1122, 1, 0, 0, 0, 1056, 1058, - 10, 13, 0, 0, 1057, 1059, 5, 102, 0, 0, 1058, 1057, 1, 0, 0, 0, 1058, 1059, - 1, 0, 0, 0, 1059, 1060, 1, 0, 0, 0, 1060, 1099, 5, 83, 0, 0, 1061, 1071, - 5, 3, 0, 0, 1062, 1072, 3, 84, 42, 0, 1063, 1068, 3, 68, 34, 0, 1064, 1065, - 5, 5, 0, 0, 1065, 1067, 3, 68, 34, 0, 1066, 1064, 1, 0, 0, 0, 1067, 1070, - 1, 0, 0, 0, 1068, 1066, 1, 0, 0, 0, 1068, 1069, 1, 0, 0, 0, 1069, 1072, - 1, 0, 0, 0, 1070, 1068, 1, 0, 0, 0, 1071, 1062, 1, 0, 0, 0, 1071, 1063, - 1, 0, 0, 0, 1071, 1072, 1, 0, 0, 0, 1072, 1073, 1, 0, 0, 0, 1073, 1100, - 5, 4, 0, 0, 1074, 1075, 3, 182, 91, 0, 1075, 1076, 5, 2, 0, 0, 1076, 1078, - 1, 0, 0, 0, 1077, 1074, 1, 0, 0, 0, 1077, 1078, 1, 0, 0, 0, 1078, 1079, - 1, 0, 0, 0, 1079, 1100, 3, 184, 92, 0, 1080, 1081, 3, 182, 91, 0, 1081, - 1082, 5, 2, 0, 0, 1082, 1084, 1, 0, 0, 0, 1083, 1080, 1, 0, 0, 0, 1083, - 1084, 1, 0, 0, 0, 1084, 1085, 1, 0, 0, 0, 1085, 1086, 3, 226, 113, 0, 1086, - 1095, 5, 3, 0, 0, 1087, 1092, 3, 68, 34, 0, 1088, 1089, 5, 5, 0, 0, 1089, - 1091, 3, 68, 34, 0, 1090, 1088, 1, 0, 0, 0, 1091, 1094, 1, 0, 0, 0, 1092, - 1090, 1, 0, 0, 0, 1092, 1093, 1, 0, 0, 0, 1093, 1096, 1, 0, 0, 0, 1094, - 1092, 1, 0, 0, 0, 1095, 1087, 1, 0, 0, 0, 1095, 1096, 1, 0, 0, 0, 1096, - 1097, 1, 0, 0, 0, 1097, 1098, 5, 4, 0, 0, 1098, 1100, 1, 0, 0, 0, 1099, - 1061, 1, 0, 0, 0, 1099, 1077, 1, 0, 0, 0, 1099, 1083, 1, 0, 0, 0, 1100, - 1122, 1, 0, 0, 0, 1101, 1102, 10, 7, 0, 0, 1102, 1103, 5, 45, 0, 0, 1103, - 1122, 3, 192, 96, 0, 1104, 1106, 10, 6, 0, 0, 1105, 1107, 5, 102, 0, 0, - 1106, 1105, 1, 0, 0, 0, 1106, 1107, 1, 0, 0, 0, 1107, 1108, 1, 0, 0, 0, - 1108, 1109, 7, 13, 0, 0, 1109, 1112, 3, 68, 34, 0, 1110, 1111, 5, 67, 0, - 0, 1111, 1113, 3, 68, 34, 0, 1112, 1110, 1, 0, 0, 0, 1112, 1113, 1, 0, - 0, 0, 1113, 1122, 1, 0, 0, 0, 1114, 1119, 10, 5, 0, 0, 1115, 1120, 5, 93, - 0, 0, 1116, 1120, 5, 103, 0, 0, 1117, 1118, 5, 102, 0, 0, 1118, 1120, 5, - 104, 0, 0, 1119, 1115, 1, 0, 0, 0, 1119, 1116, 1, 0, 0, 0, 1119, 1117, - 1, 0, 0, 0, 1120, 1122, 1, 0, 0, 0, 1121, 1007, 1, 0, 0, 0, 1121, 1010, - 1, 0, 0, 0, 1121, 1013, 1, 0, 0, 0, 1121, 1016, 1, 0, 0, 0, 1121, 1019, - 1, 0, 0, 0, 1121, 1022, 1, 0, 0, 0, 1121, 1041, 1, 0, 0, 0, 1121, 1044, - 1, 0, 0, 0, 1121, 1047, 1, 0, 0, 0, 1121, 1056, 1, 0, 0, 0, 1121, 1101, - 1, 0, 0, 0, 1121, 1104, 1, 0, 0, 0, 1121, 1114, 1, 0, 0, 0, 1122, 1125, - 1, 0, 0, 0, 1123, 1121, 1, 0, 0, 0, 1123, 1124, 1, 0, 0, 0, 1124, 69, 1, - 0, 0, 0, 1125, 1123, 1, 0, 0, 0, 1126, 1127, 5, 115, 0, 0, 1127, 1132, - 5, 3, 0, 0, 1128, 1133, 5, 81, 0, 0, 1129, 1130, 7, 14, 0, 0, 1130, 1131, - 5, 5, 0, 0, 1131, 1133, 3, 168, 84, 0, 1132, 1128, 1, 0, 0, 0, 1132, 1129, - 1, 0, 0, 0, 1133, 1134, 1, 0, 0, 0, 1134, 1135, 5, 4, 0, 0, 1135, 71, 1, - 0, 0, 0, 1136, 1137, 7, 15, 0, 0, 1137, 73, 1, 0, 0, 0, 1138, 1140, 3, - 50, 25, 0, 1139, 1138, 1, 0, 0, 0, 1139, 1140, 1, 0, 0, 0, 1140, 1146, - 1, 0, 0, 0, 1141, 1147, 5, 88, 0, 0, 1142, 1147, 5, 122, 0, 0, 1143, 1144, - 5, 88, 0, 0, 1144, 1145, 5, 108, 0, 0, 1145, 1147, 7, 8, 0, 0, 1146, 1141, - 1, 0, 0, 0, 1146, 1142, 1, 0, 0, 0, 1146, 1143, 1, 0, 0, 0, 1147, 1148, - 1, 0, 0, 0, 1148, 1152, 5, 91, 0, 0, 1149, 1150, 3, 182, 91, 0, 1150, 1151, - 5, 2, 0, 0, 1151, 1153, 1, 0, 0, 0, 1152, 1149, 1, 0, 0, 0, 1152, 1153, - 1, 0, 0, 0, 1153, 1154, 1, 0, 0, 0, 1154, 1157, 3, 184, 92, 0, 1155, 1156, - 5, 33, 0, 0, 1156, 1158, 3, 208, 104, 0, 1157, 1155, 1, 0, 0, 0, 1157, - 1158, 1, 0, 0, 0, 1158, 1170, 1, 0, 0, 0, 1159, 1160, 5, 3, 0, 0, 1160, - 1165, 3, 190, 95, 0, 1161, 1162, 5, 5, 0, 0, 1162, 1164, 3, 190, 95, 0, - 1163, 1161, 1, 0, 0, 0, 1164, 1167, 1, 0, 0, 0, 1165, 1163, 1, 0, 0, 0, - 1165, 1166, 1, 0, 0, 0, 1166, 1168, 1, 0, 0, 0, 1167, 1165, 1, 0, 0, 0, - 1168, 1169, 5, 4, 0, 0, 1169, 1171, 1, 0, 0, 0, 1170, 1159, 1, 0, 0, 0, - 1170, 1171, 1, 0, 0, 0, 1171, 1201, 1, 0, 0, 0, 1172, 1173, 5, 145, 0, - 0, 1173, 1174, 5, 3, 0, 0, 1174, 1179, 3, 68, 34, 0, 1175, 1176, 5, 5, - 0, 0, 1176, 1178, 3, 68, 34, 0, 1177, 1175, 1, 0, 0, 0, 1178, 1181, 1, - 0, 0, 0, 1179, 1177, 1, 0, 0, 0, 1179, 1180, 1, 0, 0, 0, 1180, 1182, 1, - 0, 0, 0, 1181, 1179, 1, 0, 0, 0, 1182, 1197, 5, 4, 0, 0, 1183, 1184, 5, - 5, 0, 0, 1184, 1185, 5, 3, 0, 0, 1185, 1190, 3, 68, 34, 0, 1186, 1187, - 5, 5, 0, 0, 1187, 1189, 3, 68, 34, 0, 1188, 1186, 1, 0, 0, 0, 1189, 1192, - 1, 0, 0, 0, 1190, 1188, 1, 0, 0, 0, 1190, 1191, 1, 0, 0, 0, 1191, 1193, - 1, 0, 0, 0, 1192, 1190, 1, 0, 0, 0, 1193, 1194, 5, 4, 0, 0, 1194, 1196, - 1, 0, 0, 0, 1195, 1183, 1, 0, 0, 0, 1196, 1199, 1, 0, 0, 0, 1197, 1195, - 1, 0, 0, 0, 1197, 1198, 1, 0, 0, 0, 1198, 1202, 1, 0, 0, 0, 1199, 1197, - 1, 0, 0, 0, 1200, 1202, 3, 84, 42, 0, 1201, 1172, 1, 0, 0, 0, 1201, 1200, - 1, 0, 0, 0, 1202, 1204, 1, 0, 0, 0, 1203, 1205, 3, 76, 38, 0, 1204, 1203, - 1, 0, 0, 0, 1204, 1205, 1, 0, 0, 0, 1205, 1207, 1, 0, 0, 0, 1206, 1208, - 3, 58, 29, 0, 1207, 1206, 1, 0, 0, 0, 1207, 1208, 1, 0, 0, 0, 1208, 1212, - 1, 0, 0, 0, 1209, 1210, 5, 56, 0, 0, 1210, 1212, 5, 145, 0, 0, 1211, 1139, - 1, 0, 0, 0, 1211, 1209, 1, 0, 0, 0, 1212, 75, 1, 0, 0, 0, 1213, 1214, 5, - 107, 0, 0, 1214, 1229, 5, 48, 0, 0, 1215, 1216, 5, 3, 0, 0, 1216, 1221, - 3, 24, 12, 0, 1217, 1218, 5, 5, 0, 0, 1218, 1220, 3, 24, 12, 0, 1219, 1217, - 1, 0, 0, 0, 1220, 1223, 1, 0, 0, 0, 1221, 1219, 1, 0, 0, 0, 1221, 1222, - 1, 0, 0, 0, 1222, 1224, 1, 0, 0, 0, 1223, 1221, 1, 0, 0, 0, 1224, 1227, - 5, 4, 0, 0, 1225, 1226, 5, 149, 0, 0, 1226, 1228, 3, 68, 34, 0, 1227, 1225, - 1, 0, 0, 0, 1227, 1228, 1, 0, 0, 0, 1228, 1230, 1, 0, 0, 0, 1229, 1215, - 1, 0, 0, 0, 1229, 1230, 1, 0, 0, 0, 1230, 1231, 1, 0, 0, 0, 1231, 1258, - 5, 184, 0, 0, 1232, 1259, 5, 185, 0, 0, 1233, 1234, 5, 142, 0, 0, 1234, - 1237, 5, 131, 0, 0, 1235, 1238, 3, 190, 95, 0, 1236, 1238, 3, 108, 54, - 0, 1237, 1235, 1, 0, 0, 0, 1237, 1236, 1, 0, 0, 0, 1238, 1239, 1, 0, 0, - 0, 1239, 1240, 5, 6, 0, 0, 1240, 1251, 3, 68, 34, 0, 1241, 1244, 5, 5, - 0, 0, 1242, 1245, 3, 190, 95, 0, 1243, 1245, 3, 108, 54, 0, 1244, 1242, - 1, 0, 0, 0, 1244, 1243, 1, 0, 0, 0, 1245, 1246, 1, 0, 0, 0, 1246, 1247, - 5, 6, 0, 0, 1247, 1248, 3, 68, 34, 0, 1248, 1250, 1, 0, 0, 0, 1249, 1241, - 1, 0, 0, 0, 1250, 1253, 1, 0, 0, 0, 1251, 1249, 1, 0, 0, 0, 1251, 1252, - 1, 0, 0, 0, 1252, 1256, 1, 0, 0, 0, 1253, 1251, 1, 0, 0, 0, 1254, 1255, - 5, 149, 0, 0, 1255, 1257, 3, 68, 34, 0, 1256, 1254, 1, 0, 0, 0, 1256, 1257, - 1, 0, 0, 0, 1257, 1259, 1, 0, 0, 0, 1258, 1232, 1, 0, 0, 0, 1258, 1233, - 1, 0, 0, 0, 1259, 77, 1, 0, 0, 0, 1260, 1264, 5, 112, 0, 0, 1261, 1262, - 3, 182, 91, 0, 1262, 1263, 5, 2, 0, 0, 1263, 1265, 1, 0, 0, 0, 1264, 1261, - 1, 0, 0, 0, 1264, 1265, 1, 0, 0, 0, 1265, 1266, 1, 0, 0, 0, 1266, 1273, - 3, 204, 102, 0, 1267, 1268, 5, 6, 0, 0, 1268, 1274, 3, 80, 40, 0, 1269, - 1270, 5, 3, 0, 0, 1270, 1271, 3, 80, 40, 0, 1271, 1272, 5, 4, 0, 0, 1272, - 1274, 1, 0, 0, 0, 1273, 1267, 1, 0, 0, 0, 1273, 1269, 1, 0, 0, 0, 1273, - 1274, 1, 0, 0, 0, 1274, 79, 1, 0, 0, 0, 1275, 1279, 3, 36, 18, 0, 1276, - 1279, 3, 176, 88, 0, 1277, 1279, 5, 190, 0, 0, 1278, 1275, 1, 0, 0, 0, - 1278, 1276, 1, 0, 0, 0, 1278, 1277, 1, 0, 0, 0, 1279, 81, 1, 0, 0, 0, 1280, - 1291, 5, 119, 0, 0, 1281, 1292, 3, 192, 96, 0, 1282, 1283, 3, 182, 91, - 0, 1283, 1284, 5, 2, 0, 0, 1284, 1286, 1, 0, 0, 0, 1285, 1282, 1, 0, 0, - 0, 1285, 1286, 1, 0, 0, 0, 1286, 1289, 1, 0, 0, 0, 1287, 1290, 3, 184, - 92, 0, 1288, 1290, 3, 196, 98, 0, 1289, 1287, 1, 0, 0, 0, 1289, 1288, 1, - 0, 0, 0, 1290, 1292, 1, 0, 0, 0, 1291, 1281, 1, 0, 0, 0, 1291, 1285, 1, - 0, 0, 0, 1291, 1292, 1, 0, 0, 0, 1292, 83, 1, 0, 0, 0, 1293, 1295, 3, 132, - 66, 0, 1294, 1293, 1, 0, 0, 0, 1294, 1295, 1, 0, 0, 0, 1295, 1296, 1, 0, - 0, 0, 1296, 1302, 3, 88, 44, 0, 1297, 1298, 3, 104, 52, 0, 1298, 1299, - 3, 88, 44, 0, 1299, 1301, 1, 0, 0, 0, 1300, 1297, 1, 0, 0, 0, 1301, 1304, - 1, 0, 0, 0, 1302, 1300, 1, 0, 0, 0, 1302, 1303, 1, 0, 0, 0, 1303, 1306, - 1, 0, 0, 0, 1304, 1302, 1, 0, 0, 0, 1305, 1307, 3, 134, 67, 0, 1306, 1305, - 1, 0, 0, 0, 1306, 1307, 1, 0, 0, 0, 1307, 1309, 1, 0, 0, 0, 1308, 1310, - 3, 136, 68, 0, 1309, 1308, 1, 0, 0, 0, 1309, 1310, 1, 0, 0, 0, 1310, 85, - 1, 0, 0, 0, 1311, 1318, 3, 96, 48, 0, 1312, 1313, 3, 100, 50, 0, 1313, - 1314, 3, 96, 48, 0, 1314, 1315, 3, 102, 51, 0, 1315, 1317, 1, 0, 0, 0, - 1316, 1312, 1, 0, 0, 0, 1317, 1320, 1, 0, 0, 0, 1318, 1316, 1, 0, 0, 0, - 1318, 1319, 1, 0, 0, 0, 1319, 87, 1, 0, 0, 0, 1320, 1318, 1, 0, 0, 0, 1321, - 1323, 5, 130, 0, 0, 1322, 1324, 7, 16, 0, 0, 1323, 1322, 1, 0, 0, 0, 1323, - 1324, 1, 0, 0, 0, 1324, 1325, 1, 0, 0, 0, 1325, 1330, 3, 98, 49, 0, 1326, - 1327, 5, 5, 0, 0, 1327, 1329, 3, 98, 49, 0, 1328, 1326, 1, 0, 0, 0, 1329, - 1332, 1, 0, 0, 0, 1330, 1328, 1, 0, 0, 0, 1330, 1331, 1, 0, 0, 0, 1331, - 1345, 1, 0, 0, 0, 1332, 1330, 1, 0, 0, 0, 1333, 1343, 5, 75, 0, 0, 1334, - 1339, 3, 96, 48, 0, 1335, 1336, 5, 5, 0, 0, 1336, 1338, 3, 96, 48, 0, 1337, - 1335, 1, 0, 0, 0, 1338, 1341, 1, 0, 0, 0, 1339, 1337, 1, 0, 0, 0, 1339, - 1340, 1, 0, 0, 0, 1340, 1344, 1, 0, 0, 0, 1341, 1339, 1, 0, 0, 0, 1342, - 1344, 3, 86, 43, 0, 1343, 1334, 1, 0, 0, 0, 1343, 1342, 1, 0, 0, 0, 1344, - 1346, 1, 0, 0, 0, 1345, 1333, 1, 0, 0, 0, 1345, 1346, 1, 0, 0, 0, 1346, - 1349, 1, 0, 0, 0, 1347, 1348, 5, 149, 0, 0, 1348, 1350, 3, 68, 34, 0, 1349, - 1347, 1, 0, 0, 0, 1349, 1350, 1, 0, 0, 0, 1350, 1365, 1, 0, 0, 0, 1351, - 1352, 5, 78, 0, 0, 1352, 1353, 5, 40, 0, 0, 1353, 1358, 3, 68, 34, 0, 1354, - 1355, 5, 5, 0, 0, 1355, 1357, 3, 68, 34, 0, 1356, 1354, 1, 0, 0, 0, 1357, - 1360, 1, 0, 0, 0, 1358, 1356, 1, 0, 0, 0, 1358, 1359, 1, 0, 0, 0, 1359, - 1363, 1, 0, 0, 0, 1360, 1358, 1, 0, 0, 0, 1361, 1362, 5, 79, 0, 0, 1362, - 1364, 3, 68, 34, 0, 1363, 1361, 1, 0, 0, 0, 1363, 1364, 1, 0, 0, 0, 1364, - 1366, 1, 0, 0, 0, 1365, 1351, 1, 0, 0, 0, 1365, 1366, 1, 0, 0, 0, 1366, - 1381, 1, 0, 0, 0, 1367, 1368, 5, 175, 0, 0, 1368, 1369, 3, 214, 107, 0, - 1369, 1370, 5, 33, 0, 0, 1370, 1378, 3, 118, 59, 0, 1371, 1372, 5, 5, 0, - 0, 1372, 1373, 3, 214, 107, 0, 1373, 1374, 5, 33, 0, 0, 1374, 1375, 3, - 118, 59, 0, 1375, 1377, 1, 0, 0, 0, 1376, 1371, 1, 0, 0, 0, 1377, 1380, - 1, 0, 0, 0, 1378, 1376, 1, 0, 0, 0, 1378, 1379, 1, 0, 0, 0, 1379, 1382, - 1, 0, 0, 0, 1380, 1378, 1, 0, 0, 0, 1381, 1367, 1, 0, 0, 0, 1381, 1382, - 1, 0, 0, 0, 1382, 1412, 1, 0, 0, 0, 1383, 1384, 5, 145, 0, 0, 1384, 1385, - 5, 3, 0, 0, 1385, 1390, 3, 68, 34, 0, 1386, 1387, 5, 5, 0, 0, 1387, 1389, - 3, 68, 34, 0, 1388, 1386, 1, 0, 0, 0, 1389, 1392, 1, 0, 0, 0, 1390, 1388, - 1, 0, 0, 0, 1390, 1391, 1, 0, 0, 0, 1391, 1393, 1, 0, 0, 0, 1392, 1390, - 1, 0, 0, 0, 1393, 1408, 5, 4, 0, 0, 1394, 1395, 5, 5, 0, 0, 1395, 1396, - 5, 3, 0, 0, 1396, 1401, 3, 68, 34, 0, 1397, 1398, 5, 5, 0, 0, 1398, 1400, - 3, 68, 34, 0, 1399, 1397, 1, 0, 0, 0, 1400, 1403, 1, 0, 0, 0, 1401, 1399, - 1, 0, 0, 0, 1401, 1402, 1, 0, 0, 0, 1402, 1404, 1, 0, 0, 0, 1403, 1401, - 1, 0, 0, 0, 1404, 1405, 5, 4, 0, 0, 1405, 1407, 1, 0, 0, 0, 1406, 1394, - 1, 0, 0, 0, 1407, 1410, 1, 0, 0, 0, 1408, 1406, 1, 0, 0, 0, 1408, 1409, - 1, 0, 0, 0, 1409, 1412, 1, 0, 0, 0, 1410, 1408, 1, 0, 0, 0, 1411, 1321, - 1, 0, 0, 0, 1411, 1383, 1, 0, 0, 0, 1412, 89, 1, 0, 0, 0, 1413, 1414, 3, - 84, 42, 0, 1414, 91, 1, 0, 0, 0, 1415, 1417, 3, 132, 66, 0, 1416, 1415, - 1, 0, 0, 0, 1416, 1417, 1, 0, 0, 0, 1417, 1418, 1, 0, 0, 0, 1418, 1420, - 3, 88, 44, 0, 1419, 1421, 3, 134, 67, 0, 1420, 1419, 1, 0, 0, 0, 1420, - 1421, 1, 0, 0, 0, 1421, 1423, 1, 0, 0, 0, 1422, 1424, 3, 136, 68, 0, 1423, - 1422, 1, 0, 0, 0, 1423, 1424, 1, 0, 0, 0, 1424, 93, 1, 0, 0, 0, 1425, 1427, - 3, 132, 66, 0, 1426, 1425, 1, 0, 0, 0, 1426, 1427, 1, 0, 0, 0, 1427, 1428, - 1, 0, 0, 0, 1428, 1438, 3, 88, 44, 0, 1429, 1431, 5, 140, 0, 0, 1430, 1432, - 5, 29, 0, 0, 1431, 1430, 1, 0, 0, 0, 1431, 1432, 1, 0, 0, 0, 1432, 1436, - 1, 0, 0, 0, 1433, 1436, 5, 90, 0, 0, 1434, 1436, 5, 68, 0, 0, 1435, 1429, - 1, 0, 0, 0, 1435, 1433, 1, 0, 0, 0, 1435, 1434, 1, 0, 0, 0, 1436, 1437, - 1, 0, 0, 0, 1437, 1439, 3, 88, 44, 0, 1438, 1435, 1, 0, 0, 0, 1439, 1440, - 1, 0, 0, 0, 1440, 1438, 1, 0, 0, 0, 1440, 1441, 1, 0, 0, 0, 1441, 1443, - 1, 0, 0, 0, 1442, 1444, 3, 134, 67, 0, 1443, 1442, 1, 0, 0, 0, 1443, 1444, - 1, 0, 0, 0, 1444, 1446, 1, 0, 0, 0, 1445, 1447, 3, 136, 68, 0, 1446, 1445, - 1, 0, 0, 0, 1446, 1447, 1, 0, 0, 0, 1447, 95, 1, 0, 0, 0, 1448, 1449, 3, - 182, 91, 0, 1449, 1450, 5, 2, 0, 0, 1450, 1452, 1, 0, 0, 0, 1451, 1448, - 1, 0, 0, 0, 1451, 1452, 1, 0, 0, 0, 1452, 1453, 1, 0, 0, 0, 1453, 1458, - 3, 184, 92, 0, 1454, 1456, 5, 33, 0, 0, 1455, 1454, 1, 0, 0, 0, 1455, 1456, - 1, 0, 0, 0, 1456, 1457, 1, 0, 0, 0, 1457, 1459, 3, 208, 104, 0, 1458, 1455, - 1, 0, 0, 0, 1458, 1459, 1, 0, 0, 0, 1459, 1465, 1, 0, 0, 0, 1460, 1461, - 5, 85, 0, 0, 1461, 1462, 5, 40, 0, 0, 1462, 1466, 3, 196, 98, 0, 1463, - 1464, 5, 102, 0, 0, 1464, 1466, 5, 85, 0, 0, 1465, 1460, 1, 0, 0, 0, 1465, - 1463, 1, 0, 0, 0, 1465, 1466, 1, 0, 0, 0, 1466, 1577, 1, 0, 0, 0, 1467, - 1468, 3, 182, 91, 0, 1468, 1469, 5, 2, 0, 0, 1469, 1471, 1, 0, 0, 0, 1470, - 1467, 1, 0, 0, 0, 1470, 1471, 1, 0, 0, 0, 1471, 1472, 1, 0, 0, 0, 1472, - 1473, 3, 226, 113, 0, 1473, 1474, 5, 3, 0, 0, 1474, 1479, 3, 68, 34, 0, - 1475, 1476, 5, 5, 0, 0, 1476, 1478, 3, 68, 34, 0, 1477, 1475, 1, 0, 0, - 0, 1478, 1481, 1, 0, 0, 0, 1479, 1477, 1, 0, 0, 0, 1479, 1480, 1, 0, 0, - 0, 1480, 1482, 1, 0, 0, 0, 1481, 1479, 1, 0, 0, 0, 1482, 1487, 5, 4, 0, - 0, 1483, 1485, 5, 33, 0, 0, 1484, 1483, 1, 0, 0, 0, 1484, 1485, 1, 0, 0, - 0, 1485, 1486, 1, 0, 0, 0, 1486, 1488, 3, 208, 104, 0, 1487, 1484, 1, 0, - 0, 0, 1487, 1488, 1, 0, 0, 0, 1488, 1577, 1, 0, 0, 0, 1489, 1499, 5, 3, - 0, 0, 1490, 1495, 3, 96, 48, 0, 1491, 1492, 5, 5, 0, 0, 1492, 1494, 3, - 96, 48, 0, 1493, 1491, 1, 0, 0, 0, 1494, 1497, 1, 0, 0, 0, 1495, 1493, - 1, 0, 0, 0, 1495, 1496, 1, 0, 0, 0, 1496, 1500, 1, 0, 0, 0, 1497, 1495, - 1, 0, 0, 0, 1498, 1500, 3, 86, 43, 0, 1499, 1490, 1, 0, 0, 0, 1499, 1498, - 1, 0, 0, 0, 1500, 1501, 1, 0, 0, 0, 1501, 1502, 5, 4, 0, 0, 1502, 1577, - 1, 0, 0, 0, 1503, 1504, 5, 3, 0, 0, 1504, 1505, 3, 84, 42, 0, 1505, 1510, - 5, 4, 0, 0, 1506, 1508, 5, 33, 0, 0, 1507, 1506, 1, 0, 0, 0, 1507, 1508, - 1, 0, 0, 0, 1508, 1509, 1, 0, 0, 0, 1509, 1511, 3, 208, 104, 0, 1510, 1507, - 1, 0, 0, 0, 1510, 1511, 1, 0, 0, 0, 1511, 1577, 1, 0, 0, 0, 1512, 1513, - 3, 182, 91, 0, 1513, 1514, 5, 2, 0, 0, 1514, 1516, 1, 0, 0, 0, 1515, 1512, - 1, 0, 0, 0, 1515, 1516, 1, 0, 0, 0, 1516, 1517, 1, 0, 0, 0, 1517, 1522, - 3, 184, 92, 0, 1518, 1520, 5, 33, 0, 0, 1519, 1518, 1, 0, 0, 0, 1519, 1520, - 1, 0, 0, 0, 1520, 1521, 1, 0, 0, 0, 1521, 1523, 3, 210, 105, 0, 1522, 1519, - 1, 0, 0, 0, 1522, 1523, 1, 0, 0, 0, 1523, 1529, 1, 0, 0, 0, 1524, 1525, - 5, 85, 0, 0, 1525, 1526, 5, 40, 0, 0, 1526, 1530, 3, 196, 98, 0, 1527, - 1528, 5, 102, 0, 0, 1528, 1530, 5, 85, 0, 0, 1529, 1524, 1, 0, 0, 0, 1529, - 1527, 1, 0, 0, 0, 1529, 1530, 1, 0, 0, 0, 1530, 1577, 1, 0, 0, 0, 1531, - 1532, 3, 182, 91, 0, 1532, 1533, 5, 2, 0, 0, 1533, 1535, 1, 0, 0, 0, 1534, - 1531, 1, 0, 0, 0, 1534, 1535, 1, 0, 0, 0, 1535, 1536, 1, 0, 0, 0, 1536, - 1537, 3, 226, 113, 0, 1537, 1538, 5, 3, 0, 0, 1538, 1543, 3, 68, 34, 0, - 1539, 1540, 5, 5, 0, 0, 1540, 1542, 3, 68, 34, 0, 1541, 1539, 1, 0, 0, - 0, 1542, 1545, 1, 0, 0, 0, 1543, 1541, 1, 0, 0, 0, 1543, 1544, 1, 0, 0, - 0, 1544, 1546, 1, 0, 0, 0, 1545, 1543, 1, 0, 0, 0, 1546, 1551, 5, 4, 0, - 0, 1547, 1549, 5, 33, 0, 0, 1548, 1547, 1, 0, 0, 0, 1548, 1549, 1, 0, 0, - 0, 1549, 1550, 1, 0, 0, 0, 1550, 1552, 3, 210, 105, 0, 1551, 1548, 1, 0, - 0, 0, 1551, 1552, 1, 0, 0, 0, 1552, 1577, 1, 0, 0, 0, 1553, 1563, 5, 3, - 0, 0, 1554, 1559, 3, 96, 48, 0, 1555, 1556, 5, 5, 0, 0, 1556, 1558, 3, - 96, 48, 0, 1557, 1555, 1, 0, 0, 0, 1558, 1561, 1, 0, 0, 0, 1559, 1557, - 1, 0, 0, 0, 1559, 1560, 1, 0, 0, 0, 1560, 1564, 1, 0, 0, 0, 1561, 1559, - 1, 0, 0, 0, 1562, 1564, 3, 86, 43, 0, 1563, 1554, 1, 0, 0, 0, 1563, 1562, - 1, 0, 0, 0, 1564, 1565, 1, 0, 0, 0, 1565, 1566, 5, 4, 0, 0, 1566, 1577, - 1, 0, 0, 0, 1567, 1568, 5, 3, 0, 0, 1568, 1569, 3, 84, 42, 0, 1569, 1574, - 5, 4, 0, 0, 1570, 1572, 5, 33, 0, 0, 1571, 1570, 1, 0, 0, 0, 1571, 1572, - 1, 0, 0, 0, 1572, 1573, 1, 0, 0, 0, 1573, 1575, 3, 210, 105, 0, 1574, 1571, - 1, 0, 0, 0, 1574, 1575, 1, 0, 0, 0, 1575, 1577, 1, 0, 0, 0, 1576, 1451, - 1, 0, 0, 0, 1576, 1470, 1, 0, 0, 0, 1576, 1489, 1, 0, 0, 0, 1576, 1503, - 1, 0, 0, 0, 1576, 1515, 1, 0, 0, 0, 1576, 1534, 1, 0, 0, 0, 1576, 1553, - 1, 0, 0, 0, 1576, 1567, 1, 0, 0, 0, 1577, 97, 1, 0, 0, 0, 1578, 1591, 5, - 7, 0, 0, 1579, 1580, 3, 184, 92, 0, 1580, 1581, 5, 2, 0, 0, 1581, 1582, - 5, 7, 0, 0, 1582, 1591, 1, 0, 0, 0, 1583, 1588, 3, 68, 34, 0, 1584, 1586, - 5, 33, 0, 0, 1585, 1584, 1, 0, 0, 0, 1585, 1586, 1, 0, 0, 0, 1586, 1587, - 1, 0, 0, 0, 1587, 1589, 3, 172, 86, 0, 1588, 1585, 1, 0, 0, 0, 1588, 1589, - 1, 0, 0, 0, 1589, 1591, 1, 0, 0, 0, 1590, 1578, 1, 0, 0, 0, 1590, 1579, - 1, 0, 0, 0, 1590, 1583, 1, 0, 0, 0, 1591, 99, 1, 0, 0, 0, 1592, 1607, 5, - 5, 0, 0, 1593, 1595, 5, 100, 0, 0, 1594, 1593, 1, 0, 0, 0, 1594, 1595, - 1, 0, 0, 0, 1595, 1601, 1, 0, 0, 0, 1596, 1598, 7, 17, 0, 0, 1597, 1599, - 5, 110, 0, 0, 1598, 1597, 1, 0, 0, 0, 1598, 1599, 1, 0, 0, 0, 1599, 1602, - 1, 0, 0, 0, 1600, 1602, 5, 87, 0, 0, 1601, 1596, 1, 0, 0, 0, 1601, 1600, - 1, 0, 0, 0, 1601, 1602, 1, 0, 0, 0, 1602, 1603, 1, 0, 0, 0, 1603, 1607, - 5, 94, 0, 0, 1604, 1605, 5, 51, 0, 0, 1605, 1607, 5, 94, 0, 0, 1606, 1592, - 1, 0, 0, 0, 1606, 1594, 1, 0, 0, 0, 1606, 1604, 1, 0, 0, 0, 1607, 101, - 1, 0, 0, 0, 1608, 1609, 5, 107, 0, 0, 1609, 1623, 3, 68, 34, 0, 1610, 1611, - 5, 143, 0, 0, 1611, 1612, 5, 3, 0, 0, 1612, 1617, 3, 190, 95, 0, 1613, - 1614, 5, 5, 0, 0, 1614, 1616, 3, 190, 95, 0, 1615, 1613, 1, 0, 0, 0, 1616, - 1619, 1, 0, 0, 0, 1617, 1615, 1, 0, 0, 0, 1617, 1618, 1, 0, 0, 0, 1618, - 1620, 1, 0, 0, 0, 1619, 1617, 1, 0, 0, 0, 1620, 1621, 5, 4, 0, 0, 1621, - 1623, 1, 0, 0, 0, 1622, 1608, 1, 0, 0, 0, 1622, 1610, 1, 0, 0, 0, 1622, - 1623, 1, 0, 0, 0, 1623, 103, 1, 0, 0, 0, 1624, 1626, 5, 140, 0, 0, 1625, - 1627, 5, 29, 0, 0, 1626, 1625, 1, 0, 0, 0, 1626, 1627, 1, 0, 0, 0, 1627, - 1631, 1, 0, 0, 0, 1628, 1631, 5, 90, 0, 0, 1629, 1631, 5, 68, 0, 0, 1630, - 1624, 1, 0, 0, 0, 1630, 1628, 1, 0, 0, 0, 1630, 1629, 1, 0, 0, 0, 1631, - 105, 1, 0, 0, 0, 1632, 1634, 3, 50, 25, 0, 1633, 1632, 1, 0, 0, 0, 1633, - 1634, 1, 0, 0, 0, 1634, 1635, 1, 0, 0, 0, 1635, 1638, 5, 142, 0, 0, 1636, - 1637, 5, 108, 0, 0, 1637, 1639, 7, 8, 0, 0, 1638, 1636, 1, 0, 0, 0, 1638, - 1639, 1, 0, 0, 0, 1639, 1640, 1, 0, 0, 0, 1640, 1641, 3, 112, 56, 0, 1641, - 1644, 5, 131, 0, 0, 1642, 1645, 3, 190, 95, 0, 1643, 1645, 3, 108, 54, - 0, 1644, 1642, 1, 0, 0, 0, 1644, 1643, 1, 0, 0, 0, 1645, 1646, 1, 0, 0, - 0, 1646, 1647, 5, 6, 0, 0, 1647, 1658, 3, 68, 34, 0, 1648, 1651, 5, 5, - 0, 0, 1649, 1652, 3, 190, 95, 0, 1650, 1652, 3, 108, 54, 0, 1651, 1649, - 1, 0, 0, 0, 1651, 1650, 1, 0, 0, 0, 1652, 1653, 1, 0, 0, 0, 1653, 1654, - 5, 6, 0, 0, 1654, 1655, 3, 68, 34, 0, 1655, 1657, 1, 0, 0, 0, 1656, 1648, - 1, 0, 0, 0, 1657, 1660, 1, 0, 0, 0, 1658, 1656, 1, 0, 0, 0, 1658, 1659, - 1, 0, 0, 0, 1659, 1663, 1, 0, 0, 0, 1660, 1658, 1, 0, 0, 0, 1661, 1662, - 5, 149, 0, 0, 1662, 1664, 3, 68, 34, 0, 1663, 1661, 1, 0, 0, 0, 1663, 1664, - 1, 0, 0, 0, 1664, 1666, 1, 0, 0, 0, 1665, 1667, 3, 58, 29, 0, 1666, 1665, - 1, 0, 0, 0, 1666, 1667, 1, 0, 0, 0, 1667, 107, 1, 0, 0, 0, 1668, 1669, - 5, 3, 0, 0, 1669, 1674, 3, 190, 95, 0, 1670, 1671, 5, 5, 0, 0, 1671, 1673, - 3, 190, 95, 0, 1672, 1670, 1, 0, 0, 0, 1673, 1676, 1, 0, 0, 0, 1674, 1672, - 1, 0, 0, 0, 1674, 1675, 1, 0, 0, 0, 1675, 1677, 1, 0, 0, 0, 1676, 1674, - 1, 0, 0, 0, 1677, 1678, 5, 4, 0, 0, 1678, 109, 1, 0, 0, 0, 1679, 1681, - 3, 50, 25, 0, 1680, 1679, 1, 0, 0, 0, 1680, 1681, 1, 0, 0, 0, 1681, 1682, - 1, 0, 0, 0, 1682, 1685, 5, 142, 0, 0, 1683, 1684, 5, 108, 0, 0, 1684, 1686, - 7, 8, 0, 0, 1685, 1683, 1, 0, 0, 0, 1685, 1686, 1, 0, 0, 0, 1686, 1687, - 1, 0, 0, 0, 1687, 1688, 3, 112, 56, 0, 1688, 1691, 5, 131, 0, 0, 1689, - 1692, 3, 190, 95, 0, 1690, 1692, 3, 108, 54, 0, 1691, 1689, 1, 0, 0, 0, - 1691, 1690, 1, 0, 0, 0, 1692, 1693, 1, 0, 0, 0, 1693, 1694, 5, 6, 0, 0, - 1694, 1705, 3, 68, 34, 0, 1695, 1698, 5, 5, 0, 0, 1696, 1699, 3, 190, 95, - 0, 1697, 1699, 3, 108, 54, 0, 1698, 1696, 1, 0, 0, 0, 1698, 1697, 1, 0, - 0, 0, 1699, 1700, 1, 0, 0, 0, 1700, 1701, 5, 6, 0, 0, 1701, 1702, 3, 68, - 34, 0, 1702, 1704, 1, 0, 0, 0, 1703, 1695, 1, 0, 0, 0, 1704, 1707, 1, 0, - 0, 0, 1705, 1703, 1, 0, 0, 0, 1705, 1706, 1, 0, 0, 0, 1706, 1710, 1, 0, - 0, 0, 1707, 1705, 1, 0, 0, 0, 1708, 1709, 5, 149, 0, 0, 1709, 1711, 3, - 68, 34, 0, 1710, 1708, 1, 0, 0, 0, 1710, 1711, 1, 0, 0, 0, 1711, 1716, - 1, 0, 0, 0, 1712, 1714, 3, 134, 67, 0, 1713, 1712, 1, 0, 0, 0, 1713, 1714, - 1, 0, 0, 0, 1714, 1715, 1, 0, 0, 0, 1715, 1717, 3, 136, 68, 0, 1716, 1713, - 1, 0, 0, 0, 1716, 1717, 1, 0, 0, 0, 1717, 111, 1, 0, 0, 0, 1718, 1719, - 3, 182, 91, 0, 1719, 1720, 5, 2, 0, 0, 1720, 1722, 1, 0, 0, 0, 1721, 1718, - 1, 0, 0, 0, 1721, 1722, 1, 0, 0, 0, 1722, 1723, 1, 0, 0, 0, 1723, 1726, - 3, 184, 92, 0, 1724, 1725, 5, 33, 0, 0, 1725, 1727, 3, 216, 108, 0, 1726, - 1724, 1, 0, 0, 0, 1726, 1727, 1, 0, 0, 0, 1727, 1733, 1, 0, 0, 0, 1728, - 1729, 5, 85, 0, 0, 1729, 1730, 5, 40, 0, 0, 1730, 1734, 3, 196, 98, 0, - 1731, 1732, 5, 102, 0, 0, 1732, 1734, 5, 85, 0, 0, 1733, 1728, 1, 0, 0, - 0, 1733, 1731, 1, 0, 0, 0, 1733, 1734, 1, 0, 0, 0, 1734, 113, 1, 0, 0, - 0, 1735, 1737, 5, 144, 0, 0, 1736, 1738, 3, 182, 91, 0, 1737, 1736, 1, - 0, 0, 0, 1737, 1738, 1, 0, 0, 0, 1738, 1741, 1, 0, 0, 0, 1739, 1740, 5, - 91, 0, 0, 1740, 1742, 3, 218, 109, 0, 1741, 1739, 1, 0, 0, 0, 1741, 1742, - 1, 0, 0, 0, 1742, 115, 1, 0, 0, 0, 1743, 1744, 5, 179, 0, 0, 1744, 1745, - 5, 3, 0, 0, 1745, 1746, 5, 149, 0, 0, 1746, 1747, 3, 68, 34, 0, 1747, 1748, - 5, 4, 0, 0, 1748, 117, 1, 0, 0, 0, 1749, 1751, 5, 3, 0, 0, 1750, 1752, - 3, 220, 110, 0, 1751, 1750, 1, 0, 0, 0, 1751, 1752, 1, 0, 0, 0, 1752, 1763, - 1, 0, 0, 0, 1753, 1754, 5, 154, 0, 0, 1754, 1755, 5, 40, 0, 0, 1755, 1760, - 3, 68, 34, 0, 1756, 1757, 5, 5, 0, 0, 1757, 1759, 3, 68, 34, 0, 1758, 1756, - 1, 0, 0, 0, 1759, 1762, 1, 0, 0, 0, 1760, 1758, 1, 0, 0, 0, 1760, 1761, - 1, 0, 0, 0, 1761, 1764, 1, 0, 0, 0, 1762, 1760, 1, 0, 0, 0, 1763, 1753, - 1, 0, 0, 0, 1763, 1764, 1, 0, 0, 0, 1764, 1765, 1, 0, 0, 0, 1765, 1766, - 5, 109, 0, 0, 1766, 1767, 5, 40, 0, 0, 1767, 1772, 3, 138, 69, 0, 1768, - 1769, 5, 5, 0, 0, 1769, 1771, 3, 138, 69, 0, 1770, 1768, 1, 0, 0, 0, 1771, - 1774, 1, 0, 0, 0, 1772, 1770, 1, 0, 0, 0, 1772, 1773, 1, 0, 0, 0, 1773, - 1776, 1, 0, 0, 0, 1774, 1772, 1, 0, 0, 0, 1775, 1777, 3, 122, 61, 0, 1776, - 1775, 1, 0, 0, 0, 1776, 1777, 1, 0, 0, 0, 1777, 1778, 1, 0, 0, 0, 1778, - 1779, 5, 4, 0, 0, 1779, 119, 1, 0, 0, 0, 1780, 1814, 5, 153, 0, 0, 1781, - 1815, 3, 214, 107, 0, 1782, 1784, 5, 3, 0, 0, 1783, 1785, 3, 220, 110, - 0, 1784, 1783, 1, 0, 0, 0, 1784, 1785, 1, 0, 0, 0, 1785, 1796, 1, 0, 0, - 0, 1786, 1787, 5, 154, 0, 0, 1787, 1788, 5, 40, 0, 0, 1788, 1793, 3, 68, - 34, 0, 1789, 1790, 5, 5, 0, 0, 1790, 1792, 3, 68, 34, 0, 1791, 1789, 1, - 0, 0, 0, 1792, 1795, 1, 0, 0, 0, 1793, 1791, 1, 0, 0, 0, 1793, 1794, 1, - 0, 0, 0, 1794, 1797, 1, 0, 0, 0, 1795, 1793, 1, 0, 0, 0, 1796, 1786, 1, - 0, 0, 0, 1796, 1797, 1, 0, 0, 0, 1797, 1808, 1, 0, 0, 0, 1798, 1799, 5, - 109, 0, 0, 1799, 1800, 5, 40, 0, 0, 1800, 1805, 3, 138, 69, 0, 1801, 1802, - 5, 5, 0, 0, 1802, 1804, 3, 138, 69, 0, 1803, 1801, 1, 0, 0, 0, 1804, 1807, - 1, 0, 0, 0, 1805, 1803, 1, 0, 0, 0, 1805, 1806, 1, 0, 0, 0, 1806, 1809, - 1, 0, 0, 0, 1807, 1805, 1, 0, 0, 0, 1808, 1798, 1, 0, 0, 0, 1808, 1809, - 1, 0, 0, 0, 1809, 1811, 1, 0, 0, 0, 1810, 1812, 3, 122, 61, 0, 1811, 1810, - 1, 0, 0, 0, 1811, 1812, 1, 0, 0, 0, 1812, 1813, 1, 0, 0, 0, 1813, 1815, - 5, 4, 0, 0, 1814, 1781, 1, 0, 0, 0, 1814, 1782, 1, 0, 0, 0, 1815, 121, - 1, 0, 0, 0, 1816, 1824, 3, 124, 62, 0, 1817, 1818, 5, 181, 0, 0, 1818, - 1819, 5, 101, 0, 0, 1819, 1825, 5, 183, 0, 0, 1820, 1821, 5, 158, 0, 0, - 1821, 1825, 5, 127, 0, 0, 1822, 1825, 5, 78, 0, 0, 1823, 1825, 5, 182, - 0, 0, 1824, 1817, 1, 0, 0, 0, 1824, 1820, 1, 0, 0, 0, 1824, 1822, 1, 0, - 0, 0, 1824, 1823, 1, 0, 0, 0, 1824, 1825, 1, 0, 0, 0, 1825, 123, 1, 0, - 0, 0, 1826, 1833, 7, 18, 0, 0, 1827, 1834, 3, 146, 73, 0, 1828, 1829, 5, - 39, 0, 0, 1829, 1830, 3, 142, 71, 0, 1830, 1831, 5, 32, 0, 0, 1831, 1832, - 3, 144, 72, 0, 1832, 1834, 1, 0, 0, 0, 1833, 1827, 1, 0, 0, 0, 1833, 1828, - 1, 0, 0, 0, 1834, 125, 1, 0, 0, 0, 1835, 1836, 3, 222, 111, 0, 1836, 1846, - 5, 3, 0, 0, 1837, 1842, 3, 68, 34, 0, 1838, 1839, 5, 5, 0, 0, 1839, 1841, - 3, 68, 34, 0, 1840, 1838, 1, 0, 0, 0, 1841, 1844, 1, 0, 0, 0, 1842, 1840, - 1, 0, 0, 0, 1842, 1843, 1, 0, 0, 0, 1843, 1847, 1, 0, 0, 0, 1844, 1842, - 1, 0, 0, 0, 1845, 1847, 5, 7, 0, 0, 1846, 1837, 1, 0, 0, 0, 1846, 1845, - 1, 0, 0, 0, 1847, 1848, 1, 0, 0, 0, 1848, 1849, 5, 4, 0, 0, 1849, 127, - 1, 0, 0, 0, 1850, 1851, 3, 224, 112, 0, 1851, 1864, 5, 3, 0, 0, 1852, 1854, - 5, 62, 0, 0, 1853, 1852, 1, 0, 0, 0, 1853, 1854, 1, 0, 0, 0, 1854, 1855, - 1, 0, 0, 0, 1855, 1860, 3, 68, 34, 0, 1856, 1857, 5, 5, 0, 0, 1857, 1859, - 3, 68, 34, 0, 1858, 1856, 1, 0, 0, 0, 1859, 1862, 1, 0, 0, 0, 1860, 1858, - 1, 0, 0, 0, 1860, 1861, 1, 0, 0, 0, 1861, 1865, 1, 0, 0, 0, 1862, 1860, - 1, 0, 0, 0, 1863, 1865, 5, 7, 0, 0, 1864, 1853, 1, 0, 0, 0, 1864, 1863, - 1, 0, 0, 0, 1864, 1865, 1, 0, 0, 0, 1865, 1866, 1, 0, 0, 0, 1866, 1868, - 5, 4, 0, 0, 1867, 1869, 3, 116, 58, 0, 1868, 1867, 1, 0, 0, 0, 1868, 1869, - 1, 0, 0, 0, 1869, 129, 1, 0, 0, 0, 1870, 1871, 3, 148, 74, 0, 1871, 1881, - 5, 3, 0, 0, 1872, 1877, 3, 68, 34, 0, 1873, 1874, 5, 5, 0, 0, 1874, 1876, - 3, 68, 34, 0, 1875, 1873, 1, 0, 0, 0, 1876, 1879, 1, 0, 0, 0, 1877, 1875, - 1, 0, 0, 0, 1877, 1878, 1, 0, 0, 0, 1878, 1882, 1, 0, 0, 0, 1879, 1877, - 1, 0, 0, 0, 1880, 1882, 5, 7, 0, 0, 1881, 1872, 1, 0, 0, 0, 1881, 1880, - 1, 0, 0, 0, 1881, 1882, 1, 0, 0, 0, 1882, 1883, 1, 0, 0, 0, 1883, 1885, - 5, 4, 0, 0, 1884, 1886, 3, 116, 58, 0, 1885, 1884, 1, 0, 0, 0, 1885, 1886, - 1, 0, 0, 0, 1886, 1887, 1, 0, 0, 0, 1887, 1890, 5, 153, 0, 0, 1888, 1891, - 3, 118, 59, 0, 1889, 1891, 3, 214, 107, 0, 1890, 1888, 1, 0, 0, 0, 1890, - 1889, 1, 0, 0, 0, 1891, 131, 1, 0, 0, 0, 1892, 1894, 5, 150, 0, 0, 1893, - 1895, 5, 116, 0, 0, 1894, 1893, 1, 0, 0, 0, 1894, 1895, 1, 0, 0, 0, 1895, - 1896, 1, 0, 0, 0, 1896, 1901, 3, 56, 28, 0, 1897, 1898, 5, 5, 0, 0, 1898, - 1900, 3, 56, 28, 0, 1899, 1897, 1, 0, 0, 0, 1900, 1903, 1, 0, 0, 0, 1901, - 1899, 1, 0, 0, 0, 1901, 1902, 1, 0, 0, 0, 1902, 133, 1, 0, 0, 0, 1903, - 1901, 1, 0, 0, 0, 1904, 1905, 5, 109, 0, 0, 1905, 1906, 5, 40, 0, 0, 1906, - 1911, 3, 138, 69, 0, 1907, 1908, 5, 5, 0, 0, 1908, 1910, 3, 138, 69, 0, - 1909, 1907, 1, 0, 0, 0, 1910, 1913, 1, 0, 0, 0, 1911, 1909, 1, 0, 0, 0, - 1911, 1912, 1, 0, 0, 0, 1912, 135, 1, 0, 0, 0, 1913, 1911, 1, 0, 0, 0, - 1914, 1915, 5, 98, 0, 0, 1915, 1918, 3, 68, 34, 0, 1916, 1917, 7, 19, 0, - 0, 1917, 1919, 3, 68, 34, 0, 1918, 1916, 1, 0, 0, 0, 1918, 1919, 1, 0, - 0, 0, 1919, 137, 1, 0, 0, 0, 1920, 1923, 3, 68, 34, 0, 1921, 1922, 5, 45, - 0, 0, 1922, 1924, 3, 192, 96, 0, 1923, 1921, 1, 0, 0, 0, 1923, 1924, 1, - 0, 0, 0, 1924, 1926, 1, 0, 0, 0, 1925, 1927, 3, 140, 70, 0, 1926, 1925, - 1, 0, 0, 0, 1926, 1927, 1, 0, 0, 0, 1927, 1930, 1, 0, 0, 0, 1928, 1929, - 5, 176, 0, 0, 1929, 1931, 7, 20, 0, 0, 1930, 1928, 1, 0, 0, 0, 1930, 1931, - 1, 0, 0, 0, 1931, 139, 1, 0, 0, 0, 1932, 1933, 7, 21, 0, 0, 1933, 141, - 1, 0, 0, 0, 1934, 1935, 3, 68, 34, 0, 1935, 1936, 5, 156, 0, 0, 1936, 1945, - 1, 0, 0, 0, 1937, 1938, 3, 68, 34, 0, 1938, 1939, 5, 159, 0, 0, 1939, 1945, - 1, 0, 0, 0, 1940, 1941, 5, 158, 0, 0, 1941, 1945, 5, 127, 0, 0, 1942, 1943, - 5, 157, 0, 0, 1943, 1945, 5, 156, 0, 0, 1944, 1934, 1, 0, 0, 0, 1944, 1937, - 1, 0, 0, 0, 1944, 1940, 1, 0, 0, 0, 1944, 1942, 1, 0, 0, 0, 1945, 143, - 1, 0, 0, 0, 1946, 1947, 3, 68, 34, 0, 1947, 1948, 5, 156, 0, 0, 1948, 1957, - 1, 0, 0, 0, 1949, 1950, 3, 68, 34, 0, 1950, 1951, 5, 159, 0, 0, 1951, 1957, - 1, 0, 0, 0, 1952, 1953, 5, 158, 0, 0, 1953, 1957, 5, 127, 0, 0, 1954, 1955, - 5, 157, 0, 0, 1955, 1957, 5, 159, 0, 0, 1956, 1946, 1, 0, 0, 0, 1956, 1949, - 1, 0, 0, 0, 1956, 1952, 1, 0, 0, 0, 1956, 1954, 1, 0, 0, 0, 1957, 145, - 1, 0, 0, 0, 1958, 1959, 3, 68, 34, 0, 1959, 1960, 5, 156, 0, 0, 1960, 1966, - 1, 0, 0, 0, 1961, 1962, 5, 157, 0, 0, 1962, 1966, 5, 156, 0, 0, 1963, 1964, - 5, 158, 0, 0, 1964, 1966, 5, 127, 0, 0, 1965, 1958, 1, 0, 0, 0, 1965, 1961, - 1, 0, 0, 0, 1965, 1963, 1, 0, 0, 0, 1966, 147, 1, 0, 0, 0, 1967, 1968, - 7, 22, 0, 0, 1968, 1969, 5, 3, 0, 0, 1969, 1970, 3, 68, 34, 0, 1970, 1971, - 5, 4, 0, 0, 1971, 1972, 5, 153, 0, 0, 1972, 1974, 5, 3, 0, 0, 1973, 1975, - 3, 154, 77, 0, 1974, 1973, 1, 0, 0, 0, 1974, 1975, 1, 0, 0, 0, 1975, 1976, - 1, 0, 0, 0, 1976, 1978, 3, 158, 79, 0, 1977, 1979, 3, 124, 62, 0, 1978, - 1977, 1, 0, 0, 0, 1978, 1979, 1, 0, 0, 0, 1979, 1980, 1, 0, 0, 0, 1980, - 1981, 5, 4, 0, 0, 1981, 2053, 1, 0, 0, 0, 1982, 1983, 7, 23, 0, 0, 1983, - 1984, 5, 3, 0, 0, 1984, 1985, 5, 4, 0, 0, 1985, 1986, 5, 153, 0, 0, 1986, - 1988, 5, 3, 0, 0, 1987, 1989, 3, 154, 77, 0, 1988, 1987, 1, 0, 0, 0, 1988, - 1989, 1, 0, 0, 0, 1989, 1991, 1, 0, 0, 0, 1990, 1992, 3, 156, 78, 0, 1991, - 1990, 1, 0, 0, 0, 1991, 1992, 1, 0, 0, 0, 1992, 1993, 1, 0, 0, 0, 1993, - 2053, 5, 4, 0, 0, 1994, 1995, 7, 24, 0, 0, 1995, 1996, 5, 3, 0, 0, 1996, - 1997, 5, 4, 0, 0, 1997, 1998, 5, 153, 0, 0, 1998, 2000, 5, 3, 0, 0, 1999, - 2001, 3, 154, 77, 0, 2000, 1999, 1, 0, 0, 0, 2000, 2001, 1, 0, 0, 0, 2001, - 2002, 1, 0, 0, 0, 2002, 2003, 3, 158, 79, 0, 2003, 2004, 5, 4, 0, 0, 2004, - 2053, 1, 0, 0, 0, 2005, 2006, 7, 25, 0, 0, 2006, 2007, 5, 3, 0, 0, 2007, - 2009, 3, 68, 34, 0, 2008, 2010, 3, 150, 75, 0, 2009, 2008, 1, 0, 0, 0, - 2009, 2010, 1, 0, 0, 0, 2010, 2012, 1, 0, 0, 0, 2011, 2013, 3, 152, 76, - 0, 2012, 2011, 1, 0, 0, 0, 2012, 2013, 1, 0, 0, 0, 2013, 2014, 1, 0, 0, - 0, 2014, 2015, 5, 4, 0, 0, 2015, 2016, 5, 153, 0, 0, 2016, 2018, 5, 3, - 0, 0, 2017, 2019, 3, 154, 77, 0, 2018, 2017, 1, 0, 0, 0, 2018, 2019, 1, - 0, 0, 0, 2019, 2020, 1, 0, 0, 0, 2020, 2021, 3, 158, 79, 0, 2021, 2022, - 5, 4, 0, 0, 2022, 2053, 1, 0, 0, 0, 2023, 2024, 5, 165, 0, 0, 2024, 2025, - 5, 3, 0, 0, 2025, 2026, 3, 68, 34, 0, 2026, 2027, 5, 5, 0, 0, 2027, 2028, - 3, 36, 18, 0, 2028, 2029, 5, 4, 0, 0, 2029, 2030, 5, 153, 0, 0, 2030, 2032, - 5, 3, 0, 0, 2031, 2033, 3, 154, 77, 0, 2032, 2031, 1, 0, 0, 0, 2032, 2033, - 1, 0, 0, 0, 2033, 2034, 1, 0, 0, 0, 2034, 2036, 3, 158, 79, 0, 2035, 2037, - 3, 124, 62, 0, 2036, 2035, 1, 0, 0, 0, 2036, 2037, 1, 0, 0, 0, 2037, 2038, - 1, 0, 0, 0, 2038, 2039, 5, 4, 0, 0, 2039, 2053, 1, 0, 0, 0, 2040, 2041, - 5, 166, 0, 0, 2041, 2042, 5, 3, 0, 0, 2042, 2043, 3, 68, 34, 0, 2043, 2044, - 5, 4, 0, 0, 2044, 2045, 5, 153, 0, 0, 2045, 2047, 5, 3, 0, 0, 2046, 2048, - 3, 154, 77, 0, 2047, 2046, 1, 0, 0, 0, 2047, 2048, 1, 0, 0, 0, 2048, 2049, - 1, 0, 0, 0, 2049, 2050, 3, 158, 79, 0, 2050, 2051, 5, 4, 0, 0, 2051, 2053, - 1, 0, 0, 0, 2052, 1967, 1, 0, 0, 0, 2052, 1982, 1, 0, 0, 0, 2052, 1994, - 1, 0, 0, 0, 2052, 2005, 1, 0, 0, 0, 2052, 2023, 1, 0, 0, 0, 2052, 2040, - 1, 0, 0, 0, 2053, 149, 1, 0, 0, 0, 2054, 2055, 5, 5, 0, 0, 2055, 2056, - 3, 36, 18, 0, 2056, 151, 1, 0, 0, 0, 2057, 2058, 5, 5, 0, 0, 2058, 2059, - 3, 36, 18, 0, 2059, 153, 1, 0, 0, 0, 2060, 2061, 5, 154, 0, 0, 2061, 2063, - 5, 40, 0, 0, 2062, 2064, 3, 68, 34, 0, 2063, 2062, 1, 0, 0, 0, 2064, 2065, - 1, 0, 0, 0, 2065, 2063, 1, 0, 0, 0, 2065, 2066, 1, 0, 0, 0, 2066, 155, - 1, 0, 0, 0, 2067, 2068, 5, 109, 0, 0, 2068, 2070, 5, 40, 0, 0, 2069, 2071, - 3, 68, 34, 0, 2070, 2069, 1, 0, 0, 0, 2071, 2072, 1, 0, 0, 0, 2072, 2070, - 1, 0, 0, 0, 2072, 2073, 1, 0, 0, 0, 2073, 157, 1, 0, 0, 0, 2074, 2075, - 5, 109, 0, 0, 2075, 2076, 5, 40, 0, 0, 2076, 2077, 3, 158, 79, 0, 2077, - 159, 1, 0, 0, 0, 2078, 2080, 3, 68, 34, 0, 2079, 2081, 3, 140, 70, 0, 2080, - 2079, 1, 0, 0, 0, 2080, 2081, 1, 0, 0, 0, 2081, 2089, 1, 0, 0, 0, 2082, - 2083, 5, 5, 0, 0, 2083, 2085, 3, 68, 34, 0, 2084, 2086, 3, 140, 70, 0, - 2085, 2084, 1, 0, 0, 0, 2085, 2086, 1, 0, 0, 0, 2086, 2088, 1, 0, 0, 0, - 2087, 2082, 1, 0, 0, 0, 2088, 2091, 1, 0, 0, 0, 2089, 2087, 1, 0, 0, 0, - 2089, 2090, 1, 0, 0, 0, 2090, 161, 1, 0, 0, 0, 2091, 2089, 1, 0, 0, 0, - 2092, 2093, 3, 84, 42, 0, 2093, 163, 1, 0, 0, 0, 2094, 2095, 3, 84, 42, - 0, 2095, 165, 1, 0, 0, 0, 2096, 2097, 7, 26, 0, 0, 2097, 167, 1, 0, 0, - 0, 2098, 2099, 5, 190, 0, 0, 2099, 169, 1, 0, 0, 0, 2100, 2103, 3, 68, - 34, 0, 2101, 2103, 3, 30, 15, 0, 2102, 2100, 1, 0, 0, 0, 2102, 2101, 1, - 0, 0, 0, 2103, 171, 1, 0, 0, 0, 2104, 2105, 7, 27, 0, 0, 2105, 173, 1, - 0, 0, 0, 2106, 2107, 7, 28, 0, 0, 2107, 175, 1, 0, 0, 0, 2108, 2109, 3, - 228, 114, 0, 2109, 177, 1, 0, 0, 0, 2110, 2111, 3, 228, 114, 0, 2111, 179, - 1, 0, 0, 0, 2112, 2113, 3, 182, 91, 0, 2113, 2114, 5, 2, 0, 0, 2114, 2116, - 1, 0, 0, 0, 2115, 2112, 1, 0, 0, 0, 2115, 2116, 1, 0, 0, 0, 2116, 2117, - 1, 0, 0, 0, 2117, 2118, 3, 178, 89, 0, 2118, 181, 1, 0, 0, 0, 2119, 2120, - 3, 228, 114, 0, 2120, 183, 1, 0, 0, 0, 2121, 2122, 3, 228, 114, 0, 2122, - 185, 1, 0, 0, 0, 2123, 2124, 3, 228, 114, 0, 2124, 187, 1, 0, 0, 0, 2125, - 2126, 3, 228, 114, 0, 2126, 189, 1, 0, 0, 0, 2127, 2128, 3, 228, 114, 0, - 2128, 191, 1, 0, 0, 0, 2129, 2130, 3, 228, 114, 0, 2130, 193, 1, 0, 0, - 0, 2131, 2132, 3, 228, 114, 0, 2132, 195, 1, 0, 0, 0, 2133, 2134, 3, 228, - 114, 0, 2134, 197, 1, 0, 0, 0, 2135, 2136, 3, 228, 114, 0, 2136, 199, 1, - 0, 0, 0, 2137, 2138, 3, 228, 114, 0, 2138, 201, 1, 0, 0, 0, 2139, 2140, - 3, 228, 114, 0, 2140, 203, 1, 0, 0, 0, 2141, 2142, 3, 228, 114, 0, 2142, - 205, 1, 0, 0, 0, 2143, 2144, 3, 228, 114, 0, 2144, 207, 1, 0, 0, 0, 2145, - 2146, 7, 27, 0, 0, 2146, 209, 1, 0, 0, 0, 2147, 2148, 3, 228, 114, 0, 2148, - 211, 1, 0, 0, 0, 2149, 2150, 3, 228, 114, 0, 2150, 213, 1, 0, 0, 0, 2151, - 2152, 3, 228, 114, 0, 2152, 215, 1, 0, 0, 0, 2153, 2154, 3, 228, 114, 0, - 2154, 217, 1, 0, 0, 0, 2155, 2156, 3, 228, 114, 0, 2156, 219, 1, 0, 0, - 0, 2157, 2158, 3, 228, 114, 0, 2158, 221, 1, 0, 0, 0, 2159, 2160, 3, 228, - 114, 0, 2160, 223, 1, 0, 0, 0, 2161, 2162, 3, 228, 114, 0, 2162, 225, 1, - 0, 0, 0, 2163, 2164, 3, 228, 114, 0, 2164, 227, 1, 0, 0, 0, 2165, 2173, - 5, 186, 0, 0, 2166, 2173, 3, 174, 87, 0, 2167, 2173, 5, 190, 0, 0, 2168, - 2169, 5, 3, 0, 0, 2169, 2170, 3, 228, 114, 0, 2170, 2171, 5, 4, 0, 0, 2171, - 2173, 1, 0, 0, 0, 2172, 2165, 1, 0, 0, 0, 2172, 2166, 1, 0, 0, 0, 2172, - 2167, 1, 0, 0, 0, 2172, 2168, 1, 0, 0, 0, 2173, 229, 1, 0, 0, 0, 314, 233, + 224, 226, 228, 0, 30, 3, 0, 60, 60, 71, 71, 84, 84, 2, 0, 49, 49, 68, 68, + 1, 0, 136, 137, 2, 0, 149, 149, 174, 174, 2, 0, 8, 8, 11, 11, 2, 0, 61, + 61, 144, 144, 2, 0, 58, 58, 106, 106, 2, 0, 60, 60, 84, 84, 5, 0, 27, 27, + 74, 74, 83, 83, 124, 124, 128, 128, 4, 0, 86, 86, 135, 135, 141, 141, 148, + 148, 1, 0, 9, 10, 2, 0, 7, 7, 14, 15, 1, 0, 16, 19, 1, 0, 20, 23, 4, 0, + 79, 79, 99, 99, 101, 101, 120, 120, 3, 0, 27, 27, 74, 74, 128, 128, 5, + 0, 54, 56, 106, 106, 175, 176, 189, 189, 192, 193, 2, 0, 31, 31, 64, 64, + 3, 0, 78, 78, 98, 98, 127, 127, 3, 0, 130, 130, 157, 157, 182, 182, 2, + 0, 5, 5, 108, 108, 1, 0, 179, 180, 2, 0, 36, 36, 62, 62, 2, 0, 154, 154, + 165, 165, 2, 0, 162, 162, 169, 169, 2, 0, 163, 163, 170, 171, 2, 0, 164, + 164, 166, 166, 3, 0, 8, 8, 11, 12, 104, 104, 2, 0, 188, 188, 192, 192, + 1, 0, 27, 183, 2482, 0, 233, 1, 0, 0, 0, 2, 241, 1, 0, 0, 0, 4, 267, 1, + 0, 0, 0, 6, 295, 1, 0, 0, 0, 8, 327, 1, 0, 0, 0, 10, 337, 1, 0, 0, 0, 12, + 345, 1, 0, 0, 0, 14, 355, 1, 0, 0, 0, 16, 359, 1, 0, 0, 0, 18, 370, 1, + 0, 0, 0, 20, 373, 1, 0, 0, 0, 22, 379, 1, 0, 0, 0, 24, 413, 1, 0, 0, 0, + 26, 425, 1, 0, 0, 0, 28, 427, 1, 0, 0, 0, 30, 474, 1, 0, 0, 0, 32, 485, + 1, 0, 0, 0, 34, 503, 1, 0, 0, 0, 36, 555, 1, 0, 0, 0, 38, 561, 1, 0, 0, + 0, 40, 602, 1, 0, 0, 0, 42, 644, 1, 0, 0, 0, 44, 648, 1, 0, 0, 0, 46, 712, + 1, 0, 0, 0, 48, 744, 1, 0, 0, 0, 50, 773, 1, 0, 0, 0, 52, 794, 1, 0, 0, + 0, 54, 808, 1, 0, 0, 0, 56, 819, 1, 0, 0, 0, 58, 838, 1, 0, 0, 0, 60, 866, + 1, 0, 0, 0, 62, 879, 1, 0, 0, 0, 64, 897, 1, 0, 0, 0, 66, 903, 1, 0, 0, + 0, 68, 1005, 1, 0, 0, 0, 70, 1129, 1, 0, 0, 0, 72, 1139, 1, 0, 0, 0, 74, + 1142, 1, 0, 0, 0, 76, 1214, 1, 0, 0, 0, 78, 1261, 1, 0, 0, 0, 80, 1279, + 1, 0, 0, 0, 82, 1281, 1, 0, 0, 0, 84, 1295, 1, 0, 0, 0, 86, 1312, 1, 0, + 0, 0, 88, 1412, 1, 0, 0, 0, 90, 1414, 1, 0, 0, 0, 92, 1417, 1, 0, 0, 0, + 94, 1427, 1, 0, 0, 0, 96, 1577, 1, 0, 0, 0, 98, 1591, 1, 0, 0, 0, 100, + 1607, 1, 0, 0, 0, 102, 1623, 1, 0, 0, 0, 104, 1631, 1, 0, 0, 0, 106, 1634, + 1, 0, 0, 0, 108, 1669, 1, 0, 0, 0, 110, 1681, 1, 0, 0, 0, 112, 1722, 1, + 0, 0, 0, 114, 1736, 1, 0, 0, 0, 116, 1744, 1, 0, 0, 0, 118, 1750, 1, 0, + 0, 0, 120, 1781, 1, 0, 0, 0, 122, 1817, 1, 0, 0, 0, 124, 1827, 1, 0, 0, + 0, 126, 1836, 1, 0, 0, 0, 128, 1851, 1, 0, 0, 0, 130, 1871, 1, 0, 0, 0, + 132, 1893, 1, 0, 0, 0, 134, 1905, 1, 0, 0, 0, 136, 1915, 1, 0, 0, 0, 138, + 1921, 1, 0, 0, 0, 140, 1933, 1, 0, 0, 0, 142, 1945, 1, 0, 0, 0, 144, 1957, + 1, 0, 0, 0, 146, 1966, 1, 0, 0, 0, 148, 2053, 1, 0, 0, 0, 150, 2055, 1, + 0, 0, 0, 152, 2058, 1, 0, 0, 0, 154, 2061, 1, 0, 0, 0, 156, 2068, 1, 0, + 0, 0, 158, 2075, 1, 0, 0, 0, 160, 2079, 1, 0, 0, 0, 162, 2093, 1, 0, 0, + 0, 164, 2095, 1, 0, 0, 0, 166, 2097, 1, 0, 0, 0, 168, 2099, 1, 0, 0, 0, + 170, 2103, 1, 0, 0, 0, 172, 2105, 1, 0, 0, 0, 174, 2107, 1, 0, 0, 0, 176, + 2109, 1, 0, 0, 0, 178, 2111, 1, 0, 0, 0, 180, 2116, 1, 0, 0, 0, 182, 2120, + 1, 0, 0, 0, 184, 2122, 1, 0, 0, 0, 186, 2124, 1, 0, 0, 0, 188, 2126, 1, + 0, 0, 0, 190, 2128, 1, 0, 0, 0, 192, 2130, 1, 0, 0, 0, 194, 2132, 1, 0, + 0, 0, 196, 2134, 1, 0, 0, 0, 198, 2136, 1, 0, 0, 0, 200, 2138, 1, 0, 0, + 0, 202, 2140, 1, 0, 0, 0, 204, 2142, 1, 0, 0, 0, 206, 2144, 1, 0, 0, 0, + 208, 2146, 1, 0, 0, 0, 210, 2148, 1, 0, 0, 0, 212, 2150, 1, 0, 0, 0, 214, + 2152, 1, 0, 0, 0, 216, 2154, 1, 0, 0, 0, 218, 2156, 1, 0, 0, 0, 220, 2158, + 1, 0, 0, 0, 222, 2160, 1, 0, 0, 0, 224, 2162, 1, 0, 0, 0, 226, 2164, 1, + 0, 0, 0, 228, 2173, 1, 0, 0, 0, 230, 232, 3, 2, 1, 0, 231, 230, 1, 0, 0, + 0, 232, 235, 1, 0, 0, 0, 233, 231, 1, 0, 0, 0, 233, 234, 1, 0, 0, 0, 234, + 236, 1, 0, 0, 0, 235, 233, 1, 0, 0, 0, 236, 237, 5, 0, 0, 1, 237, 1, 1, + 0, 0, 0, 238, 240, 5, 1, 0, 0, 239, 238, 1, 0, 0, 0, 240, 243, 1, 0, 0, + 0, 241, 239, 1, 0, 0, 0, 241, 242, 1, 0, 0, 0, 242, 244, 1, 0, 0, 0, 243, + 241, 1, 0, 0, 0, 244, 253, 3, 4, 2, 0, 245, 247, 5, 1, 0, 0, 246, 245, + 1, 0, 0, 0, 247, 248, 1, 0, 0, 0, 248, 246, 1, 0, 0, 0, 248, 249, 1, 0, + 0, 0, 249, 250, 1, 0, 0, 0, 250, 252, 3, 4, 2, 0, 251, 246, 1, 0, 0, 0, + 252, 255, 1, 0, 0, 0, 253, 251, 1, 0, 0, 0, 253, 254, 1, 0, 0, 0, 254, + 259, 1, 0, 0, 0, 255, 253, 1, 0, 0, 0, 256, 258, 5, 1, 0, 0, 257, 256, + 1, 0, 0, 0, 258, 261, 1, 0, 0, 0, 259, 257, 1, 0, 0, 0, 259, 260, 1, 0, + 0, 0, 260, 3, 1, 0, 0, 0, 261, 259, 1, 0, 0, 0, 262, 265, 5, 73, 0, 0, + 263, 264, 5, 116, 0, 0, 264, 266, 5, 113, 0, 0, 265, 263, 1, 0, 0, 0, 265, + 266, 1, 0, 0, 0, 266, 268, 1, 0, 0, 0, 267, 262, 1, 0, 0, 0, 267, 268, + 1, 0, 0, 0, 268, 293, 1, 0, 0, 0, 269, 294, 3, 6, 3, 0, 270, 294, 3, 8, + 4, 0, 271, 294, 3, 10, 5, 0, 272, 294, 3, 12, 6, 0, 273, 294, 3, 14, 7, + 0, 274, 294, 3, 22, 11, 0, 275, 294, 3, 28, 14, 0, 276, 294, 3, 44, 22, + 0, 277, 294, 3, 46, 23, 0, 278, 294, 3, 48, 24, 0, 279, 294, 3, 60, 30, + 0, 280, 294, 3, 62, 31, 0, 281, 294, 3, 64, 32, 0, 282, 294, 3, 66, 33, + 0, 283, 294, 3, 74, 37, 0, 284, 294, 3, 78, 39, 0, 285, 294, 3, 82, 41, + 0, 286, 294, 3, 20, 10, 0, 287, 294, 3, 16, 8, 0, 288, 294, 3, 18, 9, 0, + 289, 294, 3, 84, 42, 0, 290, 294, 3, 106, 53, 0, 291, 294, 3, 110, 55, + 0, 292, 294, 3, 114, 57, 0, 293, 269, 1, 0, 0, 0, 293, 270, 1, 0, 0, 0, + 293, 271, 1, 0, 0, 0, 293, 272, 1, 0, 0, 0, 293, 273, 1, 0, 0, 0, 293, + 274, 1, 0, 0, 0, 293, 275, 1, 0, 0, 0, 293, 276, 1, 0, 0, 0, 293, 277, + 1, 0, 0, 0, 293, 278, 1, 0, 0, 0, 293, 279, 1, 0, 0, 0, 293, 280, 1, 0, + 0, 0, 293, 281, 1, 0, 0, 0, 293, 282, 1, 0, 0, 0, 293, 283, 1, 0, 0, 0, + 293, 284, 1, 0, 0, 0, 293, 285, 1, 0, 0, 0, 293, 286, 1, 0, 0, 0, 293, + 287, 1, 0, 0, 0, 293, 288, 1, 0, 0, 0, 293, 289, 1, 0, 0, 0, 293, 290, + 1, 0, 0, 0, 293, 291, 1, 0, 0, 0, 293, 292, 1, 0, 0, 0, 294, 5, 1, 0, 0, + 0, 295, 296, 5, 32, 0, 0, 296, 300, 5, 135, 0, 0, 297, 298, 3, 182, 91, + 0, 298, 299, 5, 2, 0, 0, 299, 301, 1, 0, 0, 0, 300, 297, 1, 0, 0, 0, 300, + 301, 1, 0, 0, 0, 301, 302, 1, 0, 0, 0, 302, 325, 3, 184, 92, 0, 303, 313, + 5, 123, 0, 0, 304, 305, 5, 139, 0, 0, 305, 314, 3, 188, 94, 0, 306, 308, + 5, 48, 0, 0, 307, 306, 1, 0, 0, 0, 307, 308, 1, 0, 0, 0, 308, 309, 1, 0, + 0, 0, 309, 310, 3, 190, 95, 0, 310, 311, 5, 139, 0, 0, 311, 312, 3, 190, + 95, 0, 312, 314, 1, 0, 0, 0, 313, 304, 1, 0, 0, 0, 313, 307, 1, 0, 0, 0, + 314, 326, 1, 0, 0, 0, 315, 317, 5, 29, 0, 0, 316, 318, 5, 48, 0, 0, 317, + 316, 1, 0, 0, 0, 317, 318, 1, 0, 0, 0, 318, 319, 1, 0, 0, 0, 319, 326, + 3, 30, 15, 0, 320, 322, 5, 65, 0, 0, 321, 323, 5, 48, 0, 0, 322, 321, 1, + 0, 0, 0, 322, 323, 1, 0, 0, 0, 323, 324, 1, 0, 0, 0, 324, 326, 3, 190, + 95, 0, 325, 303, 1, 0, 0, 0, 325, 315, 1, 0, 0, 0, 325, 320, 1, 0, 0, 0, + 326, 7, 1, 0, 0, 0, 327, 335, 5, 33, 0, 0, 328, 336, 3, 182, 91, 0, 329, + 330, 3, 182, 91, 0, 330, 331, 5, 2, 0, 0, 331, 333, 1, 0, 0, 0, 332, 329, + 1, 0, 0, 0, 332, 333, 1, 0, 0, 0, 333, 334, 1, 0, 0, 0, 334, 336, 3, 186, + 93, 0, 335, 328, 1, 0, 0, 0, 335, 332, 1, 0, 0, 0, 335, 336, 1, 0, 0, 0, + 336, 9, 1, 0, 0, 0, 337, 339, 5, 37, 0, 0, 338, 340, 5, 57, 0, 0, 339, + 338, 1, 0, 0, 0, 339, 340, 1, 0, 0, 0, 340, 341, 1, 0, 0, 0, 341, 342, + 3, 68, 34, 0, 342, 343, 5, 35, 0, 0, 343, 344, 3, 182, 91, 0, 344, 11, + 1, 0, 0, 0, 345, 347, 5, 40, 0, 0, 346, 348, 7, 0, 0, 0, 347, 346, 1, 0, + 0, 0, 347, 348, 1, 0, 0, 0, 348, 353, 1, 0, 0, 0, 349, 351, 5, 140, 0, + 0, 350, 352, 3, 212, 106, 0, 351, 350, 1, 0, 0, 0, 351, 352, 1, 0, 0, 0, + 352, 354, 1, 0, 0, 0, 353, 349, 1, 0, 0, 0, 353, 354, 1, 0, 0, 0, 354, + 13, 1, 0, 0, 0, 355, 357, 7, 1, 0, 0, 356, 358, 5, 140, 0, 0, 357, 356, + 1, 0, 0, 0, 357, 358, 1, 0, 0, 0, 358, 15, 1, 0, 0, 0, 359, 361, 5, 128, + 0, 0, 360, 362, 5, 140, 0, 0, 361, 360, 1, 0, 0, 0, 361, 362, 1, 0, 0, + 0, 362, 368, 1, 0, 0, 0, 363, 365, 5, 139, 0, 0, 364, 366, 5, 131, 0, 0, + 365, 364, 1, 0, 0, 0, 365, 366, 1, 0, 0, 0, 366, 367, 1, 0, 0, 0, 367, + 369, 3, 206, 103, 0, 368, 363, 1, 0, 0, 0, 368, 369, 1, 0, 0, 0, 369, 17, + 1, 0, 0, 0, 370, 371, 5, 131, 0, 0, 371, 372, 3, 206, 103, 0, 372, 19, + 1, 0, 0, 0, 373, 375, 5, 122, 0, 0, 374, 376, 5, 131, 0, 0, 375, 374, 1, + 0, 0, 0, 375, 376, 1, 0, 0, 0, 376, 377, 1, 0, 0, 0, 377, 378, 3, 206, + 103, 0, 378, 21, 1, 0, 0, 0, 379, 381, 5, 52, 0, 0, 380, 382, 5, 143, 0, + 0, 381, 380, 1, 0, 0, 0, 381, 382, 1, 0, 0, 0, 382, 383, 1, 0, 0, 0, 383, + 387, 5, 86, 0, 0, 384, 385, 5, 82, 0, 0, 385, 386, 5, 104, 0, 0, 386, 388, + 5, 72, 0, 0, 387, 384, 1, 0, 0, 0, 387, 388, 1, 0, 0, 0, 388, 392, 1, 0, + 0, 0, 389, 390, 3, 182, 91, 0, 390, 391, 5, 2, 0, 0, 391, 393, 1, 0, 0, + 0, 392, 389, 1, 0, 0, 0, 392, 393, 1, 0, 0, 0, 393, 394, 1, 0, 0, 0, 394, + 395, 3, 196, 98, 0, 395, 396, 5, 109, 0, 0, 396, 397, 3, 184, 92, 0, 397, + 398, 5, 3, 0, 0, 398, 403, 3, 24, 12, 0, 399, 400, 5, 5, 0, 0, 400, 402, + 3, 24, 12, 0, 401, 399, 1, 0, 0, 0, 402, 405, 1, 0, 0, 0, 403, 401, 1, + 0, 0, 0, 403, 404, 1, 0, 0, 0, 404, 406, 1, 0, 0, 0, 405, 403, 1, 0, 0, + 0, 406, 409, 5, 4, 0, 0, 407, 408, 5, 151, 0, 0, 408, 410, 3, 68, 34, 0, + 409, 407, 1, 0, 0, 0, 409, 410, 1, 0, 0, 0, 410, 23, 1, 0, 0, 0, 411, 414, + 3, 190, 95, 0, 412, 414, 3, 68, 34, 0, 413, 411, 1, 0, 0, 0, 413, 412, + 1, 0, 0, 0, 414, 417, 1, 0, 0, 0, 415, 416, 5, 47, 0, 0, 416, 418, 3, 192, + 96, 0, 417, 415, 1, 0, 0, 0, 417, 418, 1, 0, 0, 0, 418, 420, 1, 0, 0, 0, + 419, 421, 3, 140, 70, 0, 420, 419, 1, 0, 0, 0, 420, 421, 1, 0, 0, 0, 421, + 25, 1, 0, 0, 0, 422, 423, 5, 153, 0, 0, 423, 426, 5, 188, 0, 0, 424, 426, + 5, 134, 0, 0, 425, 422, 1, 0, 0, 0, 425, 424, 1, 0, 0, 0, 426, 27, 1, 0, + 0, 0, 427, 429, 5, 52, 0, 0, 428, 430, 7, 2, 0, 0, 429, 428, 1, 0, 0, 0, + 429, 430, 1, 0, 0, 0, 430, 431, 1, 0, 0, 0, 431, 435, 5, 135, 0, 0, 432, + 433, 5, 82, 0, 0, 433, 434, 5, 104, 0, 0, 434, 436, 5, 72, 0, 0, 435, 432, + 1, 0, 0, 0, 435, 436, 1, 0, 0, 0, 436, 440, 1, 0, 0, 0, 437, 438, 3, 182, + 91, 0, 438, 439, 5, 2, 0, 0, 439, 441, 1, 0, 0, 0, 440, 437, 1, 0, 0, 0, + 440, 441, 1, 0, 0, 0, 441, 442, 1, 0, 0, 0, 442, 472, 3, 184, 92, 0, 443, + 444, 5, 3, 0, 0, 444, 449, 3, 30, 15, 0, 445, 446, 5, 5, 0, 0, 446, 448, + 3, 30, 15, 0, 447, 445, 1, 0, 0, 0, 448, 451, 1, 0, 0, 0, 449, 450, 1, + 0, 0, 0, 449, 447, 1, 0, 0, 0, 450, 456, 1, 0, 0, 0, 451, 449, 1, 0, 0, + 0, 452, 453, 5, 5, 0, 0, 453, 455, 3, 38, 19, 0, 454, 452, 1, 0, 0, 0, + 455, 458, 1, 0, 0, 0, 456, 454, 1, 0, 0, 0, 456, 457, 1, 0, 0, 0, 457, + 459, 1, 0, 0, 0, 458, 456, 1, 0, 0, 0, 459, 468, 5, 4, 0, 0, 460, 465, + 3, 26, 13, 0, 461, 462, 5, 5, 0, 0, 462, 464, 3, 26, 13, 0, 463, 461, 1, + 0, 0, 0, 464, 467, 1, 0, 0, 0, 465, 463, 1, 0, 0, 0, 465, 466, 1, 0, 0, + 0, 466, 469, 1, 0, 0, 0, 467, 465, 1, 0, 0, 0, 468, 460, 1, 0, 0, 0, 468, + 469, 1, 0, 0, 0, 469, 473, 1, 0, 0, 0, 470, 471, 5, 35, 0, 0, 471, 473, + 3, 84, 42, 0, 472, 443, 1, 0, 0, 0, 472, 470, 1, 0, 0, 0, 473, 29, 1, 0, + 0, 0, 474, 476, 3, 190, 95, 0, 475, 477, 3, 32, 16, 0, 476, 475, 1, 0, + 0, 0, 476, 477, 1, 0, 0, 0, 477, 481, 1, 0, 0, 0, 478, 480, 3, 34, 17, + 0, 479, 478, 1, 0, 0, 0, 480, 483, 1, 0, 0, 0, 481, 479, 1, 0, 0, 0, 481, + 482, 1, 0, 0, 0, 482, 31, 1, 0, 0, 0, 483, 481, 1, 0, 0, 0, 484, 486, 3, + 176, 88, 0, 485, 484, 1, 0, 0, 0, 486, 487, 1, 0, 0, 0, 487, 488, 1, 0, + 0, 0, 487, 485, 1, 0, 0, 0, 488, 499, 1, 0, 0, 0, 489, 490, 5, 3, 0, 0, + 490, 491, 3, 36, 18, 0, 491, 492, 5, 4, 0, 0, 492, 500, 1, 0, 0, 0, 493, + 494, 5, 3, 0, 0, 494, 495, 3, 36, 18, 0, 495, 496, 5, 5, 0, 0, 496, 497, + 3, 36, 18, 0, 497, 498, 5, 4, 0, 0, 498, 500, 1, 0, 0, 0, 499, 489, 1, + 0, 0, 0, 499, 493, 1, 0, 0, 0, 499, 500, 1, 0, 0, 0, 500, 33, 1, 0, 0, + 0, 501, 502, 5, 51, 0, 0, 502, 504, 3, 176, 88, 0, 503, 501, 1, 0, 0, 0, + 503, 504, 1, 0, 0, 0, 504, 552, 1, 0, 0, 0, 505, 506, 5, 115, 0, 0, 506, + 508, 5, 97, 0, 0, 507, 509, 3, 140, 70, 0, 508, 507, 1, 0, 0, 0, 508, 509, + 1, 0, 0, 0, 509, 511, 1, 0, 0, 0, 510, 512, 3, 42, 21, 0, 511, 510, 1, + 0, 0, 0, 511, 512, 1, 0, 0, 0, 512, 514, 1, 0, 0, 0, 513, 515, 5, 38, 0, + 0, 514, 513, 1, 0, 0, 0, 514, 515, 1, 0, 0, 0, 515, 553, 1, 0, 0, 0, 516, + 517, 5, 104, 0, 0, 517, 520, 5, 106, 0, 0, 518, 520, 5, 143, 0, 0, 519, + 516, 1, 0, 0, 0, 519, 518, 1, 0, 0, 0, 520, 522, 1, 0, 0, 0, 521, 523, + 3, 42, 21, 0, 522, 521, 1, 0, 0, 0, 522, 523, 1, 0, 0, 0, 523, 553, 1, + 0, 0, 0, 524, 525, 5, 46, 0, 0, 525, 526, 5, 3, 0, 0, 526, 527, 3, 68, + 34, 0, 527, 528, 5, 4, 0, 0, 528, 553, 1, 0, 0, 0, 529, 536, 5, 58, 0, + 0, 530, 537, 3, 36, 18, 0, 531, 537, 3, 72, 36, 0, 532, 533, 5, 3, 0, 0, + 533, 534, 3, 68, 34, 0, 534, 535, 5, 4, 0, 0, 535, 537, 1, 0, 0, 0, 536, + 530, 1, 0, 0, 0, 536, 531, 1, 0, 0, 0, 536, 532, 1, 0, 0, 0, 537, 553, + 1, 0, 0, 0, 538, 539, 5, 47, 0, 0, 539, 553, 3, 192, 96, 0, 540, 553, 3, + 40, 20, 0, 541, 542, 5, 172, 0, 0, 542, 544, 5, 173, 0, 0, 543, 541, 1, + 0, 0, 0, 543, 544, 1, 0, 0, 0, 544, 545, 1, 0, 0, 0, 545, 546, 5, 35, 0, + 0, 546, 547, 5, 3, 0, 0, 547, 548, 3, 68, 34, 0, 548, 550, 5, 4, 0, 0, + 549, 551, 7, 3, 0, 0, 550, 549, 1, 0, 0, 0, 550, 551, 1, 0, 0, 0, 551, + 553, 1, 0, 0, 0, 552, 505, 1, 0, 0, 0, 552, 519, 1, 0, 0, 0, 552, 524, + 1, 0, 0, 0, 552, 529, 1, 0, 0, 0, 552, 538, 1, 0, 0, 0, 552, 540, 1, 0, + 0, 0, 552, 543, 1, 0, 0, 0, 553, 35, 1, 0, 0, 0, 554, 556, 7, 4, 0, 0, + 555, 554, 1, 0, 0, 0, 555, 556, 1, 0, 0, 0, 556, 557, 1, 0, 0, 0, 557, + 558, 5, 189, 0, 0, 558, 37, 1, 0, 0, 0, 559, 560, 5, 51, 0, 0, 560, 562, + 3, 176, 88, 0, 561, 559, 1, 0, 0, 0, 561, 562, 1, 0, 0, 0, 562, 600, 1, + 0, 0, 0, 563, 564, 5, 115, 0, 0, 564, 567, 5, 97, 0, 0, 565, 567, 5, 143, + 0, 0, 566, 563, 1, 0, 0, 0, 566, 565, 1, 0, 0, 0, 567, 568, 1, 0, 0, 0, + 568, 569, 5, 3, 0, 0, 569, 574, 3, 24, 12, 0, 570, 571, 5, 5, 0, 0, 571, + 573, 3, 24, 12, 0, 572, 570, 1, 0, 0, 0, 573, 576, 1, 0, 0, 0, 574, 572, + 1, 0, 0, 0, 574, 575, 1, 0, 0, 0, 575, 577, 1, 0, 0, 0, 576, 574, 1, 0, + 0, 0, 577, 579, 5, 4, 0, 0, 578, 580, 3, 42, 21, 0, 579, 578, 1, 0, 0, + 0, 579, 580, 1, 0, 0, 0, 580, 601, 1, 0, 0, 0, 581, 582, 5, 46, 0, 0, 582, + 583, 5, 3, 0, 0, 583, 584, 3, 68, 34, 0, 584, 585, 5, 4, 0, 0, 585, 601, + 1, 0, 0, 0, 586, 587, 5, 76, 0, 0, 587, 588, 5, 97, 0, 0, 588, 589, 5, + 3, 0, 0, 589, 594, 3, 190, 95, 0, 590, 591, 5, 5, 0, 0, 591, 593, 3, 190, + 95, 0, 592, 590, 1, 0, 0, 0, 593, 596, 1, 0, 0, 0, 594, 592, 1, 0, 0, 0, + 594, 595, 1, 0, 0, 0, 595, 597, 1, 0, 0, 0, 596, 594, 1, 0, 0, 0, 597, + 598, 5, 4, 0, 0, 598, 599, 3, 40, 20, 0, 599, 601, 1, 0, 0, 0, 600, 566, + 1, 0, 0, 0, 600, 581, 1, 0, 0, 0, 600, 586, 1, 0, 0, 0, 601, 39, 1, 0, + 0, 0, 602, 603, 5, 119, 0, 0, 603, 615, 3, 194, 97, 0, 604, 605, 5, 3, + 0, 0, 605, 610, 3, 190, 95, 0, 606, 607, 5, 5, 0, 0, 607, 609, 3, 190, + 95, 0, 608, 606, 1, 0, 0, 0, 609, 612, 1, 0, 0, 0, 610, 608, 1, 0, 0, 0, + 610, 611, 1, 0, 0, 0, 611, 613, 1, 0, 0, 0, 612, 610, 1, 0, 0, 0, 613, + 614, 5, 4, 0, 0, 614, 616, 1, 0, 0, 0, 615, 604, 1, 0, 0, 0, 615, 616, + 1, 0, 0, 0, 616, 631, 1, 0, 0, 0, 617, 618, 5, 109, 0, 0, 618, 625, 7, + 5, 0, 0, 619, 620, 5, 133, 0, 0, 620, 626, 7, 6, 0, 0, 621, 626, 5, 43, + 0, 0, 622, 626, 5, 125, 0, 0, 623, 624, 5, 103, 0, 0, 624, 626, 5, 28, + 0, 0, 625, 619, 1, 0, 0, 0, 625, 621, 1, 0, 0, 0, 625, 622, 1, 0, 0, 0, + 625, 623, 1, 0, 0, 0, 626, 630, 1, 0, 0, 0, 627, 628, 5, 101, 0, 0, 628, + 630, 3, 176, 88, 0, 629, 617, 1, 0, 0, 0, 629, 627, 1, 0, 0, 0, 630, 633, + 1, 0, 0, 0, 631, 629, 1, 0, 0, 0, 631, 632, 1, 0, 0, 0, 632, 642, 1, 0, + 0, 0, 633, 631, 1, 0, 0, 0, 634, 636, 5, 104, 0, 0, 635, 634, 1, 0, 0, + 0, 635, 636, 1, 0, 0, 0, 636, 637, 1, 0, 0, 0, 637, 640, 5, 59, 0, 0, 638, + 639, 5, 88, 0, 0, 639, 641, 7, 7, 0, 0, 640, 638, 1, 0, 0, 0, 640, 641, + 1, 0, 0, 0, 641, 643, 1, 0, 0, 0, 642, 635, 1, 0, 0, 0, 642, 643, 1, 0, + 0, 0, 643, 41, 1, 0, 0, 0, 644, 645, 5, 109, 0, 0, 645, 646, 5, 50, 0, + 0, 646, 647, 7, 8, 0, 0, 647, 43, 1, 0, 0, 0, 648, 650, 5, 52, 0, 0, 649, + 651, 7, 2, 0, 0, 650, 649, 1, 0, 0, 0, 650, 651, 1, 0, 0, 0, 651, 652, + 1, 0, 0, 0, 652, 656, 5, 141, 0, 0, 653, 654, 5, 82, 0, 0, 654, 655, 5, + 104, 0, 0, 655, 657, 5, 72, 0, 0, 656, 653, 1, 0, 0, 0, 656, 657, 1, 0, + 0, 0, 657, 661, 1, 0, 0, 0, 658, 659, 3, 182, 91, 0, 659, 660, 5, 2, 0, + 0, 660, 662, 1, 0, 0, 0, 661, 658, 1, 0, 0, 0, 661, 662, 1, 0, 0, 0, 662, + 663, 1, 0, 0, 0, 663, 668, 3, 198, 99, 0, 664, 669, 5, 39, 0, 0, 665, 669, + 5, 30, 0, 0, 666, 667, 5, 91, 0, 0, 667, 669, 5, 107, 0, 0, 668, 664, 1, + 0, 0, 0, 668, 665, 1, 0, 0, 0, 668, 666, 1, 0, 0, 0, 668, 669, 1, 0, 0, + 0, 669, 684, 1, 0, 0, 0, 670, 685, 5, 61, 0, 0, 671, 685, 5, 90, 0, 0, + 672, 682, 5, 144, 0, 0, 673, 674, 5, 107, 0, 0, 674, 679, 3, 190, 95, 0, + 675, 676, 5, 5, 0, 0, 676, 678, 3, 190, 95, 0, 677, 675, 1, 0, 0, 0, 678, + 681, 1, 0, 0, 0, 679, 677, 1, 0, 0, 0, 679, 680, 1, 0, 0, 0, 680, 683, + 1, 0, 0, 0, 681, 679, 1, 0, 0, 0, 682, 673, 1, 0, 0, 0, 682, 683, 1, 0, + 0, 0, 683, 685, 1, 0, 0, 0, 684, 670, 1, 0, 0, 0, 684, 671, 1, 0, 0, 0, + 684, 672, 1, 0, 0, 0, 685, 686, 1, 0, 0, 0, 686, 687, 5, 109, 0, 0, 687, + 691, 3, 184, 92, 0, 688, 689, 5, 75, 0, 0, 689, 690, 5, 66, 0, 0, 690, + 692, 5, 129, 0, 0, 691, 688, 1, 0, 0, 0, 691, 692, 1, 0, 0, 0, 692, 695, + 1, 0, 0, 0, 693, 694, 5, 150, 0, 0, 694, 696, 3, 68, 34, 0, 695, 693, 1, + 0, 0, 0, 695, 696, 1, 0, 0, 0, 696, 697, 1, 0, 0, 0, 697, 706, 5, 40, 0, + 0, 698, 703, 3, 106, 53, 0, 699, 703, 3, 74, 37, 0, 700, 703, 3, 60, 30, + 0, 701, 703, 3, 84, 42, 0, 702, 698, 1, 0, 0, 0, 702, 699, 1, 0, 0, 0, + 702, 700, 1, 0, 0, 0, 702, 701, 1, 0, 0, 0, 703, 704, 1, 0, 0, 0, 704, + 705, 5, 1, 0, 0, 705, 707, 1, 0, 0, 0, 706, 702, 1, 0, 0, 0, 707, 708, + 1, 0, 0, 0, 708, 706, 1, 0, 0, 0, 708, 709, 1, 0, 0, 0, 709, 710, 1, 0, + 0, 0, 710, 711, 5, 68, 0, 0, 711, 45, 1, 0, 0, 0, 712, 714, 5, 52, 0, 0, + 713, 715, 7, 2, 0, 0, 714, 713, 1, 0, 0, 0, 714, 715, 1, 0, 0, 0, 715, + 716, 1, 0, 0, 0, 716, 720, 5, 148, 0, 0, 717, 718, 5, 82, 0, 0, 718, 719, + 5, 104, 0, 0, 719, 721, 5, 72, 0, 0, 720, 717, 1, 0, 0, 0, 720, 721, 1, + 0, 0, 0, 721, 725, 1, 0, 0, 0, 722, 723, 3, 182, 91, 0, 723, 724, 5, 2, + 0, 0, 724, 726, 1, 0, 0, 0, 725, 722, 1, 0, 0, 0, 725, 726, 1, 0, 0, 0, + 726, 727, 1, 0, 0, 0, 727, 739, 3, 200, 100, 0, 728, 729, 5, 3, 0, 0, 729, + 734, 3, 190, 95, 0, 730, 731, 5, 5, 0, 0, 731, 733, 3, 190, 95, 0, 732, + 730, 1, 0, 0, 0, 733, 736, 1, 0, 0, 0, 734, 732, 1, 0, 0, 0, 734, 735, + 1, 0, 0, 0, 735, 737, 1, 0, 0, 0, 736, 734, 1, 0, 0, 0, 737, 738, 5, 4, + 0, 0, 738, 740, 1, 0, 0, 0, 739, 728, 1, 0, 0, 0, 739, 740, 1, 0, 0, 0, + 740, 741, 1, 0, 0, 0, 741, 742, 5, 35, 0, 0, 742, 743, 3, 84, 42, 0, 743, + 47, 1, 0, 0, 0, 744, 745, 5, 52, 0, 0, 745, 746, 5, 149, 0, 0, 746, 750, + 5, 135, 0, 0, 747, 748, 5, 82, 0, 0, 748, 749, 5, 104, 0, 0, 749, 751, + 5, 72, 0, 0, 750, 747, 1, 0, 0, 0, 750, 751, 1, 0, 0, 0, 751, 755, 1, 0, + 0, 0, 752, 753, 3, 182, 91, 0, 753, 754, 5, 2, 0, 0, 754, 756, 1, 0, 0, + 0, 755, 752, 1, 0, 0, 0, 755, 756, 1, 0, 0, 0, 756, 757, 1, 0, 0, 0, 757, + 758, 3, 184, 92, 0, 758, 759, 5, 145, 0, 0, 759, 771, 3, 202, 101, 0, 760, + 761, 5, 3, 0, 0, 761, 766, 3, 170, 85, 0, 762, 763, 5, 5, 0, 0, 763, 765, + 3, 170, 85, 0, 764, 762, 1, 0, 0, 0, 765, 768, 1, 0, 0, 0, 766, 764, 1, + 0, 0, 0, 766, 767, 1, 0, 0, 0, 767, 769, 1, 0, 0, 0, 768, 766, 1, 0, 0, + 0, 769, 770, 5, 4, 0, 0, 770, 772, 1, 0, 0, 0, 771, 760, 1, 0, 0, 0, 771, + 772, 1, 0, 0, 0, 772, 49, 1, 0, 0, 0, 773, 775, 5, 152, 0, 0, 774, 776, + 5, 118, 0, 0, 775, 774, 1, 0, 0, 0, 775, 776, 1, 0, 0, 0, 776, 777, 1, + 0, 0, 0, 777, 778, 3, 52, 26, 0, 778, 779, 5, 35, 0, 0, 779, 780, 5, 3, + 0, 0, 780, 781, 3, 84, 42, 0, 781, 791, 5, 4, 0, 0, 782, 783, 5, 5, 0, + 0, 783, 784, 3, 52, 26, 0, 784, 785, 5, 35, 0, 0, 785, 786, 5, 3, 0, 0, + 786, 787, 3, 84, 42, 0, 787, 788, 5, 4, 0, 0, 788, 790, 1, 0, 0, 0, 789, + 782, 1, 0, 0, 0, 790, 793, 1, 0, 0, 0, 791, 789, 1, 0, 0, 0, 791, 792, + 1, 0, 0, 0, 792, 51, 1, 0, 0, 0, 793, 791, 1, 0, 0, 0, 794, 806, 3, 184, + 92, 0, 795, 796, 5, 3, 0, 0, 796, 801, 3, 190, 95, 0, 797, 798, 5, 5, 0, + 0, 798, 800, 3, 190, 95, 0, 799, 797, 1, 0, 0, 0, 800, 803, 1, 0, 0, 0, + 801, 799, 1, 0, 0, 0, 801, 802, 1, 0, 0, 0, 802, 804, 1, 0, 0, 0, 803, + 801, 1, 0, 0, 0, 804, 805, 5, 4, 0, 0, 805, 807, 1, 0, 0, 0, 806, 795, + 1, 0, 0, 0, 806, 807, 1, 0, 0, 0, 807, 53, 1, 0, 0, 0, 808, 809, 3, 52, + 26, 0, 809, 810, 5, 35, 0, 0, 810, 811, 5, 3, 0, 0, 811, 812, 3, 162, 81, + 0, 812, 814, 5, 142, 0, 0, 813, 815, 5, 31, 0, 0, 814, 813, 1, 0, 0, 0, + 814, 815, 1, 0, 0, 0, 815, 816, 1, 0, 0, 0, 816, 817, 3, 164, 82, 0, 817, + 818, 5, 4, 0, 0, 818, 55, 1, 0, 0, 0, 819, 831, 3, 184, 92, 0, 820, 821, + 5, 3, 0, 0, 821, 826, 3, 190, 95, 0, 822, 823, 5, 5, 0, 0, 823, 825, 3, + 190, 95, 0, 824, 822, 1, 0, 0, 0, 825, 828, 1, 0, 0, 0, 826, 824, 1, 0, + 0, 0, 826, 827, 1, 0, 0, 0, 827, 829, 1, 0, 0, 0, 828, 826, 1, 0, 0, 0, + 829, 830, 5, 4, 0, 0, 830, 832, 1, 0, 0, 0, 831, 820, 1, 0, 0, 0, 831, + 832, 1, 0, 0, 0, 832, 833, 1, 0, 0, 0, 833, 834, 5, 35, 0, 0, 834, 835, + 5, 3, 0, 0, 835, 836, 3, 84, 42, 0, 836, 837, 5, 4, 0, 0, 837, 57, 1, 0, + 0, 0, 838, 847, 5, 126, 0, 0, 839, 848, 5, 7, 0, 0, 840, 845, 3, 68, 34, + 0, 841, 843, 5, 35, 0, 0, 842, 841, 1, 0, 0, 0, 842, 843, 1, 0, 0, 0, 843, + 844, 1, 0, 0, 0, 844, 846, 3, 172, 86, 0, 845, 842, 1, 0, 0, 0, 845, 846, + 1, 0, 0, 0, 846, 848, 1, 0, 0, 0, 847, 839, 1, 0, 0, 0, 847, 840, 1, 0, + 0, 0, 848, 862, 1, 0, 0, 0, 849, 858, 5, 5, 0, 0, 850, 859, 5, 7, 0, 0, + 851, 856, 3, 68, 34, 0, 852, 854, 5, 35, 0, 0, 853, 852, 1, 0, 0, 0, 853, + 854, 1, 0, 0, 0, 854, 855, 1, 0, 0, 0, 855, 857, 3, 172, 86, 0, 856, 853, + 1, 0, 0, 0, 856, 857, 1, 0, 0, 0, 857, 859, 1, 0, 0, 0, 858, 850, 1, 0, + 0, 0, 858, 851, 1, 0, 0, 0, 859, 861, 1, 0, 0, 0, 860, 849, 1, 0, 0, 0, + 861, 864, 1, 0, 0, 0, 862, 860, 1, 0, 0, 0, 862, 863, 1, 0, 0, 0, 863, + 59, 1, 0, 0, 0, 864, 862, 1, 0, 0, 0, 865, 867, 3, 50, 25, 0, 866, 865, + 1, 0, 0, 0, 866, 867, 1, 0, 0, 0, 867, 868, 1, 0, 0, 0, 868, 869, 5, 61, + 0, 0, 869, 870, 5, 77, 0, 0, 870, 873, 3, 112, 56, 0, 871, 872, 5, 151, + 0, 0, 872, 874, 3, 68, 34, 0, 873, 871, 1, 0, 0, 0, 873, 874, 1, 0, 0, + 0, 874, 876, 1, 0, 0, 0, 875, 877, 3, 58, 29, 0, 876, 875, 1, 0, 0, 0, + 876, 877, 1, 0, 0, 0, 877, 61, 1, 0, 0, 0, 878, 880, 3, 50, 25, 0, 879, + 878, 1, 0, 0, 0, 879, 880, 1, 0, 0, 0, 880, 881, 1, 0, 0, 0, 881, 882, + 5, 61, 0, 0, 882, 883, 5, 77, 0, 0, 883, 886, 3, 112, 56, 0, 884, 885, + 5, 151, 0, 0, 885, 887, 3, 68, 34, 0, 886, 884, 1, 0, 0, 0, 886, 887, 1, + 0, 0, 0, 887, 892, 1, 0, 0, 0, 888, 890, 3, 134, 67, 0, 889, 888, 1, 0, + 0, 0, 889, 890, 1, 0, 0, 0, 890, 891, 1, 0, 0, 0, 891, 893, 3, 136, 68, + 0, 892, 889, 1, 0, 0, 0, 892, 893, 1, 0, 0, 0, 893, 895, 1, 0, 0, 0, 894, + 896, 3, 58, 29, 0, 895, 894, 1, 0, 0, 0, 895, 896, 1, 0, 0, 0, 896, 63, + 1, 0, 0, 0, 897, 899, 5, 63, 0, 0, 898, 900, 5, 57, 0, 0, 899, 898, 1, + 0, 0, 0, 899, 900, 1, 0, 0, 0, 900, 901, 1, 0, 0, 0, 901, 902, 3, 182, + 91, 0, 902, 65, 1, 0, 0, 0, 903, 904, 5, 65, 0, 0, 904, 907, 7, 9, 0, 0, + 905, 906, 5, 82, 0, 0, 906, 908, 5, 72, 0, 0, 907, 905, 1, 0, 0, 0, 907, + 908, 1, 0, 0, 0, 908, 912, 1, 0, 0, 0, 909, 910, 3, 182, 91, 0, 910, 911, + 5, 2, 0, 0, 911, 913, 1, 0, 0, 0, 912, 909, 1, 0, 0, 0, 912, 913, 1, 0, + 0, 0, 913, 914, 1, 0, 0, 0, 914, 915, 3, 228, 114, 0, 915, 67, 1, 0, 0, + 0, 916, 917, 6, 34, -1, 0, 917, 1006, 3, 72, 36, 0, 918, 1006, 5, 190, + 0, 0, 919, 1006, 5, 191, 0, 0, 920, 921, 3, 182, 91, 0, 921, 922, 5, 2, + 0, 0, 922, 924, 1, 0, 0, 0, 923, 920, 1, 0, 0, 0, 923, 924, 1, 0, 0, 0, + 924, 925, 1, 0, 0, 0, 925, 926, 3, 184, 92, 0, 926, 927, 5, 2, 0, 0, 927, + 929, 1, 0, 0, 0, 928, 923, 1, 0, 0, 0, 928, 929, 1, 0, 0, 0, 929, 930, + 1, 0, 0, 0, 930, 1006, 3, 190, 95, 0, 931, 932, 3, 166, 83, 0, 932, 933, + 3, 68, 34, 21, 933, 1006, 1, 0, 0, 0, 934, 935, 3, 180, 90, 0, 935, 948, + 5, 3, 0, 0, 936, 938, 5, 64, 0, 0, 937, 936, 1, 0, 0, 0, 937, 938, 1, 0, + 0, 0, 938, 939, 1, 0, 0, 0, 939, 944, 3, 68, 34, 0, 940, 941, 5, 5, 0, + 0, 941, 943, 3, 68, 34, 0, 942, 940, 1, 0, 0, 0, 943, 946, 1, 0, 0, 0, + 944, 942, 1, 0, 0, 0, 944, 945, 1, 0, 0, 0, 945, 949, 1, 0, 0, 0, 946, + 944, 1, 0, 0, 0, 947, 949, 5, 7, 0, 0, 948, 937, 1, 0, 0, 0, 948, 947, + 1, 0, 0, 0, 948, 949, 1, 0, 0, 0, 949, 950, 1, 0, 0, 0, 950, 952, 5, 4, + 0, 0, 951, 953, 3, 116, 58, 0, 952, 951, 1, 0, 0, 0, 952, 953, 1, 0, 0, + 0, 953, 955, 1, 0, 0, 0, 954, 956, 3, 120, 60, 0, 955, 954, 1, 0, 0, 0, + 955, 956, 1, 0, 0, 0, 956, 1006, 1, 0, 0, 0, 957, 958, 5, 3, 0, 0, 958, + 963, 3, 68, 34, 0, 959, 960, 5, 5, 0, 0, 960, 962, 3, 68, 34, 0, 961, 959, + 1, 0, 0, 0, 962, 965, 1, 0, 0, 0, 963, 961, 1, 0, 0, 0, 963, 964, 1, 0, + 0, 0, 964, 966, 1, 0, 0, 0, 965, 963, 1, 0, 0, 0, 966, 967, 5, 4, 0, 0, + 967, 1006, 1, 0, 0, 0, 968, 969, 5, 45, 0, 0, 969, 970, 5, 3, 0, 0, 970, + 971, 3, 68, 34, 0, 971, 972, 5, 35, 0, 0, 972, 973, 3, 32, 16, 0, 973, + 974, 5, 4, 0, 0, 974, 1006, 1, 0, 0, 0, 975, 977, 5, 104, 0, 0, 976, 975, + 1, 0, 0, 0, 976, 977, 1, 0, 0, 0, 977, 978, 1, 0, 0, 0, 978, 980, 5, 72, + 0, 0, 979, 976, 1, 0, 0, 0, 979, 980, 1, 0, 0, 0, 980, 981, 1, 0, 0, 0, + 981, 982, 5, 3, 0, 0, 982, 983, 3, 84, 42, 0, 983, 984, 5, 4, 0, 0, 984, + 1006, 1, 0, 0, 0, 985, 987, 5, 44, 0, 0, 986, 988, 3, 68, 34, 0, 987, 986, + 1, 0, 0, 0, 987, 988, 1, 0, 0, 0, 988, 994, 1, 0, 0, 0, 989, 990, 5, 150, + 0, 0, 990, 991, 3, 68, 34, 0, 991, 992, 5, 138, 0, 0, 992, 993, 3, 68, + 34, 0, 993, 995, 1, 0, 0, 0, 994, 989, 1, 0, 0, 0, 995, 996, 1, 0, 0, 0, + 996, 994, 1, 0, 0, 0, 996, 997, 1, 0, 0, 0, 997, 1000, 1, 0, 0, 0, 998, + 999, 5, 67, 0, 0, 999, 1001, 3, 68, 34, 0, 1000, 998, 1, 0, 0, 0, 1000, + 1001, 1, 0, 0, 0, 1001, 1002, 1, 0, 0, 0, 1002, 1003, 5, 68, 0, 0, 1003, + 1006, 1, 0, 0, 0, 1004, 1006, 3, 70, 35, 0, 1005, 916, 1, 0, 0, 0, 1005, + 918, 1, 0, 0, 0, 1005, 919, 1, 0, 0, 0, 1005, 928, 1, 0, 0, 0, 1005, 931, + 1, 0, 0, 0, 1005, 934, 1, 0, 0, 0, 1005, 957, 1, 0, 0, 0, 1005, 968, 1, + 0, 0, 0, 1005, 979, 1, 0, 0, 0, 1005, 985, 1, 0, 0, 0, 1005, 1004, 1, 0, + 0, 0, 1006, 1126, 1, 0, 0, 0, 1007, 1008, 10, 20, 0, 0, 1008, 1009, 5, + 13, 0, 0, 1009, 1125, 3, 68, 34, 21, 1010, 1011, 10, 19, 0, 0, 1011, 1012, + 7, 10, 0, 0, 1012, 1125, 3, 68, 34, 20, 1013, 1014, 10, 18, 0, 0, 1014, + 1015, 7, 11, 0, 0, 1015, 1125, 3, 68, 34, 19, 1016, 1017, 10, 17, 0, 0, + 1017, 1018, 7, 4, 0, 0, 1018, 1125, 3, 68, 34, 18, 1019, 1020, 10, 16, + 0, 0, 1020, 1021, 7, 12, 0, 0, 1021, 1125, 3, 68, 34, 17, 1022, 1023, 10, + 15, 0, 0, 1023, 1024, 7, 13, 0, 0, 1024, 1125, 3, 68, 34, 16, 1025, 1041, + 10, 14, 0, 0, 1026, 1042, 5, 6, 0, 0, 1027, 1042, 5, 24, 0, 0, 1028, 1042, + 5, 25, 0, 0, 1029, 1042, 5, 26, 0, 0, 1030, 1042, 5, 94, 0, 0, 1031, 1032, + 5, 94, 0, 0, 1032, 1042, 5, 104, 0, 0, 1033, 1035, 5, 104, 0, 0, 1034, + 1033, 1, 0, 0, 0, 1034, 1035, 1, 0, 0, 0, 1035, 1036, 1, 0, 0, 0, 1036, + 1042, 5, 85, 0, 0, 1037, 1042, 5, 99, 0, 0, 1038, 1042, 5, 79, 0, 0, 1039, + 1042, 5, 101, 0, 0, 1040, 1042, 5, 120, 0, 0, 1041, 1026, 1, 0, 0, 0, 1041, + 1027, 1, 0, 0, 0, 1041, 1028, 1, 0, 0, 0, 1041, 1029, 1, 0, 0, 0, 1041, + 1030, 1, 0, 0, 0, 1041, 1031, 1, 0, 0, 0, 1041, 1034, 1, 0, 0, 0, 1041, + 1037, 1, 0, 0, 0, 1041, 1038, 1, 0, 0, 0, 1041, 1039, 1, 0, 0, 0, 1041, + 1040, 1, 0, 0, 0, 1042, 1043, 1, 0, 0, 0, 1043, 1125, 3, 68, 34, 15, 1044, + 1045, 10, 12, 0, 0, 1045, 1046, 5, 34, 0, 0, 1046, 1125, 3, 68, 34, 13, + 1047, 1048, 10, 11, 0, 0, 1048, 1049, 5, 110, 0, 0, 1049, 1125, 3, 68, + 34, 12, 1050, 1052, 10, 4, 0, 0, 1051, 1053, 5, 104, 0, 0, 1052, 1051, + 1, 0, 0, 0, 1052, 1053, 1, 0, 0, 0, 1053, 1054, 1, 0, 0, 0, 1054, 1055, + 5, 41, 0, 0, 1055, 1056, 3, 68, 34, 0, 1056, 1057, 5, 34, 0, 0, 1057, 1058, + 3, 68, 34, 5, 1058, 1125, 1, 0, 0, 0, 1059, 1061, 10, 13, 0, 0, 1060, 1062, + 5, 104, 0, 0, 1061, 1060, 1, 0, 0, 0, 1061, 1062, 1, 0, 0, 0, 1062, 1063, + 1, 0, 0, 0, 1063, 1102, 5, 85, 0, 0, 1064, 1074, 5, 3, 0, 0, 1065, 1075, + 3, 84, 42, 0, 1066, 1071, 3, 68, 34, 0, 1067, 1068, 5, 5, 0, 0, 1068, 1070, + 3, 68, 34, 0, 1069, 1067, 1, 0, 0, 0, 1070, 1073, 1, 0, 0, 0, 1071, 1069, + 1, 0, 0, 0, 1071, 1072, 1, 0, 0, 0, 1072, 1075, 1, 0, 0, 0, 1073, 1071, + 1, 0, 0, 0, 1074, 1065, 1, 0, 0, 0, 1074, 1066, 1, 0, 0, 0, 1074, 1075, + 1, 0, 0, 0, 1075, 1076, 1, 0, 0, 0, 1076, 1103, 5, 4, 0, 0, 1077, 1078, + 3, 182, 91, 0, 1078, 1079, 5, 2, 0, 0, 1079, 1081, 1, 0, 0, 0, 1080, 1077, + 1, 0, 0, 0, 1080, 1081, 1, 0, 0, 0, 1081, 1082, 1, 0, 0, 0, 1082, 1103, + 3, 184, 92, 0, 1083, 1084, 3, 182, 91, 0, 1084, 1085, 5, 2, 0, 0, 1085, + 1087, 1, 0, 0, 0, 1086, 1083, 1, 0, 0, 0, 1086, 1087, 1, 0, 0, 0, 1087, + 1088, 1, 0, 0, 0, 1088, 1089, 3, 226, 113, 0, 1089, 1098, 5, 3, 0, 0, 1090, + 1095, 3, 68, 34, 0, 1091, 1092, 5, 5, 0, 0, 1092, 1094, 3, 68, 34, 0, 1093, + 1091, 1, 0, 0, 0, 1094, 1097, 1, 0, 0, 0, 1095, 1093, 1, 0, 0, 0, 1095, + 1096, 1, 0, 0, 0, 1096, 1099, 1, 0, 0, 0, 1097, 1095, 1, 0, 0, 0, 1098, + 1090, 1, 0, 0, 0, 1098, 1099, 1, 0, 0, 0, 1099, 1100, 1, 0, 0, 0, 1100, + 1101, 5, 4, 0, 0, 1101, 1103, 1, 0, 0, 0, 1102, 1064, 1, 0, 0, 0, 1102, + 1080, 1, 0, 0, 0, 1102, 1086, 1, 0, 0, 0, 1103, 1125, 1, 0, 0, 0, 1104, + 1105, 10, 7, 0, 0, 1105, 1106, 5, 47, 0, 0, 1106, 1125, 3, 192, 96, 0, + 1107, 1109, 10, 6, 0, 0, 1108, 1110, 5, 104, 0, 0, 1109, 1108, 1, 0, 0, + 0, 1109, 1110, 1, 0, 0, 0, 1110, 1111, 1, 0, 0, 0, 1111, 1112, 7, 14, 0, + 0, 1112, 1115, 3, 68, 34, 0, 1113, 1114, 5, 69, 0, 0, 1114, 1116, 3, 68, + 34, 0, 1115, 1113, 1, 0, 0, 0, 1115, 1116, 1, 0, 0, 0, 1116, 1125, 1, 0, + 0, 0, 1117, 1122, 10, 5, 0, 0, 1118, 1123, 5, 95, 0, 0, 1119, 1123, 5, + 105, 0, 0, 1120, 1121, 5, 104, 0, 0, 1121, 1123, 5, 106, 0, 0, 1122, 1118, + 1, 0, 0, 0, 1122, 1119, 1, 0, 0, 0, 1122, 1120, 1, 0, 0, 0, 1123, 1125, + 1, 0, 0, 0, 1124, 1007, 1, 0, 0, 0, 1124, 1010, 1, 0, 0, 0, 1124, 1013, + 1, 0, 0, 0, 1124, 1016, 1, 0, 0, 0, 1124, 1019, 1, 0, 0, 0, 1124, 1022, + 1, 0, 0, 0, 1124, 1025, 1, 0, 0, 0, 1124, 1044, 1, 0, 0, 0, 1124, 1047, + 1, 0, 0, 0, 1124, 1050, 1, 0, 0, 0, 1124, 1059, 1, 0, 0, 0, 1124, 1104, + 1, 0, 0, 0, 1124, 1107, 1, 0, 0, 0, 1124, 1117, 1, 0, 0, 0, 1125, 1128, + 1, 0, 0, 0, 1126, 1124, 1, 0, 0, 0, 1126, 1127, 1, 0, 0, 0, 1127, 69, 1, + 0, 0, 0, 1128, 1126, 1, 0, 0, 0, 1129, 1130, 5, 117, 0, 0, 1130, 1135, + 5, 3, 0, 0, 1131, 1136, 5, 83, 0, 0, 1132, 1133, 7, 15, 0, 0, 1133, 1134, + 5, 5, 0, 0, 1134, 1136, 3, 168, 84, 0, 1135, 1131, 1, 0, 0, 0, 1135, 1132, + 1, 0, 0, 0, 1136, 1137, 1, 0, 0, 0, 1137, 1138, 5, 4, 0, 0, 1138, 71, 1, + 0, 0, 0, 1139, 1140, 7, 16, 0, 0, 1140, 73, 1, 0, 0, 0, 1141, 1143, 3, + 50, 25, 0, 1142, 1141, 1, 0, 0, 0, 1142, 1143, 1, 0, 0, 0, 1143, 1149, + 1, 0, 0, 0, 1144, 1150, 5, 90, 0, 0, 1145, 1150, 5, 124, 0, 0, 1146, 1147, + 5, 90, 0, 0, 1147, 1148, 5, 110, 0, 0, 1148, 1150, 7, 8, 0, 0, 1149, 1144, + 1, 0, 0, 0, 1149, 1145, 1, 0, 0, 0, 1149, 1146, 1, 0, 0, 0, 1150, 1151, + 1, 0, 0, 0, 1151, 1155, 5, 93, 0, 0, 1152, 1153, 3, 182, 91, 0, 1153, 1154, + 5, 2, 0, 0, 1154, 1156, 1, 0, 0, 0, 1155, 1152, 1, 0, 0, 0, 1155, 1156, + 1, 0, 0, 0, 1156, 1157, 1, 0, 0, 0, 1157, 1160, 3, 184, 92, 0, 1158, 1159, + 5, 35, 0, 0, 1159, 1161, 3, 208, 104, 0, 1160, 1158, 1, 0, 0, 0, 1160, + 1161, 1, 0, 0, 0, 1161, 1173, 1, 0, 0, 0, 1162, 1163, 5, 3, 0, 0, 1163, + 1168, 3, 190, 95, 0, 1164, 1165, 5, 5, 0, 0, 1165, 1167, 3, 190, 95, 0, + 1166, 1164, 1, 0, 0, 0, 1167, 1170, 1, 0, 0, 0, 1168, 1166, 1, 0, 0, 0, + 1168, 1169, 1, 0, 0, 0, 1169, 1171, 1, 0, 0, 0, 1170, 1168, 1, 0, 0, 0, + 1171, 1172, 5, 4, 0, 0, 1172, 1174, 1, 0, 0, 0, 1173, 1162, 1, 0, 0, 0, + 1173, 1174, 1, 0, 0, 0, 1174, 1206, 1, 0, 0, 0, 1175, 1176, 5, 147, 0, + 0, 1176, 1177, 5, 3, 0, 0, 1177, 1182, 3, 68, 34, 0, 1178, 1179, 5, 5, + 0, 0, 1179, 1181, 3, 68, 34, 0, 1180, 1178, 1, 0, 0, 0, 1181, 1184, 1, + 0, 0, 0, 1182, 1180, 1, 0, 0, 0, 1182, 1183, 1, 0, 0, 0, 1183, 1185, 1, + 0, 0, 0, 1184, 1182, 1, 0, 0, 0, 1185, 1200, 5, 4, 0, 0, 1186, 1187, 5, + 5, 0, 0, 1187, 1188, 5, 3, 0, 0, 1188, 1193, 3, 68, 34, 0, 1189, 1190, + 5, 5, 0, 0, 1190, 1192, 3, 68, 34, 0, 1191, 1189, 1, 0, 0, 0, 1192, 1195, + 1, 0, 0, 0, 1193, 1191, 1, 0, 0, 0, 1193, 1194, 1, 0, 0, 0, 1194, 1196, + 1, 0, 0, 0, 1195, 1193, 1, 0, 0, 0, 1196, 1197, 5, 4, 0, 0, 1197, 1199, + 1, 0, 0, 0, 1198, 1186, 1, 0, 0, 0, 1199, 1202, 1, 0, 0, 0, 1200, 1198, + 1, 0, 0, 0, 1200, 1201, 1, 0, 0, 0, 1201, 1207, 1, 0, 0, 0, 1202, 1200, + 1, 0, 0, 0, 1203, 1207, 3, 84, 42, 0, 1204, 1205, 5, 58, 0, 0, 1205, 1207, + 5, 147, 0, 0, 1206, 1175, 1, 0, 0, 0, 1206, 1203, 1, 0, 0, 0, 1206, 1204, + 1, 0, 0, 0, 1207, 1209, 1, 0, 0, 0, 1208, 1210, 3, 76, 38, 0, 1209, 1208, + 1, 0, 0, 0, 1209, 1210, 1, 0, 0, 0, 1210, 1212, 1, 0, 0, 0, 1211, 1213, + 3, 58, 29, 0, 1212, 1211, 1, 0, 0, 0, 1212, 1213, 1, 0, 0, 0, 1213, 75, + 1, 0, 0, 0, 1214, 1215, 5, 109, 0, 0, 1215, 1230, 5, 50, 0, 0, 1216, 1217, + 5, 3, 0, 0, 1217, 1222, 3, 24, 12, 0, 1218, 1219, 5, 5, 0, 0, 1219, 1221, + 3, 24, 12, 0, 1220, 1218, 1, 0, 0, 0, 1221, 1224, 1, 0, 0, 0, 1222, 1220, + 1, 0, 0, 0, 1222, 1223, 1, 0, 0, 0, 1223, 1225, 1, 0, 0, 0, 1224, 1222, + 1, 0, 0, 0, 1225, 1228, 5, 4, 0, 0, 1226, 1227, 5, 151, 0, 0, 1227, 1229, + 3, 68, 34, 0, 1228, 1226, 1, 0, 0, 0, 1228, 1229, 1, 0, 0, 0, 1229, 1231, + 1, 0, 0, 0, 1230, 1216, 1, 0, 0, 0, 1230, 1231, 1, 0, 0, 0, 1231, 1232, + 1, 0, 0, 0, 1232, 1259, 5, 186, 0, 0, 1233, 1260, 5, 187, 0, 0, 1234, 1235, + 5, 144, 0, 0, 1235, 1238, 5, 133, 0, 0, 1236, 1239, 3, 190, 95, 0, 1237, + 1239, 3, 108, 54, 0, 1238, 1236, 1, 0, 0, 0, 1238, 1237, 1, 0, 0, 0, 1239, + 1240, 1, 0, 0, 0, 1240, 1241, 5, 6, 0, 0, 1241, 1252, 3, 68, 34, 0, 1242, + 1245, 5, 5, 0, 0, 1243, 1246, 3, 190, 95, 0, 1244, 1246, 3, 108, 54, 0, + 1245, 1243, 1, 0, 0, 0, 1245, 1244, 1, 0, 0, 0, 1246, 1247, 1, 0, 0, 0, + 1247, 1248, 5, 6, 0, 0, 1248, 1249, 3, 68, 34, 0, 1249, 1251, 1, 0, 0, + 0, 1250, 1242, 1, 0, 0, 0, 1251, 1254, 1, 0, 0, 0, 1252, 1250, 1, 0, 0, + 0, 1252, 1253, 1, 0, 0, 0, 1253, 1257, 1, 0, 0, 0, 1254, 1252, 1, 0, 0, + 0, 1255, 1256, 5, 151, 0, 0, 1256, 1258, 3, 68, 34, 0, 1257, 1255, 1, 0, + 0, 0, 1257, 1258, 1, 0, 0, 0, 1258, 1260, 1, 0, 0, 0, 1259, 1233, 1, 0, + 0, 0, 1259, 1234, 1, 0, 0, 0, 1260, 77, 1, 0, 0, 0, 1261, 1265, 5, 114, + 0, 0, 1262, 1263, 3, 182, 91, 0, 1263, 1264, 5, 2, 0, 0, 1264, 1266, 1, + 0, 0, 0, 1265, 1262, 1, 0, 0, 0, 1265, 1266, 1, 0, 0, 0, 1266, 1267, 1, + 0, 0, 0, 1267, 1274, 3, 204, 102, 0, 1268, 1269, 5, 6, 0, 0, 1269, 1275, + 3, 80, 40, 0, 1270, 1271, 5, 3, 0, 0, 1271, 1272, 3, 80, 40, 0, 1272, 1273, + 5, 4, 0, 0, 1273, 1275, 1, 0, 0, 0, 1274, 1268, 1, 0, 0, 0, 1274, 1270, + 1, 0, 0, 0, 1274, 1275, 1, 0, 0, 0, 1275, 79, 1, 0, 0, 0, 1276, 1280, 3, + 36, 18, 0, 1277, 1280, 3, 176, 88, 0, 1278, 1280, 5, 192, 0, 0, 1279, 1276, + 1, 0, 0, 0, 1279, 1277, 1, 0, 0, 0, 1279, 1278, 1, 0, 0, 0, 1280, 81, 1, + 0, 0, 0, 1281, 1292, 5, 121, 0, 0, 1282, 1293, 3, 192, 96, 0, 1283, 1284, + 3, 182, 91, 0, 1284, 1285, 5, 2, 0, 0, 1285, 1287, 1, 0, 0, 0, 1286, 1283, + 1, 0, 0, 0, 1286, 1287, 1, 0, 0, 0, 1287, 1290, 1, 0, 0, 0, 1288, 1291, + 3, 184, 92, 0, 1289, 1291, 3, 196, 98, 0, 1290, 1288, 1, 0, 0, 0, 1290, + 1289, 1, 0, 0, 0, 1291, 1293, 1, 0, 0, 0, 1292, 1282, 1, 0, 0, 0, 1292, + 1286, 1, 0, 0, 0, 1292, 1293, 1, 0, 0, 0, 1293, 83, 1, 0, 0, 0, 1294, 1296, + 3, 132, 66, 0, 1295, 1294, 1, 0, 0, 0, 1295, 1296, 1, 0, 0, 0, 1296, 1297, + 1, 0, 0, 0, 1297, 1303, 3, 88, 44, 0, 1298, 1299, 3, 104, 52, 0, 1299, + 1300, 3, 88, 44, 0, 1300, 1302, 1, 0, 0, 0, 1301, 1298, 1, 0, 0, 0, 1302, + 1305, 1, 0, 0, 0, 1303, 1301, 1, 0, 0, 0, 1303, 1304, 1, 0, 0, 0, 1304, + 1307, 1, 0, 0, 0, 1305, 1303, 1, 0, 0, 0, 1306, 1308, 3, 134, 67, 0, 1307, + 1306, 1, 0, 0, 0, 1307, 1308, 1, 0, 0, 0, 1308, 1310, 1, 0, 0, 0, 1309, + 1311, 3, 136, 68, 0, 1310, 1309, 1, 0, 0, 0, 1310, 1311, 1, 0, 0, 0, 1311, + 85, 1, 0, 0, 0, 1312, 1319, 3, 96, 48, 0, 1313, 1314, 3, 100, 50, 0, 1314, + 1315, 3, 96, 48, 0, 1315, 1316, 3, 102, 51, 0, 1316, 1318, 1, 0, 0, 0, + 1317, 1313, 1, 0, 0, 0, 1318, 1321, 1, 0, 0, 0, 1319, 1317, 1, 0, 0, 0, + 1319, 1320, 1, 0, 0, 0, 1320, 87, 1, 0, 0, 0, 1321, 1319, 1, 0, 0, 0, 1322, + 1324, 5, 132, 0, 0, 1323, 1325, 7, 17, 0, 0, 1324, 1323, 1, 0, 0, 0, 1324, + 1325, 1, 0, 0, 0, 1325, 1326, 1, 0, 0, 0, 1326, 1331, 3, 98, 49, 0, 1327, + 1328, 5, 5, 0, 0, 1328, 1330, 3, 98, 49, 0, 1329, 1327, 1, 0, 0, 0, 1330, + 1333, 1, 0, 0, 0, 1331, 1329, 1, 0, 0, 0, 1331, 1332, 1, 0, 0, 0, 1332, + 1346, 1, 0, 0, 0, 1333, 1331, 1, 0, 0, 0, 1334, 1344, 5, 77, 0, 0, 1335, + 1340, 3, 96, 48, 0, 1336, 1337, 5, 5, 0, 0, 1337, 1339, 3, 96, 48, 0, 1338, + 1336, 1, 0, 0, 0, 1339, 1342, 1, 0, 0, 0, 1340, 1338, 1, 0, 0, 0, 1340, + 1341, 1, 0, 0, 0, 1341, 1345, 1, 0, 0, 0, 1342, 1340, 1, 0, 0, 0, 1343, + 1345, 3, 86, 43, 0, 1344, 1335, 1, 0, 0, 0, 1344, 1343, 1, 0, 0, 0, 1345, + 1347, 1, 0, 0, 0, 1346, 1334, 1, 0, 0, 0, 1346, 1347, 1, 0, 0, 0, 1347, + 1350, 1, 0, 0, 0, 1348, 1349, 5, 151, 0, 0, 1349, 1351, 3, 68, 34, 0, 1350, + 1348, 1, 0, 0, 0, 1350, 1351, 1, 0, 0, 0, 1351, 1366, 1, 0, 0, 0, 1352, + 1353, 5, 80, 0, 0, 1353, 1354, 5, 42, 0, 0, 1354, 1359, 3, 68, 34, 0, 1355, + 1356, 5, 5, 0, 0, 1356, 1358, 3, 68, 34, 0, 1357, 1355, 1, 0, 0, 0, 1358, + 1361, 1, 0, 0, 0, 1359, 1357, 1, 0, 0, 0, 1359, 1360, 1, 0, 0, 0, 1360, + 1364, 1, 0, 0, 0, 1361, 1359, 1, 0, 0, 0, 1362, 1363, 5, 81, 0, 0, 1363, + 1365, 3, 68, 34, 0, 1364, 1362, 1, 0, 0, 0, 1364, 1365, 1, 0, 0, 0, 1365, + 1367, 1, 0, 0, 0, 1366, 1352, 1, 0, 0, 0, 1366, 1367, 1, 0, 0, 0, 1367, + 1382, 1, 0, 0, 0, 1368, 1369, 5, 177, 0, 0, 1369, 1370, 3, 214, 107, 0, + 1370, 1371, 5, 35, 0, 0, 1371, 1379, 3, 118, 59, 0, 1372, 1373, 5, 5, 0, + 0, 1373, 1374, 3, 214, 107, 0, 1374, 1375, 5, 35, 0, 0, 1375, 1376, 3, + 118, 59, 0, 1376, 1378, 1, 0, 0, 0, 1377, 1372, 1, 0, 0, 0, 1378, 1381, + 1, 0, 0, 0, 1379, 1377, 1, 0, 0, 0, 1379, 1380, 1, 0, 0, 0, 1380, 1383, + 1, 0, 0, 0, 1381, 1379, 1, 0, 0, 0, 1382, 1368, 1, 0, 0, 0, 1382, 1383, + 1, 0, 0, 0, 1383, 1413, 1, 0, 0, 0, 1384, 1385, 5, 147, 0, 0, 1385, 1386, + 5, 3, 0, 0, 1386, 1391, 3, 68, 34, 0, 1387, 1388, 5, 5, 0, 0, 1388, 1390, + 3, 68, 34, 0, 1389, 1387, 1, 0, 0, 0, 1390, 1393, 1, 0, 0, 0, 1391, 1389, + 1, 0, 0, 0, 1391, 1392, 1, 0, 0, 0, 1392, 1394, 1, 0, 0, 0, 1393, 1391, + 1, 0, 0, 0, 1394, 1409, 5, 4, 0, 0, 1395, 1396, 5, 5, 0, 0, 1396, 1397, + 5, 3, 0, 0, 1397, 1402, 3, 68, 34, 0, 1398, 1399, 5, 5, 0, 0, 1399, 1401, + 3, 68, 34, 0, 1400, 1398, 1, 0, 0, 0, 1401, 1404, 1, 0, 0, 0, 1402, 1400, + 1, 0, 0, 0, 1402, 1403, 1, 0, 0, 0, 1403, 1405, 1, 0, 0, 0, 1404, 1402, + 1, 0, 0, 0, 1405, 1406, 5, 4, 0, 0, 1406, 1408, 1, 0, 0, 0, 1407, 1395, + 1, 0, 0, 0, 1408, 1411, 1, 0, 0, 0, 1409, 1407, 1, 0, 0, 0, 1409, 1410, + 1, 0, 0, 0, 1410, 1413, 1, 0, 0, 0, 1411, 1409, 1, 0, 0, 0, 1412, 1322, + 1, 0, 0, 0, 1412, 1384, 1, 0, 0, 0, 1413, 89, 1, 0, 0, 0, 1414, 1415, 3, + 84, 42, 0, 1415, 91, 1, 0, 0, 0, 1416, 1418, 3, 132, 66, 0, 1417, 1416, + 1, 0, 0, 0, 1417, 1418, 1, 0, 0, 0, 1418, 1419, 1, 0, 0, 0, 1419, 1421, + 3, 88, 44, 0, 1420, 1422, 3, 134, 67, 0, 1421, 1420, 1, 0, 0, 0, 1421, + 1422, 1, 0, 0, 0, 1422, 1424, 1, 0, 0, 0, 1423, 1425, 3, 136, 68, 0, 1424, + 1423, 1, 0, 0, 0, 1424, 1425, 1, 0, 0, 0, 1425, 93, 1, 0, 0, 0, 1426, 1428, + 3, 132, 66, 0, 1427, 1426, 1, 0, 0, 0, 1427, 1428, 1, 0, 0, 0, 1428, 1429, + 1, 0, 0, 0, 1429, 1439, 3, 88, 44, 0, 1430, 1432, 5, 142, 0, 0, 1431, 1433, + 5, 31, 0, 0, 1432, 1431, 1, 0, 0, 0, 1432, 1433, 1, 0, 0, 0, 1433, 1437, + 1, 0, 0, 0, 1434, 1437, 5, 92, 0, 0, 1435, 1437, 5, 70, 0, 0, 1436, 1430, + 1, 0, 0, 0, 1436, 1434, 1, 0, 0, 0, 1436, 1435, 1, 0, 0, 0, 1437, 1438, + 1, 0, 0, 0, 1438, 1440, 3, 88, 44, 0, 1439, 1436, 1, 0, 0, 0, 1440, 1441, + 1, 0, 0, 0, 1441, 1439, 1, 0, 0, 0, 1441, 1442, 1, 0, 0, 0, 1442, 1444, + 1, 0, 0, 0, 1443, 1445, 3, 134, 67, 0, 1444, 1443, 1, 0, 0, 0, 1444, 1445, + 1, 0, 0, 0, 1445, 1447, 1, 0, 0, 0, 1446, 1448, 3, 136, 68, 0, 1447, 1446, + 1, 0, 0, 0, 1447, 1448, 1, 0, 0, 0, 1448, 95, 1, 0, 0, 0, 1449, 1450, 3, + 182, 91, 0, 1450, 1451, 5, 2, 0, 0, 1451, 1453, 1, 0, 0, 0, 1452, 1449, + 1, 0, 0, 0, 1452, 1453, 1, 0, 0, 0, 1453, 1454, 1, 0, 0, 0, 1454, 1459, + 3, 184, 92, 0, 1455, 1457, 5, 35, 0, 0, 1456, 1455, 1, 0, 0, 0, 1456, 1457, + 1, 0, 0, 0, 1457, 1458, 1, 0, 0, 0, 1458, 1460, 3, 208, 104, 0, 1459, 1456, + 1, 0, 0, 0, 1459, 1460, 1, 0, 0, 0, 1460, 1466, 1, 0, 0, 0, 1461, 1462, + 5, 87, 0, 0, 1462, 1463, 5, 42, 0, 0, 1463, 1467, 3, 196, 98, 0, 1464, + 1465, 5, 104, 0, 0, 1465, 1467, 5, 87, 0, 0, 1466, 1461, 1, 0, 0, 0, 1466, + 1464, 1, 0, 0, 0, 1466, 1467, 1, 0, 0, 0, 1467, 1578, 1, 0, 0, 0, 1468, + 1469, 3, 182, 91, 0, 1469, 1470, 5, 2, 0, 0, 1470, 1472, 1, 0, 0, 0, 1471, + 1468, 1, 0, 0, 0, 1471, 1472, 1, 0, 0, 0, 1472, 1473, 1, 0, 0, 0, 1473, + 1474, 3, 226, 113, 0, 1474, 1475, 5, 3, 0, 0, 1475, 1480, 3, 68, 34, 0, + 1476, 1477, 5, 5, 0, 0, 1477, 1479, 3, 68, 34, 0, 1478, 1476, 1, 0, 0, + 0, 1479, 1482, 1, 0, 0, 0, 1480, 1478, 1, 0, 0, 0, 1480, 1481, 1, 0, 0, + 0, 1481, 1483, 1, 0, 0, 0, 1482, 1480, 1, 0, 0, 0, 1483, 1488, 5, 4, 0, + 0, 1484, 1486, 5, 35, 0, 0, 1485, 1484, 1, 0, 0, 0, 1485, 1486, 1, 0, 0, + 0, 1486, 1487, 1, 0, 0, 0, 1487, 1489, 3, 208, 104, 0, 1488, 1485, 1, 0, + 0, 0, 1488, 1489, 1, 0, 0, 0, 1489, 1578, 1, 0, 0, 0, 1490, 1500, 5, 3, + 0, 0, 1491, 1496, 3, 96, 48, 0, 1492, 1493, 5, 5, 0, 0, 1493, 1495, 3, + 96, 48, 0, 1494, 1492, 1, 0, 0, 0, 1495, 1498, 1, 0, 0, 0, 1496, 1494, + 1, 0, 0, 0, 1496, 1497, 1, 0, 0, 0, 1497, 1501, 1, 0, 0, 0, 1498, 1496, + 1, 0, 0, 0, 1499, 1501, 3, 86, 43, 0, 1500, 1491, 1, 0, 0, 0, 1500, 1499, + 1, 0, 0, 0, 1501, 1502, 1, 0, 0, 0, 1502, 1503, 5, 4, 0, 0, 1503, 1578, + 1, 0, 0, 0, 1504, 1505, 5, 3, 0, 0, 1505, 1506, 3, 84, 42, 0, 1506, 1511, + 5, 4, 0, 0, 1507, 1509, 5, 35, 0, 0, 1508, 1507, 1, 0, 0, 0, 1508, 1509, + 1, 0, 0, 0, 1509, 1510, 1, 0, 0, 0, 1510, 1512, 3, 208, 104, 0, 1511, 1508, + 1, 0, 0, 0, 1511, 1512, 1, 0, 0, 0, 1512, 1578, 1, 0, 0, 0, 1513, 1514, + 3, 182, 91, 0, 1514, 1515, 5, 2, 0, 0, 1515, 1517, 1, 0, 0, 0, 1516, 1513, + 1, 0, 0, 0, 1516, 1517, 1, 0, 0, 0, 1517, 1518, 1, 0, 0, 0, 1518, 1523, + 3, 184, 92, 0, 1519, 1521, 5, 35, 0, 0, 1520, 1519, 1, 0, 0, 0, 1520, 1521, + 1, 0, 0, 0, 1521, 1522, 1, 0, 0, 0, 1522, 1524, 3, 210, 105, 0, 1523, 1520, + 1, 0, 0, 0, 1523, 1524, 1, 0, 0, 0, 1524, 1530, 1, 0, 0, 0, 1525, 1526, + 5, 87, 0, 0, 1526, 1527, 5, 42, 0, 0, 1527, 1531, 3, 196, 98, 0, 1528, + 1529, 5, 104, 0, 0, 1529, 1531, 5, 87, 0, 0, 1530, 1525, 1, 0, 0, 0, 1530, + 1528, 1, 0, 0, 0, 1530, 1531, 1, 0, 0, 0, 1531, 1578, 1, 0, 0, 0, 1532, + 1533, 3, 182, 91, 0, 1533, 1534, 5, 2, 0, 0, 1534, 1536, 1, 0, 0, 0, 1535, + 1532, 1, 0, 0, 0, 1535, 1536, 1, 0, 0, 0, 1536, 1537, 1, 0, 0, 0, 1537, + 1538, 3, 226, 113, 0, 1538, 1539, 5, 3, 0, 0, 1539, 1544, 3, 68, 34, 0, + 1540, 1541, 5, 5, 0, 0, 1541, 1543, 3, 68, 34, 0, 1542, 1540, 1, 0, 0, + 0, 1543, 1546, 1, 0, 0, 0, 1544, 1542, 1, 0, 0, 0, 1544, 1545, 1, 0, 0, + 0, 1545, 1547, 1, 0, 0, 0, 1546, 1544, 1, 0, 0, 0, 1547, 1552, 5, 4, 0, + 0, 1548, 1550, 5, 35, 0, 0, 1549, 1548, 1, 0, 0, 0, 1549, 1550, 1, 0, 0, + 0, 1550, 1551, 1, 0, 0, 0, 1551, 1553, 3, 210, 105, 0, 1552, 1549, 1, 0, + 0, 0, 1552, 1553, 1, 0, 0, 0, 1553, 1578, 1, 0, 0, 0, 1554, 1564, 5, 3, + 0, 0, 1555, 1560, 3, 96, 48, 0, 1556, 1557, 5, 5, 0, 0, 1557, 1559, 3, + 96, 48, 0, 1558, 1556, 1, 0, 0, 0, 1559, 1562, 1, 0, 0, 0, 1560, 1558, + 1, 0, 0, 0, 1560, 1561, 1, 0, 0, 0, 1561, 1565, 1, 0, 0, 0, 1562, 1560, + 1, 0, 0, 0, 1563, 1565, 3, 86, 43, 0, 1564, 1555, 1, 0, 0, 0, 1564, 1563, + 1, 0, 0, 0, 1565, 1566, 1, 0, 0, 0, 1566, 1567, 5, 4, 0, 0, 1567, 1578, + 1, 0, 0, 0, 1568, 1569, 5, 3, 0, 0, 1569, 1570, 3, 84, 42, 0, 1570, 1575, + 5, 4, 0, 0, 1571, 1573, 5, 35, 0, 0, 1572, 1571, 1, 0, 0, 0, 1572, 1573, + 1, 0, 0, 0, 1573, 1574, 1, 0, 0, 0, 1574, 1576, 3, 210, 105, 0, 1575, 1572, + 1, 0, 0, 0, 1575, 1576, 1, 0, 0, 0, 1576, 1578, 1, 0, 0, 0, 1577, 1452, + 1, 0, 0, 0, 1577, 1471, 1, 0, 0, 0, 1577, 1490, 1, 0, 0, 0, 1577, 1504, + 1, 0, 0, 0, 1577, 1516, 1, 0, 0, 0, 1577, 1535, 1, 0, 0, 0, 1577, 1554, + 1, 0, 0, 0, 1577, 1568, 1, 0, 0, 0, 1578, 97, 1, 0, 0, 0, 1579, 1592, 5, + 7, 0, 0, 1580, 1581, 3, 184, 92, 0, 1581, 1582, 5, 2, 0, 0, 1582, 1583, + 5, 7, 0, 0, 1583, 1592, 1, 0, 0, 0, 1584, 1589, 3, 68, 34, 0, 1585, 1587, + 5, 35, 0, 0, 1586, 1585, 1, 0, 0, 0, 1586, 1587, 1, 0, 0, 0, 1587, 1588, + 1, 0, 0, 0, 1588, 1590, 3, 172, 86, 0, 1589, 1586, 1, 0, 0, 0, 1589, 1590, + 1, 0, 0, 0, 1590, 1592, 1, 0, 0, 0, 1591, 1579, 1, 0, 0, 0, 1591, 1580, + 1, 0, 0, 0, 1591, 1584, 1, 0, 0, 0, 1592, 99, 1, 0, 0, 0, 1593, 1608, 5, + 5, 0, 0, 1594, 1596, 5, 102, 0, 0, 1595, 1594, 1, 0, 0, 0, 1595, 1596, + 1, 0, 0, 0, 1596, 1602, 1, 0, 0, 0, 1597, 1599, 7, 18, 0, 0, 1598, 1600, + 5, 112, 0, 0, 1599, 1598, 1, 0, 0, 0, 1599, 1600, 1, 0, 0, 0, 1600, 1603, + 1, 0, 0, 0, 1601, 1603, 5, 89, 0, 0, 1602, 1597, 1, 0, 0, 0, 1602, 1601, + 1, 0, 0, 0, 1602, 1603, 1, 0, 0, 0, 1603, 1604, 1, 0, 0, 0, 1604, 1608, + 5, 96, 0, 0, 1605, 1606, 5, 53, 0, 0, 1606, 1608, 5, 96, 0, 0, 1607, 1593, + 1, 0, 0, 0, 1607, 1595, 1, 0, 0, 0, 1607, 1605, 1, 0, 0, 0, 1608, 101, + 1, 0, 0, 0, 1609, 1610, 5, 109, 0, 0, 1610, 1624, 3, 68, 34, 0, 1611, 1612, + 5, 145, 0, 0, 1612, 1613, 5, 3, 0, 0, 1613, 1618, 3, 190, 95, 0, 1614, + 1615, 5, 5, 0, 0, 1615, 1617, 3, 190, 95, 0, 1616, 1614, 1, 0, 0, 0, 1617, + 1620, 1, 0, 0, 0, 1618, 1616, 1, 0, 0, 0, 1618, 1619, 1, 0, 0, 0, 1619, + 1621, 1, 0, 0, 0, 1620, 1618, 1, 0, 0, 0, 1621, 1622, 5, 4, 0, 0, 1622, + 1624, 1, 0, 0, 0, 1623, 1609, 1, 0, 0, 0, 1623, 1611, 1, 0, 0, 0, 1623, + 1624, 1, 0, 0, 0, 1624, 103, 1, 0, 0, 0, 1625, 1627, 5, 142, 0, 0, 1626, + 1628, 5, 31, 0, 0, 1627, 1626, 1, 0, 0, 0, 1627, 1628, 1, 0, 0, 0, 1628, + 1632, 1, 0, 0, 0, 1629, 1632, 5, 92, 0, 0, 1630, 1632, 5, 70, 0, 0, 1631, + 1625, 1, 0, 0, 0, 1631, 1629, 1, 0, 0, 0, 1631, 1630, 1, 0, 0, 0, 1632, + 105, 1, 0, 0, 0, 1633, 1635, 3, 50, 25, 0, 1634, 1633, 1, 0, 0, 0, 1634, + 1635, 1, 0, 0, 0, 1635, 1636, 1, 0, 0, 0, 1636, 1639, 5, 144, 0, 0, 1637, + 1638, 5, 110, 0, 0, 1638, 1640, 7, 8, 0, 0, 1639, 1637, 1, 0, 0, 0, 1639, + 1640, 1, 0, 0, 0, 1640, 1641, 1, 0, 0, 0, 1641, 1642, 3, 112, 56, 0, 1642, + 1645, 5, 133, 0, 0, 1643, 1646, 3, 190, 95, 0, 1644, 1646, 3, 108, 54, + 0, 1645, 1643, 1, 0, 0, 0, 1645, 1644, 1, 0, 0, 0, 1646, 1647, 1, 0, 0, + 0, 1647, 1648, 5, 6, 0, 0, 1648, 1659, 3, 68, 34, 0, 1649, 1652, 5, 5, + 0, 0, 1650, 1653, 3, 190, 95, 0, 1651, 1653, 3, 108, 54, 0, 1652, 1650, + 1, 0, 0, 0, 1652, 1651, 1, 0, 0, 0, 1653, 1654, 1, 0, 0, 0, 1654, 1655, + 5, 6, 0, 0, 1655, 1656, 3, 68, 34, 0, 1656, 1658, 1, 0, 0, 0, 1657, 1649, + 1, 0, 0, 0, 1658, 1661, 1, 0, 0, 0, 1659, 1657, 1, 0, 0, 0, 1659, 1660, + 1, 0, 0, 0, 1660, 1664, 1, 0, 0, 0, 1661, 1659, 1, 0, 0, 0, 1662, 1663, + 5, 151, 0, 0, 1663, 1665, 3, 68, 34, 0, 1664, 1662, 1, 0, 0, 0, 1664, 1665, + 1, 0, 0, 0, 1665, 1667, 1, 0, 0, 0, 1666, 1668, 3, 58, 29, 0, 1667, 1666, + 1, 0, 0, 0, 1667, 1668, 1, 0, 0, 0, 1668, 107, 1, 0, 0, 0, 1669, 1670, + 5, 3, 0, 0, 1670, 1675, 3, 190, 95, 0, 1671, 1672, 5, 5, 0, 0, 1672, 1674, + 3, 190, 95, 0, 1673, 1671, 1, 0, 0, 0, 1674, 1677, 1, 0, 0, 0, 1675, 1673, + 1, 0, 0, 0, 1675, 1676, 1, 0, 0, 0, 1676, 1678, 1, 0, 0, 0, 1677, 1675, + 1, 0, 0, 0, 1678, 1679, 5, 4, 0, 0, 1679, 109, 1, 0, 0, 0, 1680, 1682, + 3, 50, 25, 0, 1681, 1680, 1, 0, 0, 0, 1681, 1682, 1, 0, 0, 0, 1682, 1683, + 1, 0, 0, 0, 1683, 1686, 5, 144, 0, 0, 1684, 1685, 5, 110, 0, 0, 1685, 1687, + 7, 8, 0, 0, 1686, 1684, 1, 0, 0, 0, 1686, 1687, 1, 0, 0, 0, 1687, 1688, + 1, 0, 0, 0, 1688, 1689, 3, 112, 56, 0, 1689, 1692, 5, 133, 0, 0, 1690, + 1693, 3, 190, 95, 0, 1691, 1693, 3, 108, 54, 0, 1692, 1690, 1, 0, 0, 0, + 1692, 1691, 1, 0, 0, 0, 1693, 1694, 1, 0, 0, 0, 1694, 1695, 5, 6, 0, 0, + 1695, 1706, 3, 68, 34, 0, 1696, 1699, 5, 5, 0, 0, 1697, 1700, 3, 190, 95, + 0, 1698, 1700, 3, 108, 54, 0, 1699, 1697, 1, 0, 0, 0, 1699, 1698, 1, 0, + 0, 0, 1700, 1701, 1, 0, 0, 0, 1701, 1702, 5, 6, 0, 0, 1702, 1703, 3, 68, + 34, 0, 1703, 1705, 1, 0, 0, 0, 1704, 1696, 1, 0, 0, 0, 1705, 1708, 1, 0, + 0, 0, 1706, 1704, 1, 0, 0, 0, 1706, 1707, 1, 0, 0, 0, 1707, 1711, 1, 0, + 0, 0, 1708, 1706, 1, 0, 0, 0, 1709, 1710, 5, 151, 0, 0, 1710, 1712, 3, + 68, 34, 0, 1711, 1709, 1, 0, 0, 0, 1711, 1712, 1, 0, 0, 0, 1712, 1717, + 1, 0, 0, 0, 1713, 1715, 3, 134, 67, 0, 1714, 1713, 1, 0, 0, 0, 1714, 1715, + 1, 0, 0, 0, 1715, 1716, 1, 0, 0, 0, 1716, 1718, 3, 136, 68, 0, 1717, 1714, + 1, 0, 0, 0, 1717, 1718, 1, 0, 0, 0, 1718, 111, 1, 0, 0, 0, 1719, 1720, + 3, 182, 91, 0, 1720, 1721, 5, 2, 0, 0, 1721, 1723, 1, 0, 0, 0, 1722, 1719, + 1, 0, 0, 0, 1722, 1723, 1, 0, 0, 0, 1723, 1724, 1, 0, 0, 0, 1724, 1727, + 3, 184, 92, 0, 1725, 1726, 5, 35, 0, 0, 1726, 1728, 3, 216, 108, 0, 1727, + 1725, 1, 0, 0, 0, 1727, 1728, 1, 0, 0, 0, 1728, 1734, 1, 0, 0, 0, 1729, + 1730, 5, 87, 0, 0, 1730, 1731, 5, 42, 0, 0, 1731, 1735, 3, 196, 98, 0, + 1732, 1733, 5, 104, 0, 0, 1733, 1735, 5, 87, 0, 0, 1734, 1729, 1, 0, 0, + 0, 1734, 1732, 1, 0, 0, 0, 1734, 1735, 1, 0, 0, 0, 1735, 113, 1, 0, 0, + 0, 1736, 1738, 5, 146, 0, 0, 1737, 1739, 3, 182, 91, 0, 1738, 1737, 1, + 0, 0, 0, 1738, 1739, 1, 0, 0, 0, 1739, 1742, 1, 0, 0, 0, 1740, 1741, 5, + 93, 0, 0, 1741, 1743, 3, 218, 109, 0, 1742, 1740, 1, 0, 0, 0, 1742, 1743, + 1, 0, 0, 0, 1743, 115, 1, 0, 0, 0, 1744, 1745, 5, 181, 0, 0, 1745, 1746, + 5, 3, 0, 0, 1746, 1747, 5, 151, 0, 0, 1747, 1748, 3, 68, 34, 0, 1748, 1749, + 5, 4, 0, 0, 1749, 117, 1, 0, 0, 0, 1750, 1752, 5, 3, 0, 0, 1751, 1753, + 3, 220, 110, 0, 1752, 1751, 1, 0, 0, 0, 1752, 1753, 1, 0, 0, 0, 1753, 1764, + 1, 0, 0, 0, 1754, 1755, 5, 156, 0, 0, 1755, 1756, 5, 42, 0, 0, 1756, 1761, + 3, 68, 34, 0, 1757, 1758, 5, 5, 0, 0, 1758, 1760, 3, 68, 34, 0, 1759, 1757, + 1, 0, 0, 0, 1760, 1763, 1, 0, 0, 0, 1761, 1759, 1, 0, 0, 0, 1761, 1762, + 1, 0, 0, 0, 1762, 1765, 1, 0, 0, 0, 1763, 1761, 1, 0, 0, 0, 1764, 1754, + 1, 0, 0, 0, 1764, 1765, 1, 0, 0, 0, 1765, 1766, 1, 0, 0, 0, 1766, 1767, + 5, 111, 0, 0, 1767, 1768, 5, 42, 0, 0, 1768, 1773, 3, 138, 69, 0, 1769, + 1770, 5, 5, 0, 0, 1770, 1772, 3, 138, 69, 0, 1771, 1769, 1, 0, 0, 0, 1772, + 1775, 1, 0, 0, 0, 1773, 1771, 1, 0, 0, 0, 1773, 1774, 1, 0, 0, 0, 1774, + 1777, 1, 0, 0, 0, 1775, 1773, 1, 0, 0, 0, 1776, 1778, 3, 122, 61, 0, 1777, + 1776, 1, 0, 0, 0, 1777, 1778, 1, 0, 0, 0, 1778, 1779, 1, 0, 0, 0, 1779, + 1780, 5, 4, 0, 0, 1780, 119, 1, 0, 0, 0, 1781, 1815, 5, 155, 0, 0, 1782, + 1816, 3, 214, 107, 0, 1783, 1785, 5, 3, 0, 0, 1784, 1786, 3, 220, 110, + 0, 1785, 1784, 1, 0, 0, 0, 1785, 1786, 1, 0, 0, 0, 1786, 1797, 1, 0, 0, + 0, 1787, 1788, 5, 156, 0, 0, 1788, 1789, 5, 42, 0, 0, 1789, 1794, 3, 68, + 34, 0, 1790, 1791, 5, 5, 0, 0, 1791, 1793, 3, 68, 34, 0, 1792, 1790, 1, + 0, 0, 0, 1793, 1796, 1, 0, 0, 0, 1794, 1792, 1, 0, 0, 0, 1794, 1795, 1, + 0, 0, 0, 1795, 1798, 1, 0, 0, 0, 1796, 1794, 1, 0, 0, 0, 1797, 1787, 1, + 0, 0, 0, 1797, 1798, 1, 0, 0, 0, 1798, 1809, 1, 0, 0, 0, 1799, 1800, 5, + 111, 0, 0, 1800, 1801, 5, 42, 0, 0, 1801, 1806, 3, 138, 69, 0, 1802, 1803, + 5, 5, 0, 0, 1803, 1805, 3, 138, 69, 0, 1804, 1802, 1, 0, 0, 0, 1805, 1808, + 1, 0, 0, 0, 1806, 1804, 1, 0, 0, 0, 1806, 1807, 1, 0, 0, 0, 1807, 1810, + 1, 0, 0, 0, 1808, 1806, 1, 0, 0, 0, 1809, 1799, 1, 0, 0, 0, 1809, 1810, + 1, 0, 0, 0, 1810, 1812, 1, 0, 0, 0, 1811, 1813, 3, 122, 61, 0, 1812, 1811, + 1, 0, 0, 0, 1812, 1813, 1, 0, 0, 0, 1813, 1814, 1, 0, 0, 0, 1814, 1816, + 5, 4, 0, 0, 1815, 1782, 1, 0, 0, 0, 1815, 1783, 1, 0, 0, 0, 1816, 121, + 1, 0, 0, 0, 1817, 1825, 3, 124, 62, 0, 1818, 1819, 5, 183, 0, 0, 1819, + 1820, 5, 103, 0, 0, 1820, 1826, 5, 185, 0, 0, 1821, 1822, 5, 160, 0, 0, + 1822, 1826, 5, 129, 0, 0, 1823, 1826, 5, 80, 0, 0, 1824, 1826, 5, 184, + 0, 0, 1825, 1818, 1, 0, 0, 0, 1825, 1821, 1, 0, 0, 0, 1825, 1823, 1, 0, + 0, 0, 1825, 1824, 1, 0, 0, 0, 1825, 1826, 1, 0, 0, 0, 1826, 123, 1, 0, + 0, 0, 1827, 1834, 7, 19, 0, 0, 1828, 1835, 3, 146, 73, 0, 1829, 1830, 5, + 41, 0, 0, 1830, 1831, 3, 142, 71, 0, 1831, 1832, 5, 34, 0, 0, 1832, 1833, + 3, 144, 72, 0, 1833, 1835, 1, 0, 0, 0, 1834, 1828, 1, 0, 0, 0, 1834, 1829, + 1, 0, 0, 0, 1835, 125, 1, 0, 0, 0, 1836, 1837, 3, 222, 111, 0, 1837, 1847, + 5, 3, 0, 0, 1838, 1843, 3, 68, 34, 0, 1839, 1840, 5, 5, 0, 0, 1840, 1842, + 3, 68, 34, 0, 1841, 1839, 1, 0, 0, 0, 1842, 1845, 1, 0, 0, 0, 1843, 1841, + 1, 0, 0, 0, 1843, 1844, 1, 0, 0, 0, 1844, 1848, 1, 0, 0, 0, 1845, 1843, + 1, 0, 0, 0, 1846, 1848, 5, 7, 0, 0, 1847, 1838, 1, 0, 0, 0, 1847, 1846, + 1, 0, 0, 0, 1848, 1849, 1, 0, 0, 0, 1849, 1850, 5, 4, 0, 0, 1850, 127, + 1, 0, 0, 0, 1851, 1852, 3, 224, 112, 0, 1852, 1865, 5, 3, 0, 0, 1853, 1855, + 5, 64, 0, 0, 1854, 1853, 1, 0, 0, 0, 1854, 1855, 1, 0, 0, 0, 1855, 1856, + 1, 0, 0, 0, 1856, 1861, 3, 68, 34, 0, 1857, 1858, 5, 5, 0, 0, 1858, 1860, + 3, 68, 34, 0, 1859, 1857, 1, 0, 0, 0, 1860, 1863, 1, 0, 0, 0, 1861, 1859, + 1, 0, 0, 0, 1861, 1862, 1, 0, 0, 0, 1862, 1866, 1, 0, 0, 0, 1863, 1861, + 1, 0, 0, 0, 1864, 1866, 5, 7, 0, 0, 1865, 1854, 1, 0, 0, 0, 1865, 1864, + 1, 0, 0, 0, 1865, 1866, 1, 0, 0, 0, 1866, 1867, 1, 0, 0, 0, 1867, 1869, + 5, 4, 0, 0, 1868, 1870, 3, 116, 58, 0, 1869, 1868, 1, 0, 0, 0, 1869, 1870, + 1, 0, 0, 0, 1870, 129, 1, 0, 0, 0, 1871, 1872, 3, 148, 74, 0, 1872, 1882, + 5, 3, 0, 0, 1873, 1878, 3, 68, 34, 0, 1874, 1875, 5, 5, 0, 0, 1875, 1877, + 3, 68, 34, 0, 1876, 1874, 1, 0, 0, 0, 1877, 1880, 1, 0, 0, 0, 1878, 1876, + 1, 0, 0, 0, 1878, 1879, 1, 0, 0, 0, 1879, 1883, 1, 0, 0, 0, 1880, 1878, + 1, 0, 0, 0, 1881, 1883, 5, 7, 0, 0, 1882, 1873, 1, 0, 0, 0, 1882, 1881, + 1, 0, 0, 0, 1882, 1883, 1, 0, 0, 0, 1883, 1884, 1, 0, 0, 0, 1884, 1886, + 5, 4, 0, 0, 1885, 1887, 3, 116, 58, 0, 1886, 1885, 1, 0, 0, 0, 1886, 1887, + 1, 0, 0, 0, 1887, 1888, 1, 0, 0, 0, 1888, 1891, 5, 155, 0, 0, 1889, 1892, + 3, 118, 59, 0, 1890, 1892, 3, 214, 107, 0, 1891, 1889, 1, 0, 0, 0, 1891, + 1890, 1, 0, 0, 0, 1892, 131, 1, 0, 0, 0, 1893, 1895, 5, 152, 0, 0, 1894, + 1896, 5, 118, 0, 0, 1895, 1894, 1, 0, 0, 0, 1895, 1896, 1, 0, 0, 0, 1896, + 1897, 1, 0, 0, 0, 1897, 1902, 3, 56, 28, 0, 1898, 1899, 5, 5, 0, 0, 1899, + 1901, 3, 56, 28, 0, 1900, 1898, 1, 0, 0, 0, 1901, 1904, 1, 0, 0, 0, 1902, + 1900, 1, 0, 0, 0, 1902, 1903, 1, 0, 0, 0, 1903, 133, 1, 0, 0, 0, 1904, + 1902, 1, 0, 0, 0, 1905, 1906, 5, 111, 0, 0, 1906, 1907, 5, 42, 0, 0, 1907, + 1912, 3, 138, 69, 0, 1908, 1909, 5, 5, 0, 0, 1909, 1911, 3, 138, 69, 0, + 1910, 1908, 1, 0, 0, 0, 1911, 1914, 1, 0, 0, 0, 1912, 1910, 1, 0, 0, 0, + 1912, 1913, 1, 0, 0, 0, 1913, 135, 1, 0, 0, 0, 1914, 1912, 1, 0, 0, 0, + 1915, 1916, 5, 100, 0, 0, 1916, 1919, 3, 68, 34, 0, 1917, 1918, 7, 20, + 0, 0, 1918, 1920, 3, 68, 34, 0, 1919, 1917, 1, 0, 0, 0, 1919, 1920, 1, + 0, 0, 0, 1920, 137, 1, 0, 0, 0, 1921, 1924, 3, 68, 34, 0, 1922, 1923, 5, + 47, 0, 0, 1923, 1925, 3, 192, 96, 0, 1924, 1922, 1, 0, 0, 0, 1924, 1925, + 1, 0, 0, 0, 1925, 1927, 1, 0, 0, 0, 1926, 1928, 3, 140, 70, 0, 1927, 1926, + 1, 0, 0, 0, 1927, 1928, 1, 0, 0, 0, 1928, 1931, 1, 0, 0, 0, 1929, 1930, + 5, 178, 0, 0, 1930, 1932, 7, 21, 0, 0, 1931, 1929, 1, 0, 0, 0, 1931, 1932, + 1, 0, 0, 0, 1932, 139, 1, 0, 0, 0, 1933, 1934, 7, 22, 0, 0, 1934, 141, + 1, 0, 0, 0, 1935, 1936, 3, 68, 34, 0, 1936, 1937, 5, 158, 0, 0, 1937, 1946, + 1, 0, 0, 0, 1938, 1939, 3, 68, 34, 0, 1939, 1940, 5, 161, 0, 0, 1940, 1946, + 1, 0, 0, 0, 1941, 1942, 5, 160, 0, 0, 1942, 1946, 5, 129, 0, 0, 1943, 1944, + 5, 159, 0, 0, 1944, 1946, 5, 158, 0, 0, 1945, 1935, 1, 0, 0, 0, 1945, 1938, + 1, 0, 0, 0, 1945, 1941, 1, 0, 0, 0, 1945, 1943, 1, 0, 0, 0, 1946, 143, + 1, 0, 0, 0, 1947, 1948, 3, 68, 34, 0, 1948, 1949, 5, 158, 0, 0, 1949, 1958, + 1, 0, 0, 0, 1950, 1951, 3, 68, 34, 0, 1951, 1952, 5, 161, 0, 0, 1952, 1958, + 1, 0, 0, 0, 1953, 1954, 5, 160, 0, 0, 1954, 1958, 5, 129, 0, 0, 1955, 1956, + 5, 159, 0, 0, 1956, 1958, 5, 161, 0, 0, 1957, 1947, 1, 0, 0, 0, 1957, 1950, + 1, 0, 0, 0, 1957, 1953, 1, 0, 0, 0, 1957, 1955, 1, 0, 0, 0, 1958, 145, + 1, 0, 0, 0, 1959, 1960, 3, 68, 34, 0, 1960, 1961, 5, 158, 0, 0, 1961, 1967, + 1, 0, 0, 0, 1962, 1963, 5, 159, 0, 0, 1963, 1967, 5, 158, 0, 0, 1964, 1965, + 5, 160, 0, 0, 1965, 1967, 5, 129, 0, 0, 1966, 1959, 1, 0, 0, 0, 1966, 1962, + 1, 0, 0, 0, 1966, 1964, 1, 0, 0, 0, 1967, 147, 1, 0, 0, 0, 1968, 1969, + 7, 23, 0, 0, 1969, 1970, 5, 3, 0, 0, 1970, 1971, 3, 68, 34, 0, 1971, 1972, + 5, 4, 0, 0, 1972, 1973, 5, 155, 0, 0, 1973, 1975, 5, 3, 0, 0, 1974, 1976, + 3, 154, 77, 0, 1975, 1974, 1, 0, 0, 0, 1975, 1976, 1, 0, 0, 0, 1976, 1977, + 1, 0, 0, 0, 1977, 1979, 3, 158, 79, 0, 1978, 1980, 3, 124, 62, 0, 1979, + 1978, 1, 0, 0, 0, 1979, 1980, 1, 0, 0, 0, 1980, 1981, 1, 0, 0, 0, 1981, + 1982, 5, 4, 0, 0, 1982, 2054, 1, 0, 0, 0, 1983, 1984, 7, 24, 0, 0, 1984, + 1985, 5, 3, 0, 0, 1985, 1986, 5, 4, 0, 0, 1986, 1987, 5, 155, 0, 0, 1987, + 1989, 5, 3, 0, 0, 1988, 1990, 3, 154, 77, 0, 1989, 1988, 1, 0, 0, 0, 1989, + 1990, 1, 0, 0, 0, 1990, 1992, 1, 0, 0, 0, 1991, 1993, 3, 156, 78, 0, 1992, + 1991, 1, 0, 0, 0, 1992, 1993, 1, 0, 0, 0, 1993, 1994, 1, 0, 0, 0, 1994, + 2054, 5, 4, 0, 0, 1995, 1996, 7, 25, 0, 0, 1996, 1997, 5, 3, 0, 0, 1997, + 1998, 5, 4, 0, 0, 1998, 1999, 5, 155, 0, 0, 1999, 2001, 5, 3, 0, 0, 2000, + 2002, 3, 154, 77, 0, 2001, 2000, 1, 0, 0, 0, 2001, 2002, 1, 0, 0, 0, 2002, + 2003, 1, 0, 0, 0, 2003, 2004, 3, 158, 79, 0, 2004, 2005, 5, 4, 0, 0, 2005, + 2054, 1, 0, 0, 0, 2006, 2007, 7, 26, 0, 0, 2007, 2008, 5, 3, 0, 0, 2008, + 2010, 3, 68, 34, 0, 2009, 2011, 3, 150, 75, 0, 2010, 2009, 1, 0, 0, 0, + 2010, 2011, 1, 0, 0, 0, 2011, 2013, 1, 0, 0, 0, 2012, 2014, 3, 152, 76, + 0, 2013, 2012, 1, 0, 0, 0, 2013, 2014, 1, 0, 0, 0, 2014, 2015, 1, 0, 0, + 0, 2015, 2016, 5, 4, 0, 0, 2016, 2017, 5, 155, 0, 0, 2017, 2019, 5, 3, + 0, 0, 2018, 2020, 3, 154, 77, 0, 2019, 2018, 1, 0, 0, 0, 2019, 2020, 1, + 0, 0, 0, 2020, 2021, 1, 0, 0, 0, 2021, 2022, 3, 158, 79, 0, 2022, 2023, + 5, 4, 0, 0, 2023, 2054, 1, 0, 0, 0, 2024, 2025, 5, 167, 0, 0, 2025, 2026, + 5, 3, 0, 0, 2026, 2027, 3, 68, 34, 0, 2027, 2028, 5, 5, 0, 0, 2028, 2029, + 3, 36, 18, 0, 2029, 2030, 5, 4, 0, 0, 2030, 2031, 5, 155, 0, 0, 2031, 2033, + 5, 3, 0, 0, 2032, 2034, 3, 154, 77, 0, 2033, 2032, 1, 0, 0, 0, 2033, 2034, + 1, 0, 0, 0, 2034, 2035, 1, 0, 0, 0, 2035, 2037, 3, 158, 79, 0, 2036, 2038, + 3, 124, 62, 0, 2037, 2036, 1, 0, 0, 0, 2037, 2038, 1, 0, 0, 0, 2038, 2039, + 1, 0, 0, 0, 2039, 2040, 5, 4, 0, 0, 2040, 2054, 1, 0, 0, 0, 2041, 2042, + 5, 168, 0, 0, 2042, 2043, 5, 3, 0, 0, 2043, 2044, 3, 68, 34, 0, 2044, 2045, + 5, 4, 0, 0, 2045, 2046, 5, 155, 0, 0, 2046, 2048, 5, 3, 0, 0, 2047, 2049, + 3, 154, 77, 0, 2048, 2047, 1, 0, 0, 0, 2048, 2049, 1, 0, 0, 0, 2049, 2050, + 1, 0, 0, 0, 2050, 2051, 3, 158, 79, 0, 2051, 2052, 5, 4, 0, 0, 2052, 2054, + 1, 0, 0, 0, 2053, 1968, 1, 0, 0, 0, 2053, 1983, 1, 0, 0, 0, 2053, 1995, + 1, 0, 0, 0, 2053, 2006, 1, 0, 0, 0, 2053, 2024, 1, 0, 0, 0, 2053, 2041, + 1, 0, 0, 0, 2054, 149, 1, 0, 0, 0, 2055, 2056, 5, 5, 0, 0, 2056, 2057, + 3, 36, 18, 0, 2057, 151, 1, 0, 0, 0, 2058, 2059, 5, 5, 0, 0, 2059, 2060, + 3, 36, 18, 0, 2060, 153, 1, 0, 0, 0, 2061, 2062, 5, 156, 0, 0, 2062, 2064, + 5, 42, 0, 0, 2063, 2065, 3, 68, 34, 0, 2064, 2063, 1, 0, 0, 0, 2065, 2066, + 1, 0, 0, 0, 2066, 2064, 1, 0, 0, 0, 2066, 2067, 1, 0, 0, 0, 2067, 155, + 1, 0, 0, 0, 2068, 2069, 5, 111, 0, 0, 2069, 2071, 5, 42, 0, 0, 2070, 2072, + 3, 68, 34, 0, 2071, 2070, 1, 0, 0, 0, 2072, 2073, 1, 0, 0, 0, 2073, 2071, + 1, 0, 0, 0, 2073, 2074, 1, 0, 0, 0, 2074, 157, 1, 0, 0, 0, 2075, 2076, + 5, 111, 0, 0, 2076, 2077, 5, 42, 0, 0, 2077, 2078, 3, 158, 79, 0, 2078, + 159, 1, 0, 0, 0, 2079, 2081, 3, 68, 34, 0, 2080, 2082, 3, 140, 70, 0, 2081, + 2080, 1, 0, 0, 0, 2081, 2082, 1, 0, 0, 0, 2082, 2090, 1, 0, 0, 0, 2083, + 2084, 5, 5, 0, 0, 2084, 2086, 3, 68, 34, 0, 2085, 2087, 3, 140, 70, 0, + 2086, 2085, 1, 0, 0, 0, 2086, 2087, 1, 0, 0, 0, 2087, 2089, 1, 0, 0, 0, + 2088, 2083, 1, 0, 0, 0, 2089, 2092, 1, 0, 0, 0, 2090, 2088, 1, 0, 0, 0, + 2090, 2091, 1, 0, 0, 0, 2091, 161, 1, 0, 0, 0, 2092, 2090, 1, 0, 0, 0, + 2093, 2094, 3, 84, 42, 0, 2094, 163, 1, 0, 0, 0, 2095, 2096, 3, 84, 42, + 0, 2096, 165, 1, 0, 0, 0, 2097, 2098, 7, 27, 0, 0, 2098, 167, 1, 0, 0, + 0, 2099, 2100, 5, 192, 0, 0, 2100, 169, 1, 0, 0, 0, 2101, 2104, 3, 68, + 34, 0, 2102, 2104, 3, 30, 15, 0, 2103, 2101, 1, 0, 0, 0, 2103, 2102, 1, + 0, 0, 0, 2104, 171, 1, 0, 0, 0, 2105, 2106, 7, 28, 0, 0, 2106, 173, 1, + 0, 0, 0, 2107, 2108, 7, 29, 0, 0, 2108, 175, 1, 0, 0, 0, 2109, 2110, 3, + 228, 114, 0, 2110, 177, 1, 0, 0, 0, 2111, 2112, 3, 228, 114, 0, 2112, 179, + 1, 0, 0, 0, 2113, 2114, 3, 182, 91, 0, 2114, 2115, 5, 2, 0, 0, 2115, 2117, + 1, 0, 0, 0, 2116, 2113, 1, 0, 0, 0, 2116, 2117, 1, 0, 0, 0, 2117, 2118, + 1, 0, 0, 0, 2118, 2119, 3, 178, 89, 0, 2119, 181, 1, 0, 0, 0, 2120, 2121, + 3, 228, 114, 0, 2121, 183, 1, 0, 0, 0, 2122, 2123, 3, 228, 114, 0, 2123, + 185, 1, 0, 0, 0, 2124, 2125, 3, 228, 114, 0, 2125, 187, 1, 0, 0, 0, 2126, + 2127, 3, 228, 114, 0, 2127, 189, 1, 0, 0, 0, 2128, 2129, 3, 228, 114, 0, + 2129, 191, 1, 0, 0, 0, 2130, 2131, 3, 228, 114, 0, 2131, 193, 1, 0, 0, + 0, 2132, 2133, 3, 228, 114, 0, 2133, 195, 1, 0, 0, 0, 2134, 2135, 3, 228, + 114, 0, 2135, 197, 1, 0, 0, 0, 2136, 2137, 3, 228, 114, 0, 2137, 199, 1, + 0, 0, 0, 2138, 2139, 3, 228, 114, 0, 2139, 201, 1, 0, 0, 0, 2140, 2141, + 3, 228, 114, 0, 2141, 203, 1, 0, 0, 0, 2142, 2143, 3, 228, 114, 0, 2143, + 205, 1, 0, 0, 0, 2144, 2145, 3, 228, 114, 0, 2145, 207, 1, 0, 0, 0, 2146, + 2147, 7, 28, 0, 0, 2147, 209, 1, 0, 0, 0, 2148, 2149, 3, 228, 114, 0, 2149, + 211, 1, 0, 0, 0, 2150, 2151, 3, 228, 114, 0, 2151, 213, 1, 0, 0, 0, 2152, + 2153, 3, 228, 114, 0, 2153, 215, 1, 0, 0, 0, 2154, 2155, 3, 228, 114, 0, + 2155, 217, 1, 0, 0, 0, 2156, 2157, 3, 228, 114, 0, 2157, 219, 1, 0, 0, + 0, 2158, 2159, 3, 228, 114, 0, 2159, 221, 1, 0, 0, 0, 2160, 2161, 3, 228, + 114, 0, 2161, 223, 1, 0, 0, 0, 2162, 2163, 3, 228, 114, 0, 2163, 225, 1, + 0, 0, 0, 2164, 2165, 3, 228, 114, 0, 2165, 227, 1, 0, 0, 0, 2166, 2174, + 5, 188, 0, 0, 2167, 2174, 3, 174, 87, 0, 2168, 2174, 5, 192, 0, 0, 2169, + 2170, 5, 3, 0, 0, 2170, 2171, 3, 228, 114, 0, 2171, 2172, 5, 4, 0, 0, 2172, + 2174, 1, 0, 0, 0, 2173, 2166, 1, 0, 0, 0, 2173, 2167, 1, 0, 0, 0, 2173, + 2168, 1, 0, 0, 0, 2173, 2169, 1, 0, 0, 0, 2174, 229, 1, 0, 0, 0, 313, 233, 241, 248, 253, 259, 265, 267, 293, 300, 307, 313, 317, 322, 325, 332, 335, 339, 347, 351, 353, 357, 361, 365, 368, 375, 381, 387, 392, 403, 409, 413, 417, 420, 425, 429, 435, 440, 449, 456, 465, 468, 472, 476, 481, 487, 499, @@ -1176,22 +1177,22 @@ func sqliteparserParserInit() { 682, 684, 691, 695, 702, 708, 714, 720, 725, 734, 739, 750, 755, 766, 771, 775, 791, 801, 806, 814, 826, 831, 842, 845, 847, 853, 856, 858, 862, 866, 873, 876, 879, 886, 889, 892, 895, 899, 907, 912, 923, 928, 937, 944, 948, - 952, 955, 963, 976, 979, 987, 996, 1000, 1005, 1031, 1038, 1049, 1058, - 1068, 1071, 1077, 1083, 1092, 1095, 1099, 1106, 1112, 1119, 1121, 1123, - 1132, 1139, 1146, 1152, 1157, 1165, 1170, 1179, 1190, 1197, 1201, 1204, - 1207, 1211, 1221, 1227, 1229, 1237, 1244, 1251, 1256, 1258, 1264, 1273, - 1278, 1285, 1289, 1291, 1294, 1302, 1306, 1309, 1318, 1323, 1330, 1339, - 1343, 1345, 1349, 1358, 1363, 1365, 1378, 1381, 1390, 1401, 1408, 1411, - 1416, 1420, 1423, 1426, 1431, 1435, 1440, 1443, 1446, 1451, 1455, 1458, - 1465, 1470, 1479, 1484, 1487, 1495, 1499, 1507, 1510, 1515, 1519, 1522, - 1529, 1534, 1543, 1548, 1551, 1559, 1563, 1571, 1574, 1576, 1585, 1588, - 1590, 1594, 1598, 1601, 1606, 1617, 1622, 1626, 1630, 1633, 1638, 1644, - 1651, 1658, 1663, 1666, 1674, 1680, 1685, 1691, 1698, 1705, 1710, 1713, - 1716, 1721, 1726, 1733, 1737, 1741, 1751, 1760, 1763, 1772, 1776, 1784, - 1793, 1796, 1805, 1808, 1811, 1814, 1824, 1833, 1842, 1846, 1853, 1860, - 1864, 1868, 1877, 1881, 1885, 1890, 1894, 1901, 1911, 1918, 1923, 1926, - 1930, 1944, 1956, 1965, 1974, 1978, 1988, 1991, 2000, 2009, 2012, 2018, - 2032, 2036, 2047, 2052, 2065, 2072, 2080, 2085, 2089, 2102, 2115, 2172, + 952, 955, 963, 976, 979, 987, 996, 1000, 1005, 1034, 1041, 1052, 1061, + 1071, 1074, 1080, 1086, 1095, 1098, 1102, 1109, 1115, 1122, 1124, 1126, + 1135, 1142, 1149, 1155, 1160, 1168, 1173, 1182, 1193, 1200, 1206, 1209, + 1212, 1222, 1228, 1230, 1238, 1245, 1252, 1257, 1259, 1265, 1274, 1279, + 1286, 1290, 1292, 1295, 1303, 1307, 1310, 1319, 1324, 1331, 1340, 1344, + 1346, 1350, 1359, 1364, 1366, 1379, 1382, 1391, 1402, 1409, 1412, 1417, + 1421, 1424, 1427, 1432, 1436, 1441, 1444, 1447, 1452, 1456, 1459, 1466, + 1471, 1480, 1485, 1488, 1496, 1500, 1508, 1511, 1516, 1520, 1523, 1530, + 1535, 1544, 1549, 1552, 1560, 1564, 1572, 1575, 1577, 1586, 1589, 1591, + 1595, 1599, 1602, 1607, 1618, 1623, 1627, 1631, 1634, 1639, 1645, 1652, + 1659, 1664, 1667, 1675, 1681, 1686, 1692, 1699, 1706, 1711, 1714, 1717, + 1722, 1727, 1734, 1738, 1742, 1752, 1761, 1764, 1773, 1777, 1785, 1794, + 1797, 1806, 1809, 1812, 1815, 1825, 1834, 1843, 1847, 1854, 1861, 1865, + 1869, 1878, 1882, 1886, 1891, 1895, 1902, 1912, 1919, 1924, 1927, 1931, + 1945, 1957, 1966, 1975, 1979, 1989, 1992, 2001, 2010, 2013, 2019, 2033, + 2037, 2048, 2053, 2066, 2073, 2081, 2086, 2090, 2103, 2116, 2173, } deserializer := antlr.NewATNDeserializer(nil) staticData.atn = deserializer.Deserialize(staticData.serializedATN) @@ -1208,7 +1209,7 @@ func sqliteparserParserInit() { // NewSQLiteParser(). You can call this function if you wish to initialize the static state ahead // of time. func SQLiteParserInit() { - staticData := &sqliteparserParserStaticData + staticData := &SQLiteParserParserStaticData staticData.once.Do(sqliteparserParserInit) } @@ -1217,11 +1218,11 @@ func NewSQLiteParser(input antlr.TokenStream) *SQLiteParser { SQLiteParserInit() this := new(SQLiteParser) this.BaseParser = antlr.NewBaseParser(input) - staticData := &sqliteparserParserStaticData - this.Interpreter = antlr.NewParserATNSimulator(this, staticData.atn, staticData.decisionToDFA, staticData.predictionContextCache) - this.RuleNames = staticData.ruleNames - this.LiteralNames = staticData.literalNames - this.SymbolicNames = staticData.symbolicNames + staticData := &SQLiteParserParserStaticData + this.Interpreter = antlr.NewParserATNSimulator(this, staticData.atn, staticData.decisionToDFA, staticData.PredictionContextCache) + this.RuleNames = staticData.RuleNames + this.LiteralNames = staticData.LiteralNames + this.SymbolicNames = staticData.SymbolicNames this.GrammarFileName = "SQLiteParser.g4" return this @@ -1238,193 +1239,195 @@ const ( SQLiteParserASSIGN = 6 SQLiteParserSTAR = 7 SQLiteParserPLUS = 8 - SQLiteParserMINUS = 9 - SQLiteParserTILDE = 10 - SQLiteParserPIPE2 = 11 - SQLiteParserDIV = 12 - SQLiteParserMOD = 13 - SQLiteParserLT2 = 14 - SQLiteParserGT2 = 15 - SQLiteParserAMP = 16 - SQLiteParserPIPE = 17 - SQLiteParserLT = 18 - SQLiteParserLT_EQ = 19 - SQLiteParserGT = 20 - SQLiteParserGT_EQ = 21 - SQLiteParserEQ = 22 - SQLiteParserNOT_EQ1 = 23 - SQLiteParserNOT_EQ2 = 24 - SQLiteParserABORT_ = 25 - SQLiteParserACTION_ = 26 - SQLiteParserADD_ = 27 - SQLiteParserAFTER_ = 28 - SQLiteParserALL_ = 29 - SQLiteParserALTER_ = 30 - SQLiteParserANALYZE_ = 31 - SQLiteParserAND_ = 32 - SQLiteParserAS_ = 33 - SQLiteParserASC_ = 34 - SQLiteParserATTACH_ = 35 - SQLiteParserAUTOINCREMENT_ = 36 - SQLiteParserBEFORE_ = 37 - SQLiteParserBEGIN_ = 38 - SQLiteParserBETWEEN_ = 39 - SQLiteParserBY_ = 40 - SQLiteParserCASCADE_ = 41 - SQLiteParserCASE_ = 42 - SQLiteParserCAST_ = 43 - SQLiteParserCHECK_ = 44 - SQLiteParserCOLLATE_ = 45 - SQLiteParserCOLUMN_ = 46 - SQLiteParserCOMMIT_ = 47 - SQLiteParserCONFLICT_ = 48 - SQLiteParserCONSTRAINT_ = 49 - SQLiteParserCREATE_ = 50 - SQLiteParserCROSS_ = 51 - SQLiteParserCURRENT_DATE_ = 52 - SQLiteParserCURRENT_TIME_ = 53 - SQLiteParserCURRENT_TIMESTAMP_ = 54 - SQLiteParserDATABASE_ = 55 - SQLiteParserDEFAULT_ = 56 - SQLiteParserDEFERRABLE_ = 57 - SQLiteParserDEFERRED_ = 58 - SQLiteParserDELETE_ = 59 - SQLiteParserDESC_ = 60 - SQLiteParserDETACH_ = 61 - SQLiteParserDISTINCT_ = 62 - SQLiteParserDROP_ = 63 - SQLiteParserEACH_ = 64 - SQLiteParserELSE_ = 65 - SQLiteParserEND_ = 66 - SQLiteParserESCAPE_ = 67 - SQLiteParserEXCEPT_ = 68 - SQLiteParserEXCLUSIVE_ = 69 - SQLiteParserEXISTS_ = 70 - SQLiteParserEXPLAIN_ = 71 - SQLiteParserFAIL_ = 72 - SQLiteParserFOR_ = 73 - SQLiteParserFOREIGN_ = 74 - SQLiteParserFROM_ = 75 - SQLiteParserFULL_ = 76 - SQLiteParserGLOB_ = 77 - SQLiteParserGROUP_ = 78 - SQLiteParserHAVING_ = 79 - SQLiteParserIF_ = 80 - SQLiteParserIGNORE_ = 81 - SQLiteParserIMMEDIATE_ = 82 - SQLiteParserIN_ = 83 - SQLiteParserINDEX_ = 84 - SQLiteParserINDEXED_ = 85 - SQLiteParserINITIALLY_ = 86 - SQLiteParserINNER_ = 87 - SQLiteParserINSERT_ = 88 - SQLiteParserINSTEAD_ = 89 - SQLiteParserINTERSECT_ = 90 - SQLiteParserINTO_ = 91 - SQLiteParserIS_ = 92 - SQLiteParserISNULL_ = 93 - SQLiteParserJOIN_ = 94 - SQLiteParserKEY_ = 95 - SQLiteParserLEFT_ = 96 - SQLiteParserLIKE_ = 97 - SQLiteParserLIMIT_ = 98 - SQLiteParserMATCH_ = 99 - SQLiteParserNATURAL_ = 100 - SQLiteParserNO_ = 101 - SQLiteParserNOT_ = 102 - SQLiteParserNOTNULL_ = 103 - SQLiteParserNULL_ = 104 - SQLiteParserOF_ = 105 - SQLiteParserOFFSET_ = 106 - SQLiteParserON_ = 107 - SQLiteParserOR_ = 108 - SQLiteParserORDER_ = 109 - SQLiteParserOUTER_ = 110 - SQLiteParserPLAN_ = 111 - SQLiteParserPRAGMA_ = 112 - SQLiteParserPRIMARY_ = 113 - SQLiteParserQUERY_ = 114 - SQLiteParserRAISE_ = 115 - SQLiteParserRECURSIVE_ = 116 - SQLiteParserREFERENCES_ = 117 - SQLiteParserREGEXP_ = 118 - SQLiteParserREINDEX_ = 119 - SQLiteParserRELEASE_ = 120 - SQLiteParserRENAME_ = 121 - SQLiteParserREPLACE_ = 122 - SQLiteParserRESTRICT_ = 123 - SQLiteParserRETURNING_ = 124 - SQLiteParserRIGHT_ = 125 - SQLiteParserROLLBACK_ = 126 - SQLiteParserROW_ = 127 - SQLiteParserROWS_ = 128 - SQLiteParserSAVEPOINT_ = 129 - SQLiteParserSELECT_ = 130 - SQLiteParserSET_ = 131 - SQLiteParserSTRICT_ = 132 - SQLiteParserTABLE_ = 133 - SQLiteParserTEMP_ = 134 - SQLiteParserTEMPORARY_ = 135 - SQLiteParserTHEN_ = 136 - SQLiteParserTO_ = 137 - SQLiteParserTRANSACTION_ = 138 - SQLiteParserTRIGGER_ = 139 - SQLiteParserUNION_ = 140 - SQLiteParserUNIQUE_ = 141 - SQLiteParserUPDATE_ = 142 - SQLiteParserUSING_ = 143 - SQLiteParserVACUUM_ = 144 - SQLiteParserVALUES_ = 145 - SQLiteParserVIEW_ = 146 - SQLiteParserVIRTUAL_ = 147 - SQLiteParserWHEN_ = 148 - SQLiteParserWHERE_ = 149 - SQLiteParserWITH_ = 150 - SQLiteParserWITHOUT_ = 151 - SQLiteParserFIRST_VALUE_ = 152 - SQLiteParserOVER_ = 153 - SQLiteParserPARTITION_ = 154 - SQLiteParserRANGE_ = 155 - SQLiteParserPRECEDING_ = 156 - SQLiteParserUNBOUNDED_ = 157 - SQLiteParserCURRENT_ = 158 - SQLiteParserFOLLOWING_ = 159 - SQLiteParserCUME_DIST_ = 160 - SQLiteParserDENSE_RANK_ = 161 - SQLiteParserLAG_ = 162 - SQLiteParserLAST_VALUE_ = 163 - SQLiteParserLEAD_ = 164 - SQLiteParserNTH_VALUE_ = 165 - SQLiteParserNTILE_ = 166 - SQLiteParserPERCENT_RANK_ = 167 - SQLiteParserRANK_ = 168 - SQLiteParserROW_NUMBER_ = 169 - SQLiteParserGENERATED_ = 170 - SQLiteParserALWAYS_ = 171 - SQLiteParserSTORED_ = 172 - SQLiteParserTRUE_ = 173 - SQLiteParserFALSE_ = 174 - SQLiteParserWINDOW_ = 175 - SQLiteParserNULLS_ = 176 - SQLiteParserFIRST_ = 177 - SQLiteParserLAST_ = 178 - SQLiteParserFILTER_ = 179 - SQLiteParserGROUPS_ = 180 - SQLiteParserEXCLUDE_ = 181 - SQLiteParserTIES_ = 182 - SQLiteParserOTHERS_ = 183 - SQLiteParserDO_ = 184 - SQLiteParserNOTHING_ = 185 - SQLiteParserIDENTIFIER = 186 - SQLiteParserNUMERIC_LITERAL = 187 - SQLiteParserNUMBERED_BIND_PARAMETER = 188 - SQLiteParserNAMED_BIND_PARAMETER = 189 - SQLiteParserSTRING_LITERAL = 190 - SQLiteParserBLOB_LITERAL = 191 - SQLiteParserSINGLE_LINE_COMMENT = 192 - SQLiteParserMULTILINE_COMMENT = 193 - SQLiteParserSPACES = 194 - SQLiteParserUNEXPECTED_CHAR = 195 + SQLiteParserPTR2 = 9 + SQLiteParserPTR = 10 + SQLiteParserMINUS = 11 + SQLiteParserTILDE = 12 + SQLiteParserPIPE2 = 13 + SQLiteParserDIV = 14 + SQLiteParserMOD = 15 + SQLiteParserLT2 = 16 + SQLiteParserGT2 = 17 + SQLiteParserAMP = 18 + SQLiteParserPIPE = 19 + SQLiteParserLT = 20 + SQLiteParserLT_EQ = 21 + SQLiteParserGT = 22 + SQLiteParserGT_EQ = 23 + SQLiteParserEQ = 24 + SQLiteParserNOT_EQ1 = 25 + SQLiteParserNOT_EQ2 = 26 + SQLiteParserABORT_ = 27 + SQLiteParserACTION_ = 28 + SQLiteParserADD_ = 29 + SQLiteParserAFTER_ = 30 + SQLiteParserALL_ = 31 + SQLiteParserALTER_ = 32 + SQLiteParserANALYZE_ = 33 + SQLiteParserAND_ = 34 + SQLiteParserAS_ = 35 + SQLiteParserASC_ = 36 + SQLiteParserATTACH_ = 37 + SQLiteParserAUTOINCREMENT_ = 38 + SQLiteParserBEFORE_ = 39 + SQLiteParserBEGIN_ = 40 + SQLiteParserBETWEEN_ = 41 + SQLiteParserBY_ = 42 + SQLiteParserCASCADE_ = 43 + SQLiteParserCASE_ = 44 + SQLiteParserCAST_ = 45 + SQLiteParserCHECK_ = 46 + SQLiteParserCOLLATE_ = 47 + SQLiteParserCOLUMN_ = 48 + SQLiteParserCOMMIT_ = 49 + SQLiteParserCONFLICT_ = 50 + SQLiteParserCONSTRAINT_ = 51 + SQLiteParserCREATE_ = 52 + SQLiteParserCROSS_ = 53 + SQLiteParserCURRENT_DATE_ = 54 + SQLiteParserCURRENT_TIME_ = 55 + SQLiteParserCURRENT_TIMESTAMP_ = 56 + SQLiteParserDATABASE_ = 57 + SQLiteParserDEFAULT_ = 58 + SQLiteParserDEFERRABLE_ = 59 + SQLiteParserDEFERRED_ = 60 + SQLiteParserDELETE_ = 61 + SQLiteParserDESC_ = 62 + SQLiteParserDETACH_ = 63 + SQLiteParserDISTINCT_ = 64 + SQLiteParserDROP_ = 65 + SQLiteParserEACH_ = 66 + SQLiteParserELSE_ = 67 + SQLiteParserEND_ = 68 + SQLiteParserESCAPE_ = 69 + SQLiteParserEXCEPT_ = 70 + SQLiteParserEXCLUSIVE_ = 71 + SQLiteParserEXISTS_ = 72 + SQLiteParserEXPLAIN_ = 73 + SQLiteParserFAIL_ = 74 + SQLiteParserFOR_ = 75 + SQLiteParserFOREIGN_ = 76 + SQLiteParserFROM_ = 77 + SQLiteParserFULL_ = 78 + SQLiteParserGLOB_ = 79 + SQLiteParserGROUP_ = 80 + SQLiteParserHAVING_ = 81 + SQLiteParserIF_ = 82 + SQLiteParserIGNORE_ = 83 + SQLiteParserIMMEDIATE_ = 84 + SQLiteParserIN_ = 85 + SQLiteParserINDEX_ = 86 + SQLiteParserINDEXED_ = 87 + SQLiteParserINITIALLY_ = 88 + SQLiteParserINNER_ = 89 + SQLiteParserINSERT_ = 90 + SQLiteParserINSTEAD_ = 91 + SQLiteParserINTERSECT_ = 92 + SQLiteParserINTO_ = 93 + SQLiteParserIS_ = 94 + SQLiteParserISNULL_ = 95 + SQLiteParserJOIN_ = 96 + SQLiteParserKEY_ = 97 + SQLiteParserLEFT_ = 98 + SQLiteParserLIKE_ = 99 + SQLiteParserLIMIT_ = 100 + SQLiteParserMATCH_ = 101 + SQLiteParserNATURAL_ = 102 + SQLiteParserNO_ = 103 + SQLiteParserNOT_ = 104 + SQLiteParserNOTNULL_ = 105 + SQLiteParserNULL_ = 106 + SQLiteParserOF_ = 107 + SQLiteParserOFFSET_ = 108 + SQLiteParserON_ = 109 + SQLiteParserOR_ = 110 + SQLiteParserORDER_ = 111 + SQLiteParserOUTER_ = 112 + SQLiteParserPLAN_ = 113 + SQLiteParserPRAGMA_ = 114 + SQLiteParserPRIMARY_ = 115 + SQLiteParserQUERY_ = 116 + SQLiteParserRAISE_ = 117 + SQLiteParserRECURSIVE_ = 118 + SQLiteParserREFERENCES_ = 119 + SQLiteParserREGEXP_ = 120 + SQLiteParserREINDEX_ = 121 + SQLiteParserRELEASE_ = 122 + SQLiteParserRENAME_ = 123 + SQLiteParserREPLACE_ = 124 + SQLiteParserRESTRICT_ = 125 + SQLiteParserRETURNING_ = 126 + SQLiteParserRIGHT_ = 127 + SQLiteParserROLLBACK_ = 128 + SQLiteParserROW_ = 129 + SQLiteParserROWS_ = 130 + SQLiteParserSAVEPOINT_ = 131 + SQLiteParserSELECT_ = 132 + SQLiteParserSET_ = 133 + SQLiteParserSTRICT_ = 134 + SQLiteParserTABLE_ = 135 + SQLiteParserTEMP_ = 136 + SQLiteParserTEMPORARY_ = 137 + SQLiteParserTHEN_ = 138 + SQLiteParserTO_ = 139 + SQLiteParserTRANSACTION_ = 140 + SQLiteParserTRIGGER_ = 141 + SQLiteParserUNION_ = 142 + SQLiteParserUNIQUE_ = 143 + SQLiteParserUPDATE_ = 144 + SQLiteParserUSING_ = 145 + SQLiteParserVACUUM_ = 146 + SQLiteParserVALUES_ = 147 + SQLiteParserVIEW_ = 148 + SQLiteParserVIRTUAL_ = 149 + SQLiteParserWHEN_ = 150 + SQLiteParserWHERE_ = 151 + SQLiteParserWITH_ = 152 + SQLiteParserWITHOUT_ = 153 + SQLiteParserFIRST_VALUE_ = 154 + SQLiteParserOVER_ = 155 + SQLiteParserPARTITION_ = 156 + SQLiteParserRANGE_ = 157 + SQLiteParserPRECEDING_ = 158 + SQLiteParserUNBOUNDED_ = 159 + SQLiteParserCURRENT_ = 160 + SQLiteParserFOLLOWING_ = 161 + SQLiteParserCUME_DIST_ = 162 + SQLiteParserDENSE_RANK_ = 163 + SQLiteParserLAG_ = 164 + SQLiteParserLAST_VALUE_ = 165 + SQLiteParserLEAD_ = 166 + SQLiteParserNTH_VALUE_ = 167 + SQLiteParserNTILE_ = 168 + SQLiteParserPERCENT_RANK_ = 169 + SQLiteParserRANK_ = 170 + SQLiteParserROW_NUMBER_ = 171 + SQLiteParserGENERATED_ = 172 + SQLiteParserALWAYS_ = 173 + SQLiteParserSTORED_ = 174 + SQLiteParserTRUE_ = 175 + SQLiteParserFALSE_ = 176 + SQLiteParserWINDOW_ = 177 + SQLiteParserNULLS_ = 178 + SQLiteParserFIRST_ = 179 + SQLiteParserLAST_ = 180 + SQLiteParserFILTER_ = 181 + SQLiteParserGROUPS_ = 182 + SQLiteParserEXCLUDE_ = 183 + SQLiteParserTIES_ = 184 + SQLiteParserOTHERS_ = 185 + SQLiteParserDO_ = 186 + SQLiteParserNOTHING_ = 187 + SQLiteParserIDENTIFIER = 188 + SQLiteParserNUMERIC_LITERAL = 189 + SQLiteParserNUMBERED_BIND_PARAMETER = 190 + SQLiteParserNAMED_BIND_PARAMETER = 191 + SQLiteParserSTRING_LITERAL = 192 + SQLiteParserBLOB_LITERAL = 193 + SQLiteParserSINGLE_LINE_COMMENT = 194 + SQLiteParserMULTILINE_COMMENT = 195 + SQLiteParserSPACES = 196 + SQLiteParserUNEXPECTED_CHAR = 197 ) // SQLiteParser rules. @@ -1563,23 +1566,28 @@ type IParseContext interface { } type ParseContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyParseContext() *ParseContext { var p = new(ParseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_parse return p } +func InitEmptyParseContext(p *ParseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_parse +} + func (*ParseContext) IsParseContext() {} func NewParseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ParseContext { var p = new(ParseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_parse @@ -1655,35 +1663,19 @@ func (s *ParseContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Parse() (localctx IParseContext) { - this := p - _ = this - localctx = NewParseContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 0, SQLiteParserRULE_parse) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) p.SetState(233) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) - for ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&-6267743731445661694) != 0) || ((int64((_la-66)) & ^0x3f) == 0 && ((int64(1)<<(_la-66))&-7971300971697405919) != 0) || ((int64((_la-130)) & ^0x3f) == 0 && ((int64(1)<<(_la-130))&1101825) != 0) { + for ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&-6912461228224806910) != 0) || ((int64((_la-65)) & ^0x3f) == 0 && ((int64(1)<<(_la-65))&-8430175552450592503) != 0) || ((int64((_la-131)) & ^0x3f) == 0 && ((int64(1)<<(_la-131))&2203651) != 0) { { p.SetState(230) p.Sql_stmt_list() @@ -1691,14 +1683,31 @@ func (p *SQLiteParser) Parse() (localctx IParseContext) { p.SetState(235) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { p.SetState(236) p.Match(SQLiteParserEOF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ISql_stmt_listContext is an interface to support dynamic dispatch. @@ -1719,23 +1728,28 @@ type ISql_stmt_listContext interface { } type Sql_stmt_listContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptySql_stmt_listContext() *Sql_stmt_listContext { var p = new(Sql_stmt_listContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_sql_stmt_list return p } +func InitEmptySql_stmt_listContext(p *Sql_stmt_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_sql_stmt_list +} + func (*Sql_stmt_listContext) IsSql_stmt_listContext() {} func NewSql_stmt_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Sql_stmt_listContext { var p = new(Sql_stmt_listContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_sql_stmt_list @@ -1815,44 +1829,35 @@ func (s *Sql_stmt_listContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Sql_stmt_list() (localctx ISql_stmt_listContext) { - this := p - _ = this - localctx = NewSql_stmt_listContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 2, SQLiteParserRULE_sql_stmt_list) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - var _alt int p.EnterOuterAlt(localctx, 1) p.SetState(241) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserSCOL { { p.SetState(238) p.Match(SQLiteParserSCOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(243) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { @@ -1861,22 +1866,37 @@ func (p *SQLiteParser) Sql_stmt_list() (localctx ISql_stmt_listContext) { } p.SetState(253) p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 3, p.GetParserRuleContext()) - + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 3, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { p.SetState(246) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for ok := true; ok; ok = _la == SQLiteParserSCOL { { p.SetState(245) p.Match(SQLiteParserSCOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(248) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { @@ -1887,26 +1907,57 @@ func (p *SQLiteParser) Sql_stmt_list() (localctx ISql_stmt_listContext) { } p.SetState(255) p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 3, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 3, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } } p.SetState(259) p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 4, p.GetParserRuleContext()) - + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 4, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { p.SetState(256) p.Match(SQLiteParserSCOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } p.SetState(261) p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 4, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 4, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ISql_stmtContext is an interface to support dynamic dispatch. @@ -1950,23 +2001,28 @@ type ISql_stmtContext interface { } type Sql_stmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptySql_stmtContext() *Sql_stmtContext { var p = new(Sql_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_sql_stmt return p } +func InitEmptySql_stmtContext(p *Sql_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_sql_stmt +} + func (*Sql_stmtContext) IsSql_stmtContext() {} func NewSql_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Sql_stmtContext { var p = new(Sql_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_sql_stmt @@ -2393,51 +2449,50 @@ func (s *Sql_stmtContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Sql_stmt() (localctx ISql_stmtContext) { - this := p - _ = this - localctx = NewSql_stmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 4, SQLiteParserRULE_sql_stmt) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) p.SetState(267) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserEXPLAIN_ { { p.SetState(262) p.Match(SQLiteParserEXPLAIN_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(265) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserQUERY_ { { p.SetState(263) p.Match(SQLiteParserQUERY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(264) p.Match(SQLiteParserPLAN_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } @@ -2445,7 +2500,11 @@ func (p *SQLiteParser) Sql_stmt() (localctx ISql_stmtContext) { } p.SetState(293) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 7, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 7, p.GetParserRuleContext()) { case 1: { p.SetState(269) @@ -2590,9 +2649,21 @@ func (p *SQLiteParser) Sql_stmt() (localctx ISql_stmtContext) { p.Vacuum_stmt() } + case antlr.ATNInvalidAltNumber: + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IAlter_table_stmtContext is an interface to support dynamic dispatch. @@ -2635,7 +2706,7 @@ type IAlter_table_stmtContext interface { } type Alter_table_stmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser old_column_name IColumn_nameContext new_column_name IColumn_nameContext @@ -2643,17 +2714,22 @@ type Alter_table_stmtContext struct { func NewEmptyAlter_table_stmtContext() *Alter_table_stmtContext { var p = new(Alter_table_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_alter_table_stmt return p } +func InitEmptyAlter_table_stmtContext(p *Alter_table_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_alter_table_stmt +} + func (*Alter_table_stmtContext) IsAlter_table_stmtContext() {} func NewAlter_table_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Alter_table_stmtContext { var p = new(Alter_table_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_alter_table_stmt @@ -2829,41 +2905,29 @@ func (s *Alter_table_stmtContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Alter_table_stmt() (localctx IAlter_table_stmtContext) { - this := p - _ = this - localctx = NewAlter_table_stmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 6, SQLiteParserRULE_alter_table_stmt) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { p.SetState(295) p.Match(SQLiteParserALTER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(296) p.Match(SQLiteParserTABLE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(300) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 8, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 8, p.GetParserRuleContext()) == 1 { { p.SetState(297) p.Schema_name() @@ -2871,8 +2935,14 @@ func (p *SQLiteParser) Alter_table_stmt() (localctx IAlter_table_stmtContext) { { p.SetState(298) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { p.SetState(302) @@ -2880,20 +2950,35 @@ func (p *SQLiteParser) Alter_table_stmt() (localctx IAlter_table_stmtContext) { } p.SetState(325) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserRENAME_: { p.SetState(303) p.Match(SQLiteParserRENAME_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(313) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 10, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 10, p.GetParserRuleContext()) { case 1: { p.SetState(304) p.Match(SQLiteParserTO_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(305) @@ -2904,12 +2989,18 @@ func (p *SQLiteParser) Alter_table_stmt() (localctx IAlter_table_stmtContext) { p.SetState(307) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 9, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 9, p.GetParserRuleContext()) == 1 { { p.SetState(306) p.Match(SQLiteParserCOLUMN_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { p.SetState(309) @@ -2921,6 +3012,10 @@ func (p *SQLiteParser) Alter_table_stmt() (localctx IAlter_table_stmtContext) { { p.SetState(310) p.Match(SQLiteParserTO_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(311) @@ -2930,22 +3025,34 @@ func (p *SQLiteParser) Alter_table_stmt() (localctx IAlter_table_stmtContext) { localctx.(*Alter_table_stmtContext).new_column_name = _x } + case antlr.ATNInvalidAltNumber: + goto errorExit } case SQLiteParserADD_: { p.SetState(315) p.Match(SQLiteParserADD_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(317) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 11, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 11, p.GetParserRuleContext()) == 1 { { p.SetState(316) p.Match(SQLiteParserCOLUMN_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { p.SetState(319) @@ -2956,16 +3063,26 @@ func (p *SQLiteParser) Alter_table_stmt() (localctx IAlter_table_stmtContext) { { p.SetState(320) p.Match(SQLiteParserDROP_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(322) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 12, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 12, p.GetParserRuleContext()) == 1 { { p.SetState(321) p.Match(SQLiteParserCOLUMN_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { p.SetState(324) @@ -2973,10 +3090,21 @@ func (p *SQLiteParser) Alter_table_stmt() (localctx IAlter_table_stmtContext) { } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IAnalyze_stmtContext is an interface to support dynamic dispatch. @@ -2997,23 +3125,28 @@ type IAnalyze_stmtContext interface { } type Analyze_stmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyAnalyze_stmtContext() *Analyze_stmtContext { var p = new(Analyze_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_analyze_stmt return p } +func InitEmptyAnalyze_stmtContext(p *Analyze_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_analyze_stmt +} + func (*Analyze_stmtContext) IsAnalyze_stmtContext() {} func NewAnalyze_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Analyze_stmtContext { var p = new(Analyze_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_analyze_stmt @@ -3084,47 +3217,33 @@ func (s *Analyze_stmtContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Analyze_stmt() (localctx IAnalyze_stmtContext) { - this := p - _ = this - localctx = NewAnalyze_stmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 8, SQLiteParserRULE_analyze_stmt) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { p.SetState(327) p.Match(SQLiteParserANALYZE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(335) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 15, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 15, p.GetParserRuleContext()) == 1 { { p.SetState(328) p.Schema_name() } - } else if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 15, p.GetParserRuleContext()) == 2 { + } else if p.HasError() { // JIM + goto errorExit + } else if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 15, p.GetParserRuleContext()) == 2 { p.SetState(332) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 14, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 14, p.GetParserRuleContext()) == 1 { { p.SetState(329) p.Schema_name() @@ -3132,17 +3251,35 @@ func (p *SQLiteParser) Analyze_stmt() (localctx IAnalyze_stmtContext) { { p.SetState(330) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { p.SetState(334) p.Table_or_index_name() } + } else if p.HasError() { // JIM + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IAttach_stmtContext is an interface to support dynamic dispatch. @@ -3164,23 +3301,28 @@ type IAttach_stmtContext interface { } type Attach_stmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyAttach_stmtContext() *Attach_stmtContext { var p = new(Attach_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_attach_stmt return p } +func InitEmptyAttach_stmtContext(p *Attach_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_attach_stmt +} + func (*Attach_stmtContext) IsAttach_stmtContext() {} func NewAttach_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Attach_stmtContext { var p = new(Attach_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_attach_stmt @@ -3255,42 +3397,32 @@ func (s *Attach_stmtContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Attach_stmt() (localctx IAttach_stmtContext) { - this := p - _ = this - localctx = NewAttach_stmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 10, SQLiteParserRULE_attach_stmt) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { p.SetState(337) p.Match(SQLiteParserATTACH_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(339) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 16, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 16, p.GetParserRuleContext()) == 1 { { p.SetState(338) p.Match(SQLiteParserDATABASE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { p.SetState(341) @@ -3299,13 +3431,27 @@ func (p *SQLiteParser) Attach_stmt() (localctx IAttach_stmtContext) { { p.SetState(342) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(343) p.Schema_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IBegin_stmtContext is an interface to support dynamic dispatch. @@ -3328,23 +3474,28 @@ type IBegin_stmtContext interface { } type Begin_stmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyBegin_stmtContext() *Begin_stmtContext { var p = new(Begin_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_begin_stmt return p } +func InitEmptyBegin_stmtContext(p *Begin_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_begin_stmt +} + func (*Begin_stmtContext) IsBegin_stmtContext() {} func NewBegin_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Begin_stmtContext { var p = new(Begin_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_begin_stmt @@ -3411,44 +3562,32 @@ func (s *Begin_stmtContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Begin_stmt() (localctx IBegin_stmtContext) { - this := p - _ = this - localctx = NewBegin_stmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 12, SQLiteParserRULE_begin_stmt) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { p.SetState(345) p.Match(SQLiteParserBEGIN_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(347) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) - if (int64((_la-58)) & ^0x3f) == 0 && ((int64(1)<<(_la-58))&16779265) != 0 { + if (int64((_la-60)) & ^0x3f) == 0 && ((int64(1)<<(_la-60))&16779265) != 0 { { p.SetState(346) _la = p.GetTokenStream().LA(1) - if !((int64((_la-58)) & ^0x3f) == 0 && ((int64(1)<<(_la-58))&16779265) != 0) { + if !((int64((_la-60)) & ^0x3f) == 0 && ((int64(1)<<(_la-60))&16779265) != 0) { p.GetErrorHandler().RecoverInline(p) } else { p.GetErrorHandler().ReportMatch(p) @@ -3459,27 +3598,46 @@ func (p *SQLiteParser) Begin_stmt() (localctx IBegin_stmtContext) { } p.SetState(353) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserTRANSACTION_ { { p.SetState(349) p.Match(SQLiteParserTRANSACTION_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(351) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 18, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 18, p.GetParserRuleContext()) == 1 { { p.SetState(350) p.Transaction_name() } + } else if p.HasError() { // JIM + goto errorExit } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ICommit_stmtContext is an interface to support dynamic dispatch. @@ -3499,23 +3657,28 @@ type ICommit_stmtContext interface { } type Commit_stmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyCommit_stmtContext() *Commit_stmtContext { var p = new(Commit_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_commit_stmt return p } +func InitEmptyCommit_stmtContext(p *Commit_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_commit_stmt +} + func (*Commit_stmtContext) IsCommit_stmtContext() {} func NewCommit_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Commit_stmtContext { var p = new(Commit_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_commit_stmt @@ -3558,29 +3721,10 @@ func (s *Commit_stmtContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Commit_stmt() (localctx ICommit_stmtContext) { - this := p - _ = this - localctx = NewCommit_stmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 14, SQLiteParserRULE_commit_stmt) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { p.SetState(355) @@ -3595,17 +3739,34 @@ func (p *SQLiteParser) Commit_stmt() (localctx ICommit_stmtContext) { } p.SetState(357) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserTRANSACTION_ { { p.SetState(356) p.Match(SQLiteParserTRANSACTION_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IRollback_stmtContext is an interface to support dynamic dispatch. @@ -3627,23 +3788,28 @@ type IRollback_stmtContext interface { } type Rollback_stmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyRollback_stmtContext() *Rollback_stmtContext { var p = new(Rollback_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_rollback_stmt return p } +func InitEmptyRollback_stmtContext(p *Rollback_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_rollback_stmt +} + func (*Rollback_stmtContext) IsRollback_stmtContext() {} func NewRollback_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Rollback_stmtContext { var p = new(Rollback_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_rollback_stmt @@ -3706,63 +3872,68 @@ func (s *Rollback_stmtContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Rollback_stmt() (localctx IRollback_stmtContext) { - this := p - _ = this - localctx = NewRollback_stmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 16, SQLiteParserRULE_rollback_stmt) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { p.SetState(359) p.Match(SQLiteParserROLLBACK_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(361) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserTRANSACTION_ { { p.SetState(360) p.Match(SQLiteParserTRANSACTION_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } p.SetState(368) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserTO_ { { p.SetState(363) p.Match(SQLiteParserTO_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(365) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 22, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 22, p.GetParserRuleContext()) == 1 { { p.SetState(364) p.Match(SQLiteParserSAVEPOINT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { p.SetState(367) @@ -3771,7 +3942,17 @@ func (p *SQLiteParser) Rollback_stmt() (localctx IRollback_stmtContext) { } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ISavepoint_stmtContext is an interface to support dynamic dispatch. @@ -3790,23 +3971,28 @@ type ISavepoint_stmtContext interface { } type Savepoint_stmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptySavepoint_stmtContext() *Savepoint_stmtContext { var p = new(Savepoint_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_savepoint_stmt return p } +func InitEmptySavepoint_stmtContext(p *Savepoint_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_savepoint_stmt +} + func (*Savepoint_stmtContext) IsSavepoint_stmtContext() {} func NewSavepoint_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Savepoint_stmtContext { var p = new(Savepoint_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_savepoint_stmt @@ -3857,39 +4043,33 @@ func (s *Savepoint_stmtContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Savepoint_stmt() (localctx ISavepoint_stmtContext) { - this := p - _ = this - localctx = NewSavepoint_stmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 18, SQLiteParserRULE_savepoint_stmt) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { p.SetState(370) p.Match(SQLiteParserSAVEPOINT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(371) p.Savepoint_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IRelease_stmtContext is an interface to support dynamic dispatch. @@ -3909,23 +4089,28 @@ type IRelease_stmtContext interface { } type Release_stmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyRelease_stmtContext() *Release_stmtContext { var p = new(Release_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_release_stmt return p } +func InitEmptyRelease_stmtContext(p *Release_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_release_stmt +} + func (*Release_stmtContext) IsRelease_stmtContext() {} func NewRelease_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Release_stmtContext { var p = new(Release_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_release_stmt @@ -3980,49 +4165,49 @@ func (s *Release_stmtContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Release_stmt() (localctx IRelease_stmtContext) { - this := p - _ = this - localctx = NewRelease_stmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 20, SQLiteParserRULE_release_stmt) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { p.SetState(373) p.Match(SQLiteParserRELEASE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(375) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 24, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 24, p.GetParserRuleContext()) == 1 { { p.SetState(374) p.Match(SQLiteParserSAVEPOINT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { p.SetState(377) p.Savepoint_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ICreate_index_stmtContext is an interface to support dynamic dispatch. @@ -4058,23 +4243,28 @@ type ICreate_index_stmtContext interface { } type Create_index_stmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyCreate_index_stmtContext() *Create_index_stmtContext { var p = new(Create_index_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_create_index_stmt return p } +func InitEmptyCreate_index_stmtContext(p *Create_index_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_create_index_stmt +} + func (*Create_index_stmtContext) IsCreate_index_stmtContext() {} func NewCreate_index_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Create_index_stmtContext { var p = new(Create_index_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_create_index_stmt @@ -4262,71 +4452,81 @@ func (s *Create_index_stmtContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Create_index_stmt() (localctx ICreate_index_stmtContext) { - this := p - _ = this - localctx = NewCreate_index_stmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 22, SQLiteParserRULE_create_index_stmt) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { p.SetState(379) p.Match(SQLiteParserCREATE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(381) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserUNIQUE_ { { p.SetState(380) p.Match(SQLiteParserUNIQUE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } { p.SetState(383) p.Match(SQLiteParserINDEX_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(387) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 26, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 26, p.GetParserRuleContext()) == 1 { { p.SetState(384) p.Match(SQLiteParserIF_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(385) p.Match(SQLiteParserNOT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(386) p.Match(SQLiteParserEXISTS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } p.SetState(392) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 27, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 27, p.GetParserRuleContext()) == 1 { { p.SetState(389) p.Schema_name() @@ -4334,8 +4534,14 @@ func (p *SQLiteParser) Create_index_stmt() (localctx ICreate_index_stmtContext) { p.SetState(390) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { p.SetState(394) @@ -4344,6 +4550,10 @@ func (p *SQLiteParser) Create_index_stmt() (localctx ICreate_index_stmtContext) { p.SetState(395) p.Match(SQLiteParserON_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(396) @@ -4352,6 +4562,10 @@ func (p *SQLiteParser) Create_index_stmt() (localctx ICreate_index_stmtContext) { p.SetState(397) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(398) @@ -4359,12 +4573,19 @@ func (p *SQLiteParser) Create_index_stmt() (localctx ICreate_index_stmtContext) } p.SetState(403) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { p.SetState(399) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(400) @@ -4373,20 +4594,34 @@ func (p *SQLiteParser) Create_index_stmt() (localctx ICreate_index_stmtContext) p.SetState(405) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { p.SetState(406) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(409) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserWHERE_ { { p.SetState(407) p.Match(SQLiteParserWHERE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(408) @@ -4395,7 +4630,17 @@ func (p *SQLiteParser) Create_index_stmt() (localctx ICreate_index_stmtContext) } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IIndexed_columnContext is an interface to support dynamic dispatch. @@ -4417,23 +4662,28 @@ type IIndexed_columnContext interface { } type Indexed_columnContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyIndexed_columnContext() *Indexed_columnContext { var p = new(Indexed_columnContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_indexed_column return p } +func InitEmptyIndexed_columnContext(p *Indexed_columnContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_indexed_column +} + func (*Indexed_columnContext) IsIndexed_columnContext() {} func NewIndexed_columnContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Indexed_columnContext { var p = new(Indexed_columnContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_indexed_column @@ -4532,33 +4782,18 @@ func (s *Indexed_columnContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Indexed_column() (localctx IIndexed_columnContext) { - this := p - _ = this - localctx = NewIndexed_columnContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 24, SQLiteParserRULE_indexed_column) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) p.SetState(413) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 30, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 30, p.GetParserRuleContext()) { case 1: { p.SetState(411) @@ -4571,15 +4806,24 @@ func (p *SQLiteParser) Indexed_column() (localctx IIndexed_columnContext) { p.expr(0) } + case antlr.ATNInvalidAltNumber: + goto errorExit } p.SetState(417) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserCOLLATE_ { { p.SetState(415) p.Match(SQLiteParserCOLLATE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(416) @@ -4589,6 +4833,9 @@ func (p *SQLiteParser) Indexed_column() (localctx IIndexed_columnContext) { } p.SetState(420) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserASC_ || _la == SQLiteParserDESC_ { @@ -4599,7 +4846,17 @@ func (p *SQLiteParser) Indexed_column() (localctx IIndexed_columnContext) { } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ITable_optionContext is an interface to support dynamic dispatch. @@ -4625,24 +4882,29 @@ type ITable_optionContext interface { } type Table_optionContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser row_ROW_ID antlr.Token } func NewEmptyTable_optionContext() *Table_optionContext { var p = new(Table_optionContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_table_option return p } +func InitEmptyTable_optionContext(p *Table_optionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_table_option +} + func (*Table_optionContext) IsTable_optionContext() {} func NewTable_optionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Table_optionContext { var p = new(Table_optionContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_table_option @@ -4689,30 +4951,13 @@ func (s *Table_optionContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Table_option() (localctx ITable_optionContext) { - this := p - _ = this - localctx = NewTable_optionContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 26, SQLiteParserRULE_table_option) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.SetState(425) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserWITHOUT_: @@ -4720,6 +4965,10 @@ func (p *SQLiteParser) Table_option() (localctx ITable_optionContext) { { p.SetState(422) p.Match(SQLiteParserWITHOUT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(423) @@ -4727,6 +4976,10 @@ func (p *SQLiteParser) Table_option() (localctx ITable_optionContext) { var _m = p.Match(SQLiteParserIDENTIFIER) localctx.(*Table_optionContext).row_ROW_ID = _m + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserSTRICT_: @@ -4734,13 +4987,28 @@ func (p *SQLiteParser) Table_option() (localctx ITable_optionContext) { { p.SetState(424) p.Match(SQLiteParserSTRICT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ICreate_table_stmtContext is an interface to support dynamic dispatch. @@ -4779,23 +5047,28 @@ type ICreate_table_stmtContext interface { } type Create_table_stmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyCreate_table_stmtContext() *Create_table_stmtContext { var p = new(Create_table_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_create_table_stmt return p } +func InitEmptyCreate_table_stmtContext(p *Create_table_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_create_table_stmt +} + func (*Create_table_stmtContext) IsCreate_table_stmtContext() {} func NewCreate_table_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Create_table_stmtContext { var p = new(Create_table_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_create_table_stmt @@ -5049,38 +5322,26 @@ func (s *Create_table_stmtContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Create_table_stmt() (localctx ICreate_table_stmtContext) { - this := p - _ = this - localctx = NewCreate_table_stmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 28, SQLiteParserRULE_create_table_stmt) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - var _alt int p.EnterOuterAlt(localctx, 1) { p.SetState(427) p.Match(SQLiteParserCREATE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(429) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserTEMP_ || _la == SQLiteParserTEMPORARY_ { @@ -5100,29 +5361,47 @@ func (p *SQLiteParser) Create_table_stmt() (localctx ICreate_table_stmtContext) { p.SetState(431) p.Match(SQLiteParserTABLE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(435) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 35, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 35, p.GetParserRuleContext()) == 1 { { p.SetState(432) p.Match(SQLiteParserIF_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(433) p.Match(SQLiteParserNOT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(434) p.Match(SQLiteParserEXISTS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } p.SetState(440) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 36, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 36, p.GetParserRuleContext()) == 1 { { p.SetState(437) p.Schema_name() @@ -5130,8 +5409,14 @@ func (p *SQLiteParser) Create_table_stmt() (localctx ICreate_table_stmtContext) { p.SetState(438) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { p.SetState(442) @@ -5139,12 +5424,19 @@ func (p *SQLiteParser) Create_table_stmt() (localctx ICreate_table_stmtContext) } p.SetState(472) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserOPEN_PAR: { p.SetState(443) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(444) @@ -5152,13 +5444,22 @@ func (p *SQLiteParser) Create_table_stmt() (localctx ICreate_table_stmtContext) } p.SetState(449) p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 37, p.GetParserRuleContext()) - + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 37, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } for _alt != 1 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1+1 { { p.SetState(445) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(446) @@ -5168,16 +5469,29 @@ func (p *SQLiteParser) Create_table_stmt() (localctx ICreate_table_stmtContext) } p.SetState(451) p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 37, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 37, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } } p.SetState(456) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { p.SetState(452) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(453) @@ -5186,14 +5500,24 @@ func (p *SQLiteParser) Create_table_stmt() (localctx ICreate_table_stmtContext) p.SetState(458) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { p.SetState(459) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(468) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserSTRICT_ || _la == SQLiteParserWITHOUT_ { @@ -5203,12 +5527,19 @@ func (p *SQLiteParser) Create_table_stmt() (localctx ICreate_table_stmtContext) } p.SetState(465) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { p.SetState(461) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(462) @@ -5217,6 +5548,9 @@ func (p *SQLiteParser) Create_table_stmt() (localctx ICreate_table_stmtContext) p.SetState(467) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } @@ -5226,6 +5560,10 @@ func (p *SQLiteParser) Create_table_stmt() (localctx ICreate_table_stmtContext) { p.SetState(470) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(471) @@ -5233,10 +5571,21 @@ func (p *SQLiteParser) Create_table_stmt() (localctx ICreate_table_stmtContext) } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IColumn_defContext is an interface to support dynamic dispatch. @@ -5257,23 +5606,28 @@ type IColumn_defContext interface { } type Column_defContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyColumn_defContext() *Column_defContext { var p = new(Column_defContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_column_def return p } +func InitEmptyColumn_defContext(p *Column_defContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_column_def +} + func (*Column_defContext) IsColumn_defContext() {} func NewColumn_defContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Column_defContext { var p = new(Column_defContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_column_def @@ -5377,29 +5731,9 @@ func (s *Column_defContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Column_def() (localctx IColumn_defContext) { - this := p - _ = this - localctx = NewColumn_defContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 30, SQLiteParserRULE_column_def) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - var _alt int + var _la int p.EnterOuterAlt(localctx, 1) { @@ -5409,31 +5743,47 @@ func (p *SQLiteParser) Column_def() (localctx IColumn_defContext) { p.SetState(476) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 42, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 42, p.GetParserRuleContext()) == 1 { { p.SetState(475) p.Type_name() } + } else if p.HasError() { // JIM + goto errorExit } p.SetState(481) p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 43, p.GetParserRuleContext()) - - for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { - if _alt == 1 { - { - p.SetState(478) - p.Column_constraint() - } + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + for ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&290693316557668352) != 0) || ((int64((_la-104)) & ^0x3f) == 0 && ((int64(1)<<(_la-104))&549755848705) != 0) || _la == SQLiteParserGENERATED_ { + { + p.SetState(478) + p.Column_constraint() } + p.SetState(483) p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 43, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IType_nameContext is an interface to support dynamic dispatch. @@ -5457,23 +5807,28 @@ type IType_nameContext interface { } type Type_nameContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyType_nameContext() *Type_nameContext { var p = new(Type_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_type_name return p } +func InitEmptyType_nameContext(p *Type_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_type_name +} + func (*Type_nameContext) IsType_nameContext() {} func NewType_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Type_nameContext { var p = new(Type_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_type_name @@ -5598,33 +5953,16 @@ func (s *Type_nameContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Type_name() (localctx IType_nameContext) { - this := p - _ = this - localctx = NewType_nameContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 32, SQLiteParserRULE_type_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - var _alt int p.EnterOuterAlt(localctx, 1) p.SetState(485) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _alt = 1 + 1 for ok := true; ok; ok = _alt != 1 && _alt != antlr.ATNInvalidAltNumber { switch _alt { @@ -5635,20 +5973,28 @@ func (p *SQLiteParser) Type_name() (localctx IType_nameContext) { } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } p.SetState(487) p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 44, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 44, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } } p.SetState(499) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 45, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 45, p.GetParserRuleContext()) == 1 { { p.SetState(489) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(490) @@ -5657,12 +6003,22 @@ func (p *SQLiteParser) Type_name() (localctx IType_nameContext) { { p.SetState(491) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - } else if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 45, p.GetParserRuleContext()) == 2 { + } else if p.HasError() { // JIM + goto errorExit + } else if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 45, p.GetParserRuleContext()) == 2 { { p.SetState(493) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(494) @@ -5671,6 +6027,10 @@ func (p *SQLiteParser) Type_name() (localctx IType_nameContext) { { p.SetState(495) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(496) @@ -5679,11 +6039,27 @@ func (p *SQLiteParser) Type_name() (localctx IType_nameContext) { { p.SetState(497) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IColumn_constraintContext is an interface to support dynamic dispatch. @@ -5725,23 +6101,28 @@ type IColumn_constraintContext interface { } type Column_constraintContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyColumn_constraintContext() *Column_constraintContext { var p = new(Column_constraintContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_column_constraint return p } +func InitEmptyColumn_constraintContext(p *Column_constraintContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_column_constraint +} + func (*Column_constraintContext) IsColumn_constraintContext() {} func NewColumn_constraintContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Column_constraintContext { var p = new(Column_constraintContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_column_constraint @@ -5968,38 +6349,26 @@ func (s *Column_constraintContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Column_constraint() (localctx IColumn_constraintContext) { - this := p - _ = this - localctx = NewColumn_constraintContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 34, SQLiteParserRULE_column_constraint) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) p.SetState(503) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserCONSTRAINT_ { { p.SetState(501) p.Match(SQLiteParserCONSTRAINT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(502) @@ -6009,19 +6378,33 @@ func (p *SQLiteParser) Column_constraint() (localctx IColumn_constraintContext) } p.SetState(552) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserPRIMARY_: { p.SetState(505) p.Match(SQLiteParserPRIMARY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(506) p.Match(SQLiteParserKEY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(508) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserASC_ || _la == SQLiteParserDESC_ { @@ -6033,6 +6416,9 @@ func (p *SQLiteParser) Column_constraint() (localctx IColumn_constraintContext) } p.SetState(511) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserON_ { @@ -6044,12 +6430,19 @@ func (p *SQLiteParser) Column_constraint() (localctx IColumn_constraintContext) } p.SetState(514) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserAUTOINCREMENT_ { { p.SetState(513) p.Match(SQLiteParserAUTOINCREMENT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } @@ -6057,29 +6450,48 @@ func (p *SQLiteParser) Column_constraint() (localctx IColumn_constraintContext) case SQLiteParserNOT_, SQLiteParserUNIQUE_: p.SetState(519) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserNOT_: { p.SetState(516) p.Match(SQLiteParserNOT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(517) p.Match(SQLiteParserNULL_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserUNIQUE_: { p.SetState(518) p.Match(SQLiteParserUNIQUE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } p.SetState(522) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserON_ { @@ -6094,10 +6506,18 @@ func (p *SQLiteParser) Column_constraint() (localctx IColumn_constraintContext) { p.SetState(524) p.Match(SQLiteParserCHECK_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(525) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(526) @@ -6106,16 +6526,28 @@ func (p *SQLiteParser) Column_constraint() (localctx IColumn_constraintContext) { p.SetState(527) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserDEFAULT_: { p.SetState(529) p.Match(SQLiteParserDEFAULT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(536) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 52, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 52, p.GetParserRuleContext()) { case 1: { p.SetState(530) @@ -6132,6 +6564,10 @@ func (p *SQLiteParser) Column_constraint() (localctx IColumn_constraintContext) { p.SetState(532) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(533) @@ -6140,14 +6576,24 @@ func (p *SQLiteParser) Column_constraint() (localctx IColumn_constraintContext) { p.SetState(534) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + case antlr.ATNInvalidAltNumber: + goto errorExit } case SQLiteParserCOLLATE_: { p.SetState(538) p.Match(SQLiteParserCOLLATE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(539) @@ -6163,26 +6609,45 @@ func (p *SQLiteParser) Column_constraint() (localctx IColumn_constraintContext) case SQLiteParserAS_, SQLiteParserGENERATED_: p.SetState(543) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserGENERATED_ { { p.SetState(541) p.Match(SQLiteParserGENERATED_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(542) p.Match(SQLiteParserALWAYS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } { p.SetState(545) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(546) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(547) @@ -6191,9 +6656,16 @@ func (p *SQLiteParser) Column_constraint() (localctx IColumn_constraintContext) { p.SetState(548) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(550) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserVIRTUAL_ || _la == SQLiteParserSTORED_ { @@ -6212,10 +6684,21 @@ func (p *SQLiteParser) Column_constraint() (localctx IColumn_constraintContext) } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ISigned_numberContext is an interface to support dynamic dispatch. @@ -6235,23 +6718,28 @@ type ISigned_numberContext interface { } type Signed_numberContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptySigned_numberContext() *Signed_numberContext { var p = new(Signed_numberContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_signed_number return p } +func InitEmptySigned_numberContext(p *Signed_numberContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_signed_number +} + func (*Signed_numberContext) IsSigned_numberContext() {} func NewSigned_numberContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Signed_numberContext { var p = new(Signed_numberContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_signed_number @@ -6294,32 +6782,16 @@ func (s *Signed_numberContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Signed_number() (localctx ISigned_numberContext) { - this := p - _ = this - localctx = NewSigned_numberContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 36, SQLiteParserRULE_signed_number) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) p.SetState(555) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserPLUS || _la == SQLiteParserMINUS { @@ -6339,9 +6811,23 @@ func (p *SQLiteParser) Signed_number() (localctx ISigned_numberContext) { { p.SetState(557) p.Match(SQLiteParserNUMERIC_LITERAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ITable_constraintContext is an interface to support dynamic dispatch. @@ -6376,23 +6862,28 @@ type ITable_constraintContext interface { } type Table_constraintContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyTable_constraintContext() *Table_constraintContext { var p = new(Table_constraintContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_table_constraint return p } +func InitEmptyTable_constraintContext(p *Table_constraintContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_table_constraint +} + func (*Table_constraintContext) IsTable_constraintContext() {} func NewTable_constraintContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Table_constraintContext { var p = new(Table_constraintContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_table_constraint @@ -6609,38 +7100,26 @@ func (s *Table_constraintContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Table_constraint() (localctx ITable_constraintContext) { - this := p - _ = this - localctx = NewTable_constraintContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 38, SQLiteParserRULE_table_constraint) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) p.SetState(561) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserCONSTRAINT_ { { p.SetState(559) p.Match(SQLiteParserCONSTRAINT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(560) @@ -6650,35 +7129,58 @@ func (p *SQLiteParser) Table_constraint() (localctx ITable_constraintContext) { } p.SetState(600) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserPRIMARY_, SQLiteParserUNIQUE_: p.SetState(566) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserPRIMARY_: { p.SetState(563) p.Match(SQLiteParserPRIMARY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(564) p.Match(SQLiteParserKEY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserUNIQUE_: { p.SetState(565) p.Match(SQLiteParserUNIQUE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } { p.SetState(568) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(569) @@ -6686,12 +7188,19 @@ func (p *SQLiteParser) Table_constraint() (localctx ITable_constraintContext) { } p.SetState(574) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { p.SetState(570) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(571) @@ -6700,14 +7209,24 @@ func (p *SQLiteParser) Table_constraint() (localctx ITable_constraintContext) { p.SetState(576) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { p.SetState(577) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(579) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserON_ { @@ -6722,10 +7241,18 @@ func (p *SQLiteParser) Table_constraint() (localctx ITable_constraintContext) { { p.SetState(581) p.Match(SQLiteParserCHECK_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(582) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(583) @@ -6734,20 +7261,36 @@ func (p *SQLiteParser) Table_constraint() (localctx ITable_constraintContext) { { p.SetState(584) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserFOREIGN_: { p.SetState(586) p.Match(SQLiteParserFOREIGN_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(587) p.Match(SQLiteParserKEY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(588) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(589) @@ -6755,12 +7298,19 @@ func (p *SQLiteParser) Table_constraint() (localctx ITable_constraintContext) { } p.SetState(594) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { p.SetState(590) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(591) @@ -6769,11 +7319,18 @@ func (p *SQLiteParser) Table_constraint() (localctx ITable_constraintContext) { p.SetState(596) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { p.SetState(597) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(598) @@ -6781,10 +7338,21 @@ func (p *SQLiteParser) Table_constraint() (localctx ITable_constraintContext) { } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IForeign_key_clauseContext is an interface to support dynamic dispatch. @@ -6838,23 +7406,28 @@ type IForeign_key_clauseContext interface { } type Foreign_key_clauseContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyForeign_key_clauseContext() *Foreign_key_clauseContext { var p = new(Foreign_key_clauseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_foreign_key_clause return p } +func InitEmptyForeign_key_clauseContext(p *Foreign_key_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_foreign_key_clause +} + func (*Foreign_key_clauseContext) IsForeign_key_clauseContext() {} func NewForeign_key_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Foreign_key_clauseContext { var p = new(Foreign_key_clauseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_foreign_key_clause @@ -7111,33 +7684,18 @@ func (s *Foreign_key_clauseContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Foreign_key_clause() (localctx IForeign_key_clauseContext) { - this := p - _ = this - localctx = NewForeign_key_clauseContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 40, SQLiteParserRULE_foreign_key_clause) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { p.SetState(602) p.Match(SQLiteParserREFERENCES_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(603) @@ -7145,12 +7703,19 @@ func (p *SQLiteParser) Foreign_key_clause() (localctx IForeign_key_clauseContext } p.SetState(615) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserOPEN_PAR { { p.SetState(604) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(605) @@ -7158,12 +7723,19 @@ func (p *SQLiteParser) Foreign_key_clause() (localctx IForeign_key_clauseContext } p.SetState(610) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { p.SetState(606) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(607) @@ -7172,27 +7744,44 @@ func (p *SQLiteParser) Foreign_key_clause() (localctx IForeign_key_clauseContext p.SetState(612) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { p.SetState(613) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } p.SetState(631) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserMATCH_ || _la == SQLiteParserON_ { p.SetState(629) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserON_: { p.SetState(617) p.Match(SQLiteParserON_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(618) @@ -7207,12 +7796,19 @@ func (p *SQLiteParser) Foreign_key_clause() (localctx IForeign_key_clauseContext } p.SetState(625) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserSET_: { p.SetState(619) p.Match(SQLiteParserSET_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(620) @@ -7230,32 +7826,53 @@ func (p *SQLiteParser) Foreign_key_clause() (localctx IForeign_key_clauseContext { p.SetState(621) p.Match(SQLiteParserCASCADE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserRESTRICT_: { p.SetState(622) p.Match(SQLiteParserRESTRICT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserNO_: { p.SetState(623) p.Match(SQLiteParserNO_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(624) p.Match(SQLiteParserACTION_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } case SQLiteParserMATCH_: { p.SetState(627) p.Match(SQLiteParserMATCH_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(628) @@ -7263,40 +7880,62 @@ func (p *SQLiteParser) Foreign_key_clause() (localctx IForeign_key_clauseContext } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } p.SetState(633) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } p.SetState(642) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 70, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 70, p.GetParserRuleContext()) == 1 { p.SetState(635) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserNOT_ { { p.SetState(634) p.Match(SQLiteParserNOT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } { p.SetState(637) p.Match(SQLiteParserDEFERRABLE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(640) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserINITIALLY_ { { p.SetState(638) p.Match(SQLiteParserINITIALLY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(639) @@ -7312,9 +7951,21 @@ func (p *SQLiteParser) Foreign_key_clause() (localctx IForeign_key_clauseContext } + } else if p.HasError() { // JIM + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IConflict_clauseContext is an interface to support dynamic dispatch. @@ -7338,23 +7989,28 @@ type IConflict_clauseContext interface { } type Conflict_clauseContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyConflict_clauseContext() *Conflict_clauseContext { var p = new(Conflict_clauseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_conflict_clause return p } +func InitEmptyConflict_clauseContext(p *Conflict_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_conflict_clause +} + func (*Conflict_clauseContext) IsConflict_clauseContext() {} func NewConflict_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Conflict_clauseContext { var p = new(Conflict_clauseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_conflict_clause @@ -7413,43 +8069,32 @@ func (s *Conflict_clauseContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Conflict_clause() (localctx IConflict_clauseContext) { - this := p - _ = this - localctx = NewConflict_clauseContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 42, SQLiteParserRULE_conflict_clause) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { p.SetState(644) p.Match(SQLiteParserON_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(645) p.Match(SQLiteParserCONFLICT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(646) _la = p.GetTokenStream().LA(1) - if !(_la == SQLiteParserABORT_ || ((int64((_la-72)) & ^0x3f) == 0 && ((int64(1)<<(_la-72))&19140298416325121) != 0)) { + if !(_la == SQLiteParserABORT_ || ((int64((_la-74)) & ^0x3f) == 0 && ((int64(1)<<(_la-74))&19140298416325121) != 0)) { p.GetErrorHandler().RecoverInline(p) } else { p.GetErrorHandler().ReportMatch(p) @@ -7457,7 +8102,17 @@ func (p *SQLiteParser) Conflict_clause() (localctx IConflict_clauseContext) { } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ICreate_trigger_stmtContext is an interface to support dynamic dispatch. @@ -7515,23 +8170,28 @@ type ICreate_trigger_stmtContext interface { } type Create_trigger_stmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyCreate_trigger_stmtContext() *Create_trigger_stmtContext { var p = new(Create_trigger_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_create_trigger_stmt return p } +func InitEmptyCreate_trigger_stmtContext(p *Create_trigger_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_create_trigger_stmt +} + func (*Create_trigger_stmtContext) IsCreate_trigger_stmtContext() {} func NewCreate_trigger_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Create_trigger_stmtContext { var p = new(Create_trigger_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_create_trigger_stmt @@ -7939,36 +8599,24 @@ func (s *Create_trigger_stmtContext) ExitRule(listener antlr.ParseTreeListener) } func (p *SQLiteParser) Create_trigger_stmt() (localctx ICreate_trigger_stmtContext) { - this := p - _ = this - localctx = NewCreate_trigger_stmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 44, SQLiteParserRULE_create_trigger_stmt) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { p.SetState(648) p.Match(SQLiteParserCREATE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(650) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserTEMP_ || _la == SQLiteParserTEMPORARY_ { @@ -7988,29 +8636,47 @@ func (p *SQLiteParser) Create_trigger_stmt() (localctx ICreate_trigger_stmtConte { p.SetState(652) p.Match(SQLiteParserTRIGGER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(656) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 72, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 72, p.GetParserRuleContext()) == 1 { { p.SetState(653) p.Match(SQLiteParserIF_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(654) p.Match(SQLiteParserNOT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(655) p.Match(SQLiteParserEXISTS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } p.SetState(661) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 73, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 73, p.GetParserRuleContext()) == 1 { { p.SetState(658) p.Schema_name() @@ -8018,8 +8684,14 @@ func (p *SQLiteParser) Create_trigger_stmt() (localctx ICreate_trigger_stmtConte { p.SetState(659) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { p.SetState(663) @@ -8027,28 +8699,46 @@ func (p *SQLiteParser) Create_trigger_stmt() (localctx ICreate_trigger_stmtConte } p.SetState(668) p.GetErrorHandler().Sync(p) - + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserBEFORE_: { p.SetState(664) p.Match(SQLiteParserBEFORE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserAFTER_: { p.SetState(665) p.Match(SQLiteParserAFTER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserINSTEAD_: { p.SetState(666) p.Match(SQLiteParserINSTEAD_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(667) p.Match(SQLiteParserOF_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserDELETE_, SQLiteParserINSERT_, SQLiteParserUPDATE_: @@ -8057,33 +8747,55 @@ func (p *SQLiteParser) Create_trigger_stmt() (localctx ICreate_trigger_stmtConte } p.SetState(684) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserDELETE_: { p.SetState(670) p.Match(SQLiteParserDELETE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserINSERT_: { p.SetState(671) p.Match(SQLiteParserINSERT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserUPDATE_: { p.SetState(672) p.Match(SQLiteParserUPDATE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(682) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserOF_ { { p.SetState(673) p.Match(SQLiteParserOF_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(674) @@ -8091,12 +8803,19 @@ func (p *SQLiteParser) Create_trigger_stmt() (localctx ICreate_trigger_stmtConte } p.SetState(679) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { p.SetState(675) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(676) @@ -8105,17 +8824,25 @@ func (p *SQLiteParser) Create_trigger_stmt() (localctx ICreate_trigger_stmtConte p.SetState(681) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } { p.SetState(686) p.Match(SQLiteParserON_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(687) @@ -8123,31 +8850,53 @@ func (p *SQLiteParser) Create_trigger_stmt() (localctx ICreate_trigger_stmtConte } p.SetState(691) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserFOR_ { { p.SetState(688) p.Match(SQLiteParserFOR_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(689) p.Match(SQLiteParserEACH_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(690) p.Match(SQLiteParserROW_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } p.SetState(695) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserWHEN_ { { p.SetState(693) p.Match(SQLiteParserWHEN_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(694) @@ -8158,15 +8907,26 @@ func (p *SQLiteParser) Create_trigger_stmt() (localctx ICreate_trigger_stmtConte { p.SetState(697) p.Match(SQLiteParserBEGIN_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(706) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) - for ok := true; ok; ok = _la == SQLiteParserDEFAULT_ || _la == SQLiteParserDELETE_ || ((int64((_la-88)) & ^0x3f) == 0 && ((int64(1)<<(_la-88))&4773820020239106049) != 0) { + for ok := true; ok; ok = _la == SQLiteParserDELETE_ || ((int64((_la-90)) & ^0x3f) == 0 && ((int64(1)<<(_la-90))&4773820020239106049) != 0) { p.SetState(702) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 80, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 80, p.GetParserRuleContext()) { case 1: { p.SetState(698) @@ -8191,22 +8951,45 @@ func (p *SQLiteParser) Create_trigger_stmt() (localctx ICreate_trigger_stmtConte p.Select_stmt() } + case antlr.ATNInvalidAltNumber: + goto errorExit } { p.SetState(704) p.Match(SQLiteParserSCOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(708) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { p.SetState(710) p.Match(SQLiteParserEND_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ICreate_view_stmtContext is an interface to support dynamic dispatch. @@ -8241,23 +9024,28 @@ type ICreate_view_stmtContext interface { } type Create_view_stmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyCreate_view_stmtContext() *Create_view_stmtContext { var p = new(Create_view_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_create_view_stmt return p } +func InitEmptyCreate_view_stmtContext(p *Create_view_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_create_view_stmt +} + func (*Create_view_stmtContext) IsCreate_view_stmtContext() {} func NewCreate_view_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Create_view_stmtContext { var p = new(Create_view_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_create_view_stmt @@ -8429,36 +9217,24 @@ func (s *Create_view_stmtContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Create_view_stmt() (localctx ICreate_view_stmtContext) { - this := p - _ = this - localctx = NewCreate_view_stmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 46, SQLiteParserRULE_create_view_stmt) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { p.SetState(712) p.Match(SQLiteParserCREATE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(714) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserTEMP_ || _la == SQLiteParserTEMPORARY_ { @@ -8478,29 +9254,47 @@ func (p *SQLiteParser) Create_view_stmt() (localctx ICreate_view_stmtContext) { { p.SetState(716) p.Match(SQLiteParserVIEW_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(720) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 83, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 83, p.GetParserRuleContext()) == 1 { { p.SetState(717) p.Match(SQLiteParserIF_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(718) p.Match(SQLiteParserNOT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(719) p.Match(SQLiteParserEXISTS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } p.SetState(725) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 84, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 84, p.GetParserRuleContext()) == 1 { { p.SetState(722) p.Schema_name() @@ -8508,8 +9302,14 @@ func (p *SQLiteParser) Create_view_stmt() (localctx ICreate_view_stmtContext) { { p.SetState(723) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { p.SetState(727) @@ -8517,12 +9317,19 @@ func (p *SQLiteParser) Create_view_stmt() (localctx ICreate_view_stmtContext) { } p.SetState(739) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserOPEN_PAR { { p.SetState(728) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(729) @@ -8530,12 +9337,19 @@ func (p *SQLiteParser) Create_view_stmt() (localctx ICreate_view_stmtContext) { } p.SetState(734) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { p.SetState(730) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(731) @@ -8544,24 +9358,45 @@ func (p *SQLiteParser) Create_view_stmt() (localctx ICreate_view_stmtContext) { p.SetState(736) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { p.SetState(737) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } { p.SetState(741) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(742) p.Select_stmt() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ICreate_virtual_table_stmtContext is an interface to support dynamic dispatch. @@ -8595,23 +9430,28 @@ type ICreate_virtual_table_stmtContext interface { } type Create_virtual_table_stmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyCreate_virtual_table_stmtContext() *Create_virtual_table_stmtContext { var p = new(Create_virtual_table_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_create_virtual_table_stmt return p } +func InitEmptyCreate_virtual_table_stmtContext(p *Create_virtual_table_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_create_virtual_table_stmt +} + func (*Create_virtual_table_stmtContext) IsCreate_virtual_table_stmtContext() {} func NewCreate_virtual_table_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Create_virtual_table_stmtContext { var p = new(Create_virtual_table_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_create_virtual_table_stmt @@ -8779,64 +9619,71 @@ func (s *Create_virtual_table_stmtContext) ExitRule(listener antlr.ParseTreeList } func (p *SQLiteParser) Create_virtual_table_stmt() (localctx ICreate_virtual_table_stmtContext) { - this := p - _ = this - localctx = NewCreate_virtual_table_stmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 48, SQLiteParserRULE_create_virtual_table_stmt) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { p.SetState(744) p.Match(SQLiteParserCREATE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(745) p.Match(SQLiteParserVIRTUAL_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(746) p.Match(SQLiteParserTABLE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(750) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 87, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 87, p.GetParserRuleContext()) == 1 { { p.SetState(747) p.Match(SQLiteParserIF_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(748) p.Match(SQLiteParserNOT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(749) p.Match(SQLiteParserEXISTS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } p.SetState(755) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 88, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 88, p.GetParserRuleContext()) == 1 { { p.SetState(752) p.Schema_name() @@ -8844,8 +9691,14 @@ func (p *SQLiteParser) Create_virtual_table_stmt() (localctx ICreate_virtual_tab { p.SetState(753) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { p.SetState(757) @@ -8854,6 +9707,10 @@ func (p *SQLiteParser) Create_virtual_table_stmt() (localctx ICreate_virtual_tab { p.SetState(758) p.Match(SQLiteParserUSING_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(759) @@ -8861,12 +9718,19 @@ func (p *SQLiteParser) Create_virtual_table_stmt() (localctx ICreate_virtual_tab } p.SetState(771) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserOPEN_PAR { { p.SetState(760) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(761) @@ -8874,12 +9738,19 @@ func (p *SQLiteParser) Create_virtual_table_stmt() (localctx ICreate_virtual_tab } p.SetState(766) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { p.SetState(762) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(763) @@ -8888,16 +9759,33 @@ func (p *SQLiteParser) Create_virtual_table_stmt() (localctx ICreate_virtual_tab p.SetState(768) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { p.SetState(769) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IWith_clauseContext is an interface to support dynamic dispatch. @@ -8928,23 +9816,28 @@ type IWith_clauseContext interface { } type With_clauseContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyWith_clauseContext() *With_clauseContext { var p = new(With_clauseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_with_clause return p } +func InitEmptyWith_clauseContext(p *With_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_with_clause +} + func (*With_clauseContext) IsWith_clauseContext() {} func NewWith_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *With_clauseContext { var p = new(With_clauseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_with_clause @@ -9097,43 +9990,34 @@ func (s *With_clauseContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) With_clause() (localctx IWith_clauseContext) { - this := p - _ = this - localctx = NewWith_clauseContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 50, SQLiteParserRULE_with_clause) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { p.SetState(773) p.Match(SQLiteParserWITH_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(775) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 91, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 91, p.GetParserRuleContext()) == 1 { { p.SetState(774) p.Match(SQLiteParserRECURSIVE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { p.SetState(777) @@ -9142,10 +10026,18 @@ func (p *SQLiteParser) With_clause() (localctx IWith_clauseContext) { { p.SetState(778) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(779) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(780) @@ -9154,15 +10046,26 @@ func (p *SQLiteParser) With_clause() (localctx IWith_clauseContext) { { p.SetState(781) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(791) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { p.SetState(782) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(783) @@ -9171,10 +10074,18 @@ func (p *SQLiteParser) With_clause() (localctx IWith_clauseContext) { { p.SetState(784) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(785) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(786) @@ -9183,14 +10094,31 @@ func (p *SQLiteParser) With_clause() (localctx IWith_clauseContext) { { p.SetState(787) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(793) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ICte_table_nameContext is an interface to support dynamic dispatch. @@ -9214,23 +10142,28 @@ type ICte_table_nameContext interface { } type Cte_table_nameContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyCte_table_nameContext() *Cte_table_nameContext { var p = new(Cte_table_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_cte_table_name return p } +func InitEmptyCte_table_nameContext(p *Cte_table_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_cte_table_name +} + func (*Cte_table_nameContext) IsCte_table_nameContext() {} func NewCte_table_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Cte_table_nameContext { var p = new(Cte_table_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_cte_table_name @@ -9334,29 +10267,10 @@ func (s *Cte_table_nameContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Cte_table_name() (localctx ICte_table_nameContext) { - this := p - _ = this - localctx = NewCte_table_nameContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 52, SQLiteParserRULE_cte_table_name) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { p.SetState(794) @@ -9364,12 +10278,19 @@ func (p *SQLiteParser) Cte_table_name() (localctx ICte_table_nameContext) { } p.SetState(806) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserOPEN_PAR { { p.SetState(795) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(796) @@ -9377,12 +10298,19 @@ func (p *SQLiteParser) Cte_table_name() (localctx ICte_table_nameContext) { } p.SetState(801) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { p.SetState(797) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(798) @@ -9391,16 +10319,33 @@ func (p *SQLiteParser) Cte_table_name() (localctx ICte_table_nameContext) { p.SetState(803) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { p.SetState(804) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IRecursive_cteContext is an interface to support dynamic dispatch. @@ -9425,23 +10370,28 @@ type IRecursive_cteContext interface { } type Recursive_cteContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyRecursive_cteContext() *Recursive_cteContext { var p = new(Recursive_cteContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_recursive_cte return p } +func InitEmptyRecursive_cteContext(p *Recursive_cteContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_recursive_cte +} + func (*Recursive_cteContext) IsRecursive_cteContext() {} func NewRecursive_cteContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Recursive_cteContext { var p = new(Recursive_cteContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_recursive_cte @@ -9540,29 +10490,10 @@ func (s *Recursive_cteContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Recursive_cte() (localctx IRecursive_cteContext) { - this := p - _ = this - localctx = NewRecursive_cteContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 54, SQLiteParserRULE_recursive_cte) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { p.SetState(808) @@ -9571,10 +10502,18 @@ func (p *SQLiteParser) Recursive_cte() (localctx IRecursive_cteContext) { { p.SetState(809) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(810) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(811) @@ -9583,15 +10522,26 @@ func (p *SQLiteParser) Recursive_cte() (localctx IRecursive_cteContext) { { p.SetState(812) p.Match(SQLiteParserUNION_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(814) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserALL_ { { p.SetState(813) p.Match(SQLiteParserALL_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } @@ -9602,9 +10552,23 @@ func (p *SQLiteParser) Recursive_cte() (localctx IRecursive_cteContext) { { p.SetState(817) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ICommon_table_expressionContext is an interface to support dynamic dispatch. @@ -9632,23 +10596,28 @@ type ICommon_table_expressionContext interface { } type Common_table_expressionContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyCommon_table_expressionContext() *Common_table_expressionContext { var p = new(Common_table_expressionContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_common_table_expression return p } +func InitEmptyCommon_table_expressionContext(p *Common_table_expressionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_common_table_expression +} + func (*Common_table_expressionContext) IsCommon_table_expressionContext() {} func NewCommon_table_expressionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Common_table_expressionContext { var p = new(Common_table_expressionContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_common_table_expression @@ -9780,29 +10749,10 @@ func (s *Common_table_expressionContext) ExitRule(listener antlr.ParseTreeListen } func (p *SQLiteParser) Common_table_expression() (localctx ICommon_table_expressionContext) { - this := p - _ = this - localctx = NewCommon_table_expressionContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 56, SQLiteParserRULE_common_table_expression) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { p.SetState(819) @@ -9810,12 +10760,19 @@ func (p *SQLiteParser) Common_table_expression() (localctx ICommon_table_express } p.SetState(831) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserOPEN_PAR { { p.SetState(820) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(821) @@ -9823,12 +10780,19 @@ func (p *SQLiteParser) Common_table_expression() (localctx ICommon_table_express } p.SetState(826) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { p.SetState(822) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(823) @@ -9837,21 +10801,36 @@ func (p *SQLiteParser) Common_table_expression() (localctx ICommon_table_express p.SetState(828) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { p.SetState(829) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } { p.SetState(833) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(834) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(835) @@ -9860,9 +10839,23 @@ func (p *SQLiteParser) Common_table_expression() (localctx ICommon_table_express { p.SetState(836) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IReturning_clauseContext is an interface to support dynamic dispatch. @@ -9890,23 +10883,28 @@ type IReturning_clauseContext interface { } type Returning_clauseContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyReturning_clauseContext() *Returning_clauseContext { var p = new(Returning_clauseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_returning_clause return p } +func InitEmptyReturning_clauseContext(p *Returning_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_returning_clause +} + func (*Returning_clauseContext) IsReturning_clauseContext() {} func NewReturning_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Returning_clauseContext { var p = new(Returning_clauseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_returning_clause @@ -10047,43 +11045,35 @@ func (s *Returning_clauseContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Returning_clause() (localctx IReturning_clauseContext) { - this := p - _ = this - localctx = NewReturning_clauseContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 58, SQLiteParserRULE_returning_clause) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { p.SetState(838) p.Match(SQLiteParserRETURNING_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(847) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserSTAR: { p.SetState(839) p.Match(SQLiteParserSTAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserOPEN_PAR, SQLiteParserPLUS, SQLiteParserMINUS, SQLiteParserTILDE, SQLiteParserABORT_, SQLiteParserACTION_, SQLiteParserADD_, SQLiteParserAFTER_, SQLiteParserALL_, SQLiteParserALTER_, SQLiteParserANALYZE_, SQLiteParserAND_, SQLiteParserAS_, SQLiteParserASC_, SQLiteParserATTACH_, SQLiteParserAUTOINCREMENT_, SQLiteParserBEFORE_, SQLiteParserBEGIN_, SQLiteParserBETWEEN_, SQLiteParserBY_, SQLiteParserCASCADE_, SQLiteParserCASE_, SQLiteParserCAST_, SQLiteParserCHECK_, SQLiteParserCOLLATE_, SQLiteParserCOLUMN_, SQLiteParserCOMMIT_, SQLiteParserCONFLICT_, SQLiteParserCONSTRAINT_, SQLiteParserCREATE_, SQLiteParserCROSS_, SQLiteParserCURRENT_DATE_, SQLiteParserCURRENT_TIME_, SQLiteParserCURRENT_TIMESTAMP_, SQLiteParserDATABASE_, SQLiteParserDEFAULT_, SQLiteParserDEFERRABLE_, SQLiteParserDEFERRED_, SQLiteParserDELETE_, SQLiteParserDESC_, SQLiteParserDETACH_, SQLiteParserDISTINCT_, SQLiteParserDROP_, SQLiteParserEACH_, SQLiteParserELSE_, SQLiteParserEND_, SQLiteParserESCAPE_, SQLiteParserEXCEPT_, SQLiteParserEXCLUSIVE_, SQLiteParserEXISTS_, SQLiteParserEXPLAIN_, SQLiteParserFAIL_, SQLiteParserFOR_, SQLiteParserFOREIGN_, SQLiteParserFROM_, SQLiteParserFULL_, SQLiteParserGLOB_, SQLiteParserGROUP_, SQLiteParserHAVING_, SQLiteParserIF_, SQLiteParserIGNORE_, SQLiteParserIMMEDIATE_, SQLiteParserIN_, SQLiteParserINDEX_, SQLiteParserINDEXED_, SQLiteParserINITIALLY_, SQLiteParserINNER_, SQLiteParserINSERT_, SQLiteParserINSTEAD_, SQLiteParserINTERSECT_, SQLiteParserINTO_, SQLiteParserIS_, SQLiteParserISNULL_, SQLiteParserJOIN_, SQLiteParserKEY_, SQLiteParserLEFT_, SQLiteParserLIKE_, SQLiteParserLIMIT_, SQLiteParserMATCH_, SQLiteParserNATURAL_, SQLiteParserNO_, SQLiteParserNOT_, SQLiteParserNOTNULL_, SQLiteParserNULL_, SQLiteParserOF_, SQLiteParserOFFSET_, SQLiteParserON_, SQLiteParserOR_, SQLiteParserORDER_, SQLiteParserOUTER_, SQLiteParserPLAN_, SQLiteParserPRAGMA_, SQLiteParserPRIMARY_, SQLiteParserQUERY_, SQLiteParserRAISE_, SQLiteParserRECURSIVE_, SQLiteParserREFERENCES_, SQLiteParserREGEXP_, SQLiteParserREINDEX_, SQLiteParserRELEASE_, SQLiteParserRENAME_, SQLiteParserREPLACE_, SQLiteParserRESTRICT_, SQLiteParserRETURNING_, SQLiteParserRIGHT_, SQLiteParserROLLBACK_, SQLiteParserROW_, SQLiteParserROWS_, SQLiteParserSAVEPOINT_, SQLiteParserSELECT_, SQLiteParserSET_, SQLiteParserSTRICT_, SQLiteParserTABLE_, SQLiteParserTEMP_, SQLiteParserTEMPORARY_, SQLiteParserTHEN_, SQLiteParserTO_, SQLiteParserTRANSACTION_, SQLiteParserTRIGGER_, SQLiteParserUNION_, SQLiteParserUNIQUE_, SQLiteParserUPDATE_, SQLiteParserUSING_, SQLiteParserVACUUM_, SQLiteParserVALUES_, SQLiteParserVIEW_, SQLiteParserVIRTUAL_, SQLiteParserWHEN_, SQLiteParserWHERE_, SQLiteParserWITH_, SQLiteParserWITHOUT_, SQLiteParserFIRST_VALUE_, SQLiteParserOVER_, SQLiteParserPARTITION_, SQLiteParserRANGE_, SQLiteParserPRECEDING_, SQLiteParserUNBOUNDED_, SQLiteParserCURRENT_, SQLiteParserFOLLOWING_, SQLiteParserCUME_DIST_, SQLiteParserDENSE_RANK_, SQLiteParserLAG_, SQLiteParserLAST_VALUE_, SQLiteParserLEAD_, SQLiteParserNTH_VALUE_, SQLiteParserNTILE_, SQLiteParserPERCENT_RANK_, SQLiteParserRANK_, SQLiteParserROW_NUMBER_, SQLiteParserGENERATED_, SQLiteParserALWAYS_, SQLiteParserSTORED_, SQLiteParserTRUE_, SQLiteParserFALSE_, SQLiteParserWINDOW_, SQLiteParserNULLS_, SQLiteParserFIRST_, SQLiteParserLAST_, SQLiteParserFILTER_, SQLiteParserGROUPS_, SQLiteParserEXCLUDE_, SQLiteParserIDENTIFIER, SQLiteParserNUMERIC_LITERAL, SQLiteParserNUMBERED_BIND_PARAMETER, SQLiteParserNAMED_BIND_PARAMETER, SQLiteParserSTRING_LITERAL, SQLiteParserBLOB_LITERAL: @@ -10093,17 +11083,27 @@ func (p *SQLiteParser) Returning_clause() (localctx IReturning_clauseContext) { } p.SetState(845) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserAS_ || _la == SQLiteParserIDENTIFIER || _la == SQLiteParserSTRING_LITERAL { p.SetState(842) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserAS_ { { p.SetState(841) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } @@ -10115,25 +11115,40 @@ func (p *SQLiteParser) Returning_clause() (localctx IReturning_clauseContext) { } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } p.SetState(862) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { p.SetState(849) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(858) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserSTAR: { p.SetState(850) p.Match(SQLiteParserSTAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserOPEN_PAR, SQLiteParserPLUS, SQLiteParserMINUS, SQLiteParserTILDE, SQLiteParserABORT_, SQLiteParserACTION_, SQLiteParserADD_, SQLiteParserAFTER_, SQLiteParserALL_, SQLiteParserALTER_, SQLiteParserANALYZE_, SQLiteParserAND_, SQLiteParserAS_, SQLiteParserASC_, SQLiteParserATTACH_, SQLiteParserAUTOINCREMENT_, SQLiteParserBEFORE_, SQLiteParserBEGIN_, SQLiteParserBETWEEN_, SQLiteParserBY_, SQLiteParserCASCADE_, SQLiteParserCASE_, SQLiteParserCAST_, SQLiteParserCHECK_, SQLiteParserCOLLATE_, SQLiteParserCOLUMN_, SQLiteParserCOMMIT_, SQLiteParserCONFLICT_, SQLiteParserCONSTRAINT_, SQLiteParserCREATE_, SQLiteParserCROSS_, SQLiteParserCURRENT_DATE_, SQLiteParserCURRENT_TIME_, SQLiteParserCURRENT_TIMESTAMP_, SQLiteParserDATABASE_, SQLiteParserDEFAULT_, SQLiteParserDEFERRABLE_, SQLiteParserDEFERRED_, SQLiteParserDELETE_, SQLiteParserDESC_, SQLiteParserDETACH_, SQLiteParserDISTINCT_, SQLiteParserDROP_, SQLiteParserEACH_, SQLiteParserELSE_, SQLiteParserEND_, SQLiteParserESCAPE_, SQLiteParserEXCEPT_, SQLiteParserEXCLUSIVE_, SQLiteParserEXISTS_, SQLiteParserEXPLAIN_, SQLiteParserFAIL_, SQLiteParserFOR_, SQLiteParserFOREIGN_, SQLiteParserFROM_, SQLiteParserFULL_, SQLiteParserGLOB_, SQLiteParserGROUP_, SQLiteParserHAVING_, SQLiteParserIF_, SQLiteParserIGNORE_, SQLiteParserIMMEDIATE_, SQLiteParserIN_, SQLiteParserINDEX_, SQLiteParserINDEXED_, SQLiteParserINITIALLY_, SQLiteParserINNER_, SQLiteParserINSERT_, SQLiteParserINSTEAD_, SQLiteParserINTERSECT_, SQLiteParserINTO_, SQLiteParserIS_, SQLiteParserISNULL_, SQLiteParserJOIN_, SQLiteParserKEY_, SQLiteParserLEFT_, SQLiteParserLIKE_, SQLiteParserLIMIT_, SQLiteParserMATCH_, SQLiteParserNATURAL_, SQLiteParserNO_, SQLiteParserNOT_, SQLiteParserNOTNULL_, SQLiteParserNULL_, SQLiteParserOF_, SQLiteParserOFFSET_, SQLiteParserON_, SQLiteParserOR_, SQLiteParserORDER_, SQLiteParserOUTER_, SQLiteParserPLAN_, SQLiteParserPRAGMA_, SQLiteParserPRIMARY_, SQLiteParserQUERY_, SQLiteParserRAISE_, SQLiteParserRECURSIVE_, SQLiteParserREFERENCES_, SQLiteParserREGEXP_, SQLiteParserREINDEX_, SQLiteParserRELEASE_, SQLiteParserRENAME_, SQLiteParserREPLACE_, SQLiteParserRESTRICT_, SQLiteParserRETURNING_, SQLiteParserRIGHT_, SQLiteParserROLLBACK_, SQLiteParserROW_, SQLiteParserROWS_, SQLiteParserSAVEPOINT_, SQLiteParserSELECT_, SQLiteParserSET_, SQLiteParserSTRICT_, SQLiteParserTABLE_, SQLiteParserTEMP_, SQLiteParserTEMPORARY_, SQLiteParserTHEN_, SQLiteParserTO_, SQLiteParserTRANSACTION_, SQLiteParserTRIGGER_, SQLiteParserUNION_, SQLiteParserUNIQUE_, SQLiteParserUPDATE_, SQLiteParserUSING_, SQLiteParserVACUUM_, SQLiteParserVALUES_, SQLiteParserVIEW_, SQLiteParserVIRTUAL_, SQLiteParserWHEN_, SQLiteParserWHERE_, SQLiteParserWITH_, SQLiteParserWITHOUT_, SQLiteParserFIRST_VALUE_, SQLiteParserOVER_, SQLiteParserPARTITION_, SQLiteParserRANGE_, SQLiteParserPRECEDING_, SQLiteParserUNBOUNDED_, SQLiteParserCURRENT_, SQLiteParserFOLLOWING_, SQLiteParserCUME_DIST_, SQLiteParserDENSE_RANK_, SQLiteParserLAG_, SQLiteParserLAST_VALUE_, SQLiteParserLEAD_, SQLiteParserNTH_VALUE_, SQLiteParserNTILE_, SQLiteParserPERCENT_RANK_, SQLiteParserRANK_, SQLiteParserROW_NUMBER_, SQLiteParserGENERATED_, SQLiteParserALWAYS_, SQLiteParserSTORED_, SQLiteParserTRUE_, SQLiteParserFALSE_, SQLiteParserWINDOW_, SQLiteParserNULLS_, SQLiteParserFIRST_, SQLiteParserLAST_, SQLiteParserFILTER_, SQLiteParserGROUPS_, SQLiteParserEXCLUDE_, SQLiteParserIDENTIFIER, SQLiteParserNUMERIC_LITERAL, SQLiteParserNUMBERED_BIND_PARAMETER, SQLiteParserNAMED_BIND_PARAMETER, SQLiteParserSTRING_LITERAL, SQLiteParserBLOB_LITERAL: @@ -10143,17 +11158,27 @@ func (p *SQLiteParser) Returning_clause() (localctx IReturning_clauseContext) { } p.SetState(856) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserAS_ || _la == SQLiteParserIDENTIFIER || _la == SQLiteParserSTRING_LITERAL { p.SetState(853) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserAS_ { { p.SetState(852) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } @@ -10165,15 +11190,29 @@ func (p *SQLiteParser) Returning_clause() (localctx IReturning_clauseContext) { } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } p.SetState(864) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IDelete_stmtContext is an interface to support dynamic dispatch. @@ -10197,23 +11236,28 @@ type IDelete_stmtContext interface { } type Delete_stmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyDelete_stmtContext() *Delete_stmtContext { var p = new(Delete_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_delete_stmt return p } +func InitEmptyDelete_stmtContext(p *Delete_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_delete_stmt +} + func (*Delete_stmtContext) IsDelete_stmtContext() {} func NewDelete_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Delete_stmtContext { var p = new(Delete_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_delete_stmt @@ -10320,32 +11364,16 @@ func (s *Delete_stmtContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Delete_stmt() (localctx IDelete_stmtContext) { - this := p - _ = this - localctx = NewDelete_stmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 60, SQLiteParserRULE_delete_stmt) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) p.SetState(866) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserWITH_ { @@ -10358,10 +11386,18 @@ func (p *SQLiteParser) Delete_stmt() (localctx IDelete_stmtContext) { { p.SetState(868) p.Match(SQLiteParserDELETE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(869) p.Match(SQLiteParserFROM_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(870) @@ -10369,12 +11405,19 @@ func (p *SQLiteParser) Delete_stmt() (localctx IDelete_stmtContext) { } p.SetState(873) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserWHERE_ { { p.SetState(871) p.Match(SQLiteParserWHERE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(872) @@ -10384,6 +11427,9 @@ func (p *SQLiteParser) Delete_stmt() (localctx IDelete_stmtContext) { } p.SetState(876) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserRETURNING_ { @@ -10394,7 +11440,17 @@ func (p *SQLiteParser) Delete_stmt() (localctx IDelete_stmtContext) { } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IDelete_stmt_limitedContext is an interface to support dynamic dispatch. @@ -10420,23 +11476,28 @@ type IDelete_stmt_limitedContext interface { } type Delete_stmt_limitedContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyDelete_stmt_limitedContext() *Delete_stmt_limitedContext { var p = new(Delete_stmt_limitedContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_delete_stmt_limited return p } +func InitEmptyDelete_stmt_limitedContext(p *Delete_stmt_limitedContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_delete_stmt_limited +} + func (*Delete_stmt_limitedContext) IsDelete_stmt_limitedContext() {} func NewDelete_stmt_limitedContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Delete_stmt_limitedContext { var p = new(Delete_stmt_limitedContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_delete_stmt_limited @@ -10575,32 +11636,16 @@ func (s *Delete_stmt_limitedContext) ExitRule(listener antlr.ParseTreeListener) } func (p *SQLiteParser) Delete_stmt_limited() (localctx IDelete_stmt_limitedContext) { - this := p - _ = this - localctx = NewDelete_stmt_limitedContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 62, SQLiteParserRULE_delete_stmt_limited) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) p.SetState(879) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserWITH_ { @@ -10613,10 +11658,18 @@ func (p *SQLiteParser) Delete_stmt_limited() (localctx IDelete_stmt_limitedConte { p.SetState(881) p.Match(SQLiteParserDELETE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(882) p.Match(SQLiteParserFROM_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(883) @@ -10624,12 +11677,19 @@ func (p *SQLiteParser) Delete_stmt_limited() (localctx IDelete_stmt_limitedConte } p.SetState(886) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserWHERE_ { { p.SetState(884) p.Match(SQLiteParserWHERE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(885) @@ -10639,11 +11699,17 @@ func (p *SQLiteParser) Delete_stmt_limited() (localctx IDelete_stmt_limitedConte } p.SetState(892) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserLIMIT_ || _la == SQLiteParserORDER_ { p.SetState(889) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserORDER_ { @@ -10661,6 +11727,9 @@ func (p *SQLiteParser) Delete_stmt_limited() (localctx IDelete_stmt_limitedConte } p.SetState(895) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserRETURNING_ { @@ -10671,7 +11740,17 @@ func (p *SQLiteParser) Delete_stmt_limited() (localctx IDelete_stmt_limitedConte } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IDetach_stmtContext is an interface to support dynamic dispatch. @@ -10691,23 +11770,28 @@ type IDetach_stmtContext interface { } type Detach_stmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyDetach_stmtContext() *Detach_stmtContext { var p = new(Detach_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_detach_stmt return p } +func InitEmptyDetach_stmtContext(p *Detach_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_detach_stmt +} + func (*Detach_stmtContext) IsDetach_stmtContext() {} func NewDetach_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Detach_stmtContext { var p = new(Detach_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_detach_stmt @@ -10762,49 +11846,49 @@ func (s *Detach_stmtContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Detach_stmt() (localctx IDetach_stmtContext) { - this := p - _ = this - localctx = NewDetach_stmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 64, SQLiteParserRULE_detach_stmt) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { p.SetState(897) p.Match(SQLiteParserDETACH_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(899) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 113, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 113, p.GetParserRuleContext()) == 1 { { p.SetState(898) p.Match(SQLiteParserDATABASE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { p.SetState(901) p.Schema_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IDrop_stmtContext is an interface to support dynamic dispatch. @@ -10837,24 +11921,29 @@ type IDrop_stmtContext interface { } type Drop_stmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser object antlr.Token } func NewEmptyDrop_stmtContext() *Drop_stmtContext { var p = new(Drop_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_drop_stmt return p } +func InitEmptyDrop_stmtContext(p *Drop_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_drop_stmt +} + func (*Drop_stmtContext) IsDrop_stmtContext() {} func NewDrop_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Drop_stmtContext { var p = new(Drop_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_drop_stmt @@ -10953,33 +12042,18 @@ func (s *Drop_stmtContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Drop_stmt() (localctx IDrop_stmtContext) { - this := p - _ = this - localctx = NewDrop_stmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 66, SQLiteParserRULE_drop_stmt) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { p.SetState(903) p.Match(SQLiteParserDROP_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(904) @@ -10990,7 +12064,7 @@ func (p *SQLiteParser) Drop_stmt() (localctx IDrop_stmtContext) { _la = p.GetTokenStream().LA(1) - if !((int64((_la-84)) & ^0x3f) == 0 && ((int64(1)<<(_la-84))&4648277765399773185) != 0) { + if !((int64((_la-86)) & ^0x3f) == 0 && ((int64(1)<<(_la-86))&4648277765399773185) != 0) { var _ri = p.GetErrorHandler().RecoverInline(p) localctx.(*Drop_stmtContext).object = _ri @@ -11002,21 +12076,31 @@ func (p *SQLiteParser) Drop_stmt() (localctx IDrop_stmtContext) { p.SetState(907) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 114, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 114, p.GetParserRuleContext()) == 1 { { p.SetState(905) p.Match(SQLiteParserIF_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(906) p.Match(SQLiteParserEXISTS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } p.SetState(912) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 115, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 115, p.GetParserRuleContext()) == 1 { { p.SetState(909) p.Schema_name() @@ -11024,15 +12108,31 @@ func (p *SQLiteParser) Drop_stmt() (localctx IDrop_stmtContext) { { p.SetState(910) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { p.SetState(914) p.Any_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IExprContext is an interface to support dynamic dispatch. @@ -11046,23 +12146,28 @@ type IExprContext interface { } type ExprContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyExprContext() *ExprContext { var p = new(ExprContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_expr return p } +func InitEmptyExprContext(p *ExprContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_expr +} + func (*ExprContext) IsExprContext() {} func NewExprContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ExprContext { var p = new(ExprContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_expr @@ -11072,8 +12177,8 @@ func NewExprContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokin func (s *ExprContext) GetParser() antlr.Parser { return s.parser } -func (s *ExprContext) CopyFrom(ctx *ExprContext) { - s.BaseParserRuleContext.CopyFrom(ctx.BaseParserRuleContext) +func (s *ExprContext) CopyAll(ctx *ExprContext) { + s.CopyFrom(&ctx.BaseParserRuleContext) } func (s *ExprContext) GetRuleContext() antlr.RuleContext { @@ -11085,15 +12190,15 @@ func (s *ExprContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) s } type Expr_caseContext struct { - *ExprContext + ExprContext } func NewExpr_caseContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_caseContext { var p = new(Expr_caseContext) - p.ExprContext = NewEmptyExprContext() + InitEmptyExprContext(&p.ExprContext) p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) + p.CopyAll(ctx.(*ExprContext)) return p } @@ -11184,15 +12289,15 @@ func (s *Expr_caseContext) ExitRule(listener antlr.ParseTreeListener) { } type Expr_raiseContext struct { - *ExprContext + ExprContext } func NewExpr_raiseContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_raiseContext { var p = new(Expr_raiseContext) - p.ExprContext = NewEmptyExprContext() + InitEmptyExprContext(&p.ExprContext) p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) + p.CopyAll(ctx.(*ExprContext)) return p } @@ -11230,15 +12335,15 @@ func (s *Expr_raiseContext) ExitRule(listener antlr.ParseTreeListener) { } type Expr_functionContext struct { - *ExprContext + ExprContext } func NewExpr_functionContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_functionContext { var p = new(Expr_functionContext) - p.ExprContext = NewEmptyExprContext() + InitEmptyExprContext(&p.ExprContext) p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) + p.CopyAll(ctx.(*ExprContext)) return p } @@ -11373,15 +12478,15 @@ func (s *Expr_functionContext) ExitRule(listener antlr.ParseTreeListener) { } type Expr_comparisonContext struct { - *ExprContext + ExprContext } func NewExpr_comparisonContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_comparisonContext { var p = new(Expr_comparisonContext) - p.ExprContext = NewEmptyExprContext() + InitEmptyExprContext(&p.ExprContext) p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) + p.CopyAll(ctx.(*ExprContext)) return p } @@ -11523,25 +12628,25 @@ func (s *Expr_comparisonContext) ExitRule(listener antlr.ParseTreeListener) { } } -type Expr_binaryContext struct { - *ExprContext +type Expr_boolContext struct { + ExprContext } -func NewExpr_binaryContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_binaryContext { - var p = new(Expr_binaryContext) +func NewExpr_boolContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_boolContext { + var p = new(Expr_boolContext) - p.ExprContext = NewEmptyExprContext() + InitEmptyExprContext(&p.ExprContext) p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) + p.CopyAll(ctx.(*ExprContext)) return p } -func (s *Expr_binaryContext) GetRuleContext() antlr.RuleContext { +func (s *Expr_boolContext) GetRuleContext() antlr.RuleContext { return s } -func (s *Expr_binaryContext) AllExpr() []IExprContext { +func (s *Expr_boolContext) AllExpr() []IExprContext { children := s.GetChildren() len := 0 for _, ctx := range children { @@ -11562,7 +12667,7 @@ func (s *Expr_binaryContext) AllExpr() []IExprContext { return tst } -func (s *Expr_binaryContext) Expr(i int) IExprContext { +func (s *Expr_boolContext) Expr(i int) IExprContext { var t antlr.RuleContext j := 0 for _, ctx := range s.GetChildren() { @@ -11582,54 +12687,75 @@ func (s *Expr_binaryContext) Expr(i int) IExprContext { return t.(IExprContext) } -func (s *Expr_binaryContext) PIPE2() antlr.TerminalNode { - return s.GetToken(SQLiteParserPIPE2, 0) -} - -func (s *Expr_binaryContext) AND_() antlr.TerminalNode { +func (s *Expr_boolContext) AND_() antlr.TerminalNode { return s.GetToken(SQLiteParserAND_, 0) } -func (s *Expr_binaryContext) OR_() antlr.TerminalNode { +func (s *Expr_boolContext) OR_() antlr.TerminalNode { return s.GetToken(SQLiteParserOR_, 0) } -func (s *Expr_binaryContext) EnterRule(listener antlr.ParseTreeListener) { +func (s *Expr_boolContext) EnterRule(listener antlr.ParseTreeListener) { if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterExpr_binary(s) + listenerT.EnterExpr_bool(s) } } -func (s *Expr_binaryContext) ExitRule(listener antlr.ParseTreeListener) { +func (s *Expr_boolContext) ExitRule(listener antlr.ParseTreeListener) { if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitExpr_binary(s) + listenerT.ExitExpr_bool(s) } } -type Expr_literalContext struct { - *ExprContext +type Expr_binaryContext struct { + ExprContext } -func NewExpr_literalContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_literalContext { - var p = new(Expr_literalContext) +func NewExpr_binaryContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_binaryContext { + var p = new(Expr_binaryContext) - p.ExprContext = NewEmptyExprContext() + InitEmptyExprContext(&p.ExprContext) p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) + p.CopyAll(ctx.(*ExprContext)) return p } -func (s *Expr_literalContext) GetRuleContext() antlr.RuleContext { +func (s *Expr_binaryContext) GetRuleContext() antlr.RuleContext { return s } -func (s *Expr_literalContext) Literal_value() ILiteral_valueContext { +func (s *Expr_binaryContext) AllExpr() []IExprContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IExprContext); ok { + len++ + } + } + + tst := make([]IExprContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IExprContext); ok { + tst[i] = t.(IExprContext) + i++ + } + } + + return tst +} + +func (s *Expr_binaryContext) Expr(i int) IExprContext { var t antlr.RuleContext + j := 0 for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ILiteral_valueContext); ok { - t = ctx.(antlr.RuleContext) - break + if _, ok := ctx.(IExprContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ } } @@ -11637,33 +12763,111 @@ func (s *Expr_literalContext) Literal_value() ILiteral_valueContext { return nil } - return t.(ILiteral_valueContext) + return t.(IExprContext) } -func (s *Expr_literalContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterExpr_literal(s) - } +func (s *Expr_binaryContext) PIPE2() antlr.TerminalNode { + return s.GetToken(SQLiteParserPIPE2, 0) } -func (s *Expr_literalContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitExpr_literal(s) - } +func (s *Expr_binaryContext) PTR() antlr.TerminalNode { + return s.GetToken(SQLiteParserPTR, 0) } -type Expr_castContext struct { - *ExprContext +func (s *Expr_binaryContext) PTR2() antlr.TerminalNode { + return s.GetToken(SQLiteParserPTR2, 0) } -func NewExpr_castContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_castContext { - var p = new(Expr_castContext) - - p.ExprContext = NewEmptyExprContext() - p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) +func (s *Expr_binaryContext) STAR() antlr.TerminalNode { + return s.GetToken(SQLiteParserSTAR, 0) +} - return p +func (s *Expr_binaryContext) DIV() antlr.TerminalNode { + return s.GetToken(SQLiteParserDIV, 0) +} + +func (s *Expr_binaryContext) MOD() antlr.TerminalNode { + return s.GetToken(SQLiteParserMOD, 0) +} + +func (s *Expr_binaryContext) PLUS() antlr.TerminalNode { + return s.GetToken(SQLiteParserPLUS, 0) +} + +func (s *Expr_binaryContext) MINUS() antlr.TerminalNode { + return s.GetToken(SQLiteParserMINUS, 0) +} + +func (s *Expr_binaryContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(SQLiteParserListener); ok { + listenerT.EnterExpr_binary(s) + } +} + +func (s *Expr_binaryContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(SQLiteParserListener); ok { + listenerT.ExitExpr_binary(s) + } +} + +type Expr_literalContext struct { + ExprContext +} + +func NewExpr_literalContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_literalContext { + var p = new(Expr_literalContext) + + InitEmptyExprContext(&p.ExprContext) + p.parser = parser + p.CopyAll(ctx.(*ExprContext)) + + return p +} + +func (s *Expr_literalContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Expr_literalContext) Literal_value() ILiteral_valueContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILiteral_valueContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ILiteral_valueContext) +} + +func (s *Expr_literalContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(SQLiteParserListener); ok { + listenerT.EnterExpr_literal(s) + } +} + +func (s *Expr_literalContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(SQLiteParserListener); ok { + listenerT.ExitExpr_literal(s) + } +} + +type Expr_castContext struct { + ExprContext +} + +func NewExpr_castContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_castContext { + var p = new(Expr_castContext) + + InitEmptyExprContext(&p.ExprContext) + p.parser = parser + p.CopyAll(ctx.(*ExprContext)) + + return p } func (s *Expr_castContext) GetRuleContext() antlr.RuleContext { @@ -11731,15 +12935,15 @@ func (s *Expr_castContext) ExitRule(listener antlr.ParseTreeListener) { } type Expr_in_selectContext struct { - *ExprContext + ExprContext } func NewExpr_in_selectContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_in_selectContext { var p = new(Expr_in_selectContext) - p.ExprContext = NewEmptyExprContext() + InitEmptyExprContext(&p.ExprContext) p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) + p.CopyAll(ctx.(*ExprContext)) return p } @@ -11898,15 +13102,15 @@ func (s *Expr_in_selectContext) ExitRule(listener antlr.ParseTreeListener) { } type Expr_listContext struct { - *ExprContext + ExprContext } func NewExpr_listContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_listContext { var p = new(Expr_listContext) - p.ExprContext = NewEmptyExprContext() + InitEmptyExprContext(&p.ExprContext) p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) + p.CopyAll(ctx.(*ExprContext)) return p } @@ -11985,15 +13189,15 @@ func (s *Expr_listContext) ExitRule(listener antlr.ParseTreeListener) { } type Expr_betweenContext struct { - *ExprContext + ExprContext } func NewExpr_betweenContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_betweenContext { var p = new(Expr_betweenContext) - p.ExprContext = NewEmptyExprContext() + InitEmptyExprContext(&p.ExprContext) p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) + p.CopyAll(ctx.(*ExprContext)) return p } @@ -12068,15 +13272,15 @@ func (s *Expr_betweenContext) ExitRule(listener antlr.ParseTreeListener) { } type Expr_collateContext struct { - *ExprContext + ExprContext } func NewExpr_collateContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_collateContext { var p = new(Expr_collateContext) - p.ExprContext = NewEmptyExprContext() + InitEmptyExprContext(&p.ExprContext) p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) + p.CopyAll(ctx.(*ExprContext)) return p } @@ -12134,15 +13338,15 @@ func (s *Expr_collateContext) ExitRule(listener antlr.ParseTreeListener) { } type Expr_qualified_column_nameContext struct { - *ExprContext + ExprContext } func NewExpr_qualified_column_nameContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_qualified_column_nameContext { var p = new(Expr_qualified_column_nameContext) - p.ExprContext = NewEmptyExprContext() + InitEmptyExprContext(&p.ExprContext) p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) + p.CopyAll(ctx.(*ExprContext)) return p } @@ -12219,107 +13423,16 @@ func (s *Expr_qualified_column_nameContext) ExitRule(listener antlr.ParseTreeLis } } -type Expr_math_opContext struct { - *ExprContext -} - -func NewExpr_math_opContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_math_opContext { - var p = new(Expr_math_opContext) - - p.ExprContext = NewEmptyExprContext() - p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) - - return p -} - -func (s *Expr_math_opContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Expr_math_opContext) AllExpr() []IExprContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IExprContext); ok { - len++ - } - } - - tst := make([]IExprContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IExprContext); ok { - tst[i] = t.(IExprContext) - i++ - } - } - - return tst -} - -func (s *Expr_math_opContext) Expr(i int) IExprContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Expr_math_opContext) STAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserSTAR, 0) -} - -func (s *Expr_math_opContext) DIV() antlr.TerminalNode { - return s.GetToken(SQLiteParserDIV, 0) -} - -func (s *Expr_math_opContext) MOD() antlr.TerminalNode { - return s.GetToken(SQLiteParserMOD, 0) -} - -func (s *Expr_math_opContext) PLUS() antlr.TerminalNode { - return s.GetToken(SQLiteParserPLUS, 0) -} - -func (s *Expr_math_opContext) MINUS() antlr.TerminalNode { - return s.GetToken(SQLiteParserMINUS, 0) -} - -func (s *Expr_math_opContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterExpr_math_op(s) - } -} - -func (s *Expr_math_opContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitExpr_math_op(s) - } -} - type Expr_unaryContext struct { - *ExprContext + ExprContext } func NewExpr_unaryContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_unaryContext { var p = new(Expr_unaryContext) - p.ExprContext = NewEmptyExprContext() + InitEmptyExprContext(&p.ExprContext) p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) + p.CopyAll(ctx.(*ExprContext)) return p } @@ -12373,15 +13486,15 @@ func (s *Expr_unaryContext) ExitRule(listener antlr.ParseTreeListener) { } type Expr_null_compContext struct { - *ExprContext + ExprContext } func NewExpr_null_compContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_null_compContext { var p = new(Expr_null_compContext) - p.ExprContext = NewEmptyExprContext() + InitEmptyExprContext(&p.ExprContext) p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) + p.CopyAll(ctx.(*ExprContext)) return p } @@ -12435,15 +13548,15 @@ func (s *Expr_null_compContext) ExitRule(listener antlr.ParseTreeListener) { } type Expr_bindContext struct { - *ExprContext + ExprContext } func NewExpr_bindContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_bindContext { var p = new(Expr_bindContext) - p.ExprContext = NewEmptyExprContext() + InitEmptyExprContext(&p.ExprContext) p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) + p.CopyAll(ctx.(*ExprContext)) return p } @@ -12477,10 +13590,8 @@ func (p *SQLiteParser) Expr() (localctx IExprContext) { } func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { - this := p - _ = this - var _parentctx antlr.ParserRuleContext = p.GetParserRuleContext() + _parentState := p.GetState() localctx = NewExprContext(p, p.GetParserRuleContext(), _parentState) var _prevctx IExprContext = localctx @@ -12489,28 +13600,16 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { p.EnterRecursionRule(localctx, 68, SQLiteParserRULE_expr, _p) var _la int - defer func() { - p.UnrollRecursionContexts(_parentctx) - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - var _alt int p.EnterOuterAlt(localctx, 1) p.SetState(1005) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 129, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 129, p.GetParserRuleContext()) { case 1: localctx = NewExpr_literalContext(p, localctx) p.SetParserRuleContext(localctx) @@ -12528,6 +13627,10 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { { p.SetState(918) p.Match(SQLiteParserNUMBERED_BIND_PARAMETER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 3: @@ -12537,6 +13640,10 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { { p.SetState(919) p.Match(SQLiteParserNAMED_BIND_PARAMETER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 4: @@ -12546,11 +13653,11 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { p.SetState(928) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 117, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 117, p.GetParserRuleContext()) == 1 { p.SetState(923) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 116, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 116, p.GetParserRuleContext()) == 1 { { p.SetState(920) p.Schema_name() @@ -12558,8 +13665,14 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { { p.SetState(921) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { p.SetState(925) @@ -12568,8 +13681,14 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { { p.SetState(926) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { p.SetState(930) @@ -12586,7 +13705,7 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { } { p.SetState(932) - p.expr(20) + p.expr(21) } case 6: @@ -12600,21 +13719,33 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { { p.SetState(935) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(948) p.GetErrorHandler().Sync(p) - + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserOPEN_PAR, SQLiteParserPLUS, SQLiteParserMINUS, SQLiteParserTILDE, SQLiteParserABORT_, SQLiteParserACTION_, SQLiteParserADD_, SQLiteParserAFTER_, SQLiteParserALL_, SQLiteParserALTER_, SQLiteParserANALYZE_, SQLiteParserAND_, SQLiteParserAS_, SQLiteParserASC_, SQLiteParserATTACH_, SQLiteParserAUTOINCREMENT_, SQLiteParserBEFORE_, SQLiteParserBEGIN_, SQLiteParserBETWEEN_, SQLiteParserBY_, SQLiteParserCASCADE_, SQLiteParserCASE_, SQLiteParserCAST_, SQLiteParserCHECK_, SQLiteParserCOLLATE_, SQLiteParserCOLUMN_, SQLiteParserCOMMIT_, SQLiteParserCONFLICT_, SQLiteParserCONSTRAINT_, SQLiteParserCREATE_, SQLiteParserCROSS_, SQLiteParserCURRENT_DATE_, SQLiteParserCURRENT_TIME_, SQLiteParserCURRENT_TIMESTAMP_, SQLiteParserDATABASE_, SQLiteParserDEFAULT_, SQLiteParserDEFERRABLE_, SQLiteParserDEFERRED_, SQLiteParserDELETE_, SQLiteParserDESC_, SQLiteParserDETACH_, SQLiteParserDISTINCT_, SQLiteParserDROP_, SQLiteParserEACH_, SQLiteParserELSE_, SQLiteParserEND_, SQLiteParserESCAPE_, SQLiteParserEXCEPT_, SQLiteParserEXCLUSIVE_, SQLiteParserEXISTS_, SQLiteParserEXPLAIN_, SQLiteParserFAIL_, SQLiteParserFOR_, SQLiteParserFOREIGN_, SQLiteParserFROM_, SQLiteParserFULL_, SQLiteParserGLOB_, SQLiteParserGROUP_, SQLiteParserHAVING_, SQLiteParserIF_, SQLiteParserIGNORE_, SQLiteParserIMMEDIATE_, SQLiteParserIN_, SQLiteParserINDEX_, SQLiteParserINDEXED_, SQLiteParserINITIALLY_, SQLiteParserINNER_, SQLiteParserINSERT_, SQLiteParserINSTEAD_, SQLiteParserINTERSECT_, SQLiteParserINTO_, SQLiteParserIS_, SQLiteParserISNULL_, SQLiteParserJOIN_, SQLiteParserKEY_, SQLiteParserLEFT_, SQLiteParserLIKE_, SQLiteParserLIMIT_, SQLiteParserMATCH_, SQLiteParserNATURAL_, SQLiteParserNO_, SQLiteParserNOT_, SQLiteParserNOTNULL_, SQLiteParserNULL_, SQLiteParserOF_, SQLiteParserOFFSET_, SQLiteParserON_, SQLiteParserOR_, SQLiteParserORDER_, SQLiteParserOUTER_, SQLiteParserPLAN_, SQLiteParserPRAGMA_, SQLiteParserPRIMARY_, SQLiteParserQUERY_, SQLiteParserRAISE_, SQLiteParserRECURSIVE_, SQLiteParserREFERENCES_, SQLiteParserREGEXP_, SQLiteParserREINDEX_, SQLiteParserRELEASE_, SQLiteParserRENAME_, SQLiteParserREPLACE_, SQLiteParserRESTRICT_, SQLiteParserRETURNING_, SQLiteParserRIGHT_, SQLiteParserROLLBACK_, SQLiteParserROW_, SQLiteParserROWS_, SQLiteParserSAVEPOINT_, SQLiteParserSELECT_, SQLiteParserSET_, SQLiteParserSTRICT_, SQLiteParserTABLE_, SQLiteParserTEMP_, SQLiteParserTEMPORARY_, SQLiteParserTHEN_, SQLiteParserTO_, SQLiteParserTRANSACTION_, SQLiteParserTRIGGER_, SQLiteParserUNION_, SQLiteParserUNIQUE_, SQLiteParserUPDATE_, SQLiteParserUSING_, SQLiteParserVACUUM_, SQLiteParserVALUES_, SQLiteParserVIEW_, SQLiteParserVIRTUAL_, SQLiteParserWHEN_, SQLiteParserWHERE_, SQLiteParserWITH_, SQLiteParserWITHOUT_, SQLiteParserFIRST_VALUE_, SQLiteParserOVER_, SQLiteParserPARTITION_, SQLiteParserRANGE_, SQLiteParserPRECEDING_, SQLiteParserUNBOUNDED_, SQLiteParserCURRENT_, SQLiteParserFOLLOWING_, SQLiteParserCUME_DIST_, SQLiteParserDENSE_RANK_, SQLiteParserLAG_, SQLiteParserLAST_VALUE_, SQLiteParserLEAD_, SQLiteParserNTH_VALUE_, SQLiteParserNTILE_, SQLiteParserPERCENT_RANK_, SQLiteParserRANK_, SQLiteParserROW_NUMBER_, SQLiteParserGENERATED_, SQLiteParserALWAYS_, SQLiteParserSTORED_, SQLiteParserTRUE_, SQLiteParserFALSE_, SQLiteParserWINDOW_, SQLiteParserNULLS_, SQLiteParserFIRST_, SQLiteParserLAST_, SQLiteParserFILTER_, SQLiteParserGROUPS_, SQLiteParserEXCLUDE_, SQLiteParserIDENTIFIER, SQLiteParserNUMERIC_LITERAL, SQLiteParserNUMBERED_BIND_PARAMETER, SQLiteParserNAMED_BIND_PARAMETER, SQLiteParserSTRING_LITERAL, SQLiteParserBLOB_LITERAL: p.SetState(937) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 118, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 118, p.GetParserRuleContext()) == 1 { { p.SetState(936) p.Match(SQLiteParserDISTINCT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { p.SetState(939) @@ -12622,12 +13753,19 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { } p.SetState(944) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { p.SetState(940) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(941) @@ -12636,6 +13774,9 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { p.SetState(946) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } @@ -12643,6 +13784,10 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { { p.SetState(947) p.Match(SQLiteParserSTAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserCLOSE_PAR: @@ -12652,26 +13797,34 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { { p.SetState(950) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(952) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 121, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 121, p.GetParserRuleContext()) == 1 { { p.SetState(951) p.Filter_clause() } + } else if p.HasError() { // JIM + goto errorExit } p.SetState(955) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 122, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 122, p.GetParserRuleContext()) == 1 { { p.SetState(954) p.Over_clause() } + } else if p.HasError() { // JIM + goto errorExit } case 7: @@ -12681,6 +13834,10 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { { p.SetState(957) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(958) @@ -12688,12 +13845,19 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { } p.SetState(963) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { p.SetState(959) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(960) @@ -12702,11 +13866,18 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { p.SetState(965) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { p.SetState(966) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 8: @@ -12716,10 +13887,18 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { { p.SetState(968) p.Match(SQLiteParserCAST_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(969) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(970) @@ -12728,6 +13907,10 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { { p.SetState(971) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(972) @@ -12736,6 +13919,10 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { { p.SetState(973) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 9: @@ -12744,29 +13931,47 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { _prevctx = localctx p.SetState(979) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserEXISTS_ || _la == SQLiteParserNOT_ { p.SetState(976) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserNOT_ { { p.SetState(975) p.Match(SQLiteParserNOT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } { p.SetState(978) p.Match(SQLiteParserEXISTS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } { p.SetState(981) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(982) @@ -12775,6 +13980,10 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { { p.SetState(983) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 10: @@ -12784,25 +13993,38 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { { p.SetState(985) p.Match(SQLiteParserCASE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } p.SetState(987) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 126, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 126, p.GetParserRuleContext()) == 1 { { p.SetState(986) p.expr(0) } + } else if p.HasError() { // JIM + goto errorExit } p.SetState(994) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for ok := true; ok; ok = _la == SQLiteParserWHEN_ { { p.SetState(989) p.Match(SQLiteParserWHEN_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(990) @@ -12811,6 +14033,10 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { { p.SetState(991) p.Match(SQLiteParserTHEN_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(992) @@ -12819,16 +14045,26 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { p.SetState(996) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } p.SetState(1000) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserELSE_ { { p.SetState(998) p.Match(SQLiteParserELSE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(999) @@ -12839,6 +14075,10 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { { p.SetState(1002) p.Match(SQLiteParserEND_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 11: @@ -12850,51 +14090,68 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { p.Raise_function() } + case antlr.ATNInvalidAltNumber: + goto errorExit } p.GetParserRuleContext().SetStop(p.GetTokenStream().LT(-1)) - p.SetState(1123) + p.SetState(1126) p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 145, p.GetParserRuleContext()) - + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 145, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { if p.GetParseListeners() != nil { p.TriggerExitRuleEvent() } _prevctx = localctx - p.SetState(1121) + p.SetState(1124) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 144, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 144, p.GetParserRuleContext()) { case 1: localctx = NewExpr_binaryContext(p, NewExprContext(p, _parentctx, _parentState)) p.PushNewRecursionContext(localctx, _startState, SQLiteParserRULE_expr) p.SetState(1007) - if !(p.Precpred(p.GetParserRuleContext(), 19)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 19)", "")) + if !(p.Precpred(p.GetParserRuleContext(), 20)) { + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 20)", "")) + goto errorExit } { p.SetState(1008) p.Match(SQLiteParserPIPE2) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { p.SetState(1009) - p.expr(20) + p.expr(21) } case 2: - localctx = NewExpr_math_opContext(p, NewExprContext(p, _parentctx, _parentState)) + localctx = NewExpr_binaryContext(p, NewExprContext(p, _parentctx, _parentState)) p.PushNewRecursionContext(localctx, _startState, SQLiteParserRULE_expr) p.SetState(1010) - if !(p.Precpred(p.GetParserRuleContext(), 18)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 18)", "")) + if !(p.Precpred(p.GetParserRuleContext(), 19)) { + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 19)", "")) + goto errorExit } { p.SetState(1011) _la = p.GetTokenStream().LA(1) - if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&12416) != 0) { + if !(_la == SQLiteParserPTR2 || _la == SQLiteParserPTR) { p.GetErrorHandler().RecoverInline(p) } else { p.GetErrorHandler().ReportMatch(p) @@ -12903,22 +14160,23 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { } { p.SetState(1012) - p.expr(19) + p.expr(20) } case 3: - localctx = NewExpr_math_opContext(p, NewExprContext(p, _parentctx, _parentState)) + localctx = NewExpr_binaryContext(p, NewExprContext(p, _parentctx, _parentState)) p.PushNewRecursionContext(localctx, _startState, SQLiteParserRULE_expr) p.SetState(1013) - if !(p.Precpred(p.GetParserRuleContext(), 17)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 17)", "")) + if !(p.Precpred(p.GetParserRuleContext(), 18)) { + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 18)", "")) + goto errorExit } { p.SetState(1014) _la = p.GetTokenStream().LA(1) - if !(_la == SQLiteParserPLUS || _la == SQLiteParserMINUS) { + if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&49280) != 0) { p.GetErrorHandler().RecoverInline(p) } else { p.GetErrorHandler().ReportMatch(p) @@ -12927,22 +14185,23 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { } { p.SetState(1015) - p.expr(18) + p.expr(19) } case 4: - localctx = NewExpr_comparisonContext(p, NewExprContext(p, _parentctx, _parentState)) + localctx = NewExpr_binaryContext(p, NewExprContext(p, _parentctx, _parentState)) p.PushNewRecursionContext(localctx, _startState, SQLiteParserRULE_expr) p.SetState(1016) - if !(p.Precpred(p.GetParserRuleContext(), 16)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 16)", "")) + if !(p.Precpred(p.GetParserRuleContext(), 17)) { + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 17)", "")) + goto errorExit } { p.SetState(1017) _la = p.GetTokenStream().LA(1) - if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&245760) != 0) { + if !(_la == SQLiteParserPLUS || _la == SQLiteParserMINUS) { p.GetErrorHandler().RecoverInline(p) } else { p.GetErrorHandler().ReportMatch(p) @@ -12951,7 +14210,7 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { } { p.SetState(1018) - p.expr(17) + p.expr(18) } case 5: @@ -12959,14 +14218,15 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { p.PushNewRecursionContext(localctx, _startState, SQLiteParserRULE_expr) p.SetState(1019) - if !(p.Precpred(p.GetParserRuleContext(), 15)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 15)", "")) + if !(p.Precpred(p.GetParserRuleContext(), 16)) { + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 16)", "")) + goto errorExit } { p.SetState(1020) _la = p.GetTokenStream().LA(1) - if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&3932160) != 0) { + if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&983040) != 0) { p.GetErrorHandler().RecoverInline(p) } else { p.GetErrorHandler().ReportMatch(p) @@ -12975,7 +14235,7 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { } { p.SetState(1021) - p.expr(16) + p.expr(17) } case 6: @@ -12983,359 +14243,558 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { p.PushNewRecursionContext(localctx, _startState, SQLiteParserRULE_expr) p.SetState(1022) + if !(p.Precpred(p.GetParserRuleContext(), 15)) { + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 15)", "")) + goto errorExit + } + { + p.SetState(1023) + _la = p.GetTokenStream().LA(1) + + if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&15728640) != 0) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + { + p.SetState(1024) + p.expr(16) + } + + case 7: + localctx = NewExpr_comparisonContext(p, NewExprContext(p, _parentctx, _parentState)) + p.PushNewRecursionContext(localctx, _startState, SQLiteParserRULE_expr) + p.SetState(1025) + if !(p.Precpred(p.GetParserRuleContext(), 14)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 14)", "")) + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 14)", "")) + goto errorExit } - p.SetState(1038) + p.SetState(1041) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 131, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 131, p.GetParserRuleContext()) { case 1: { - p.SetState(1023) + p.SetState(1026) p.Match(SQLiteParserASSIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 2: { - p.SetState(1024) + p.SetState(1027) p.Match(SQLiteParserEQ) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 3: { - p.SetState(1025) + p.SetState(1028) p.Match(SQLiteParserNOT_EQ1) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 4: { - p.SetState(1026) + p.SetState(1029) p.Match(SQLiteParserNOT_EQ2) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 5: { - p.SetState(1027) + p.SetState(1030) p.Match(SQLiteParserIS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 6: { - p.SetState(1028) + p.SetState(1031) p.Match(SQLiteParserIS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1029) + p.SetState(1032) p.Match(SQLiteParserNOT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 7: - p.SetState(1031) + p.SetState(1034) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserNOT_ { { - p.SetState(1030) + p.SetState(1033) p.Match(SQLiteParserNOT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } { - p.SetState(1033) + p.SetState(1036) p.Match(SQLiteParserIN_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 8: { - p.SetState(1034) + p.SetState(1037) p.Match(SQLiteParserLIKE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 9: { - p.SetState(1035) + p.SetState(1038) p.Match(SQLiteParserGLOB_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 10: { - p.SetState(1036) + p.SetState(1039) p.Match(SQLiteParserMATCH_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 11: { - p.SetState(1037) + p.SetState(1040) p.Match(SQLiteParserREGEXP_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + case antlr.ATNInvalidAltNumber: + goto errorExit } { - p.SetState(1040) + p.SetState(1043) p.expr(15) } - case 7: - localctx = NewExpr_binaryContext(p, NewExprContext(p, _parentctx, _parentState)) + case 8: + localctx = NewExpr_boolContext(p, NewExprContext(p, _parentctx, _parentState)) p.PushNewRecursionContext(localctx, _startState, SQLiteParserRULE_expr) - p.SetState(1041) + p.SetState(1044) if !(p.Precpred(p.GetParserRuleContext(), 12)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 12)", "")) + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 12)", "")) + goto errorExit } { - p.SetState(1042) + p.SetState(1045) p.Match(SQLiteParserAND_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1043) + p.SetState(1046) p.expr(13) } - case 8: - localctx = NewExpr_binaryContext(p, NewExprContext(p, _parentctx, _parentState)) + case 9: + localctx = NewExpr_boolContext(p, NewExprContext(p, _parentctx, _parentState)) p.PushNewRecursionContext(localctx, _startState, SQLiteParserRULE_expr) - p.SetState(1044) + p.SetState(1047) if !(p.Precpred(p.GetParserRuleContext(), 11)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 11)", "")) + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 11)", "")) + goto errorExit } { - p.SetState(1045) + p.SetState(1048) p.Match(SQLiteParserOR_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1046) + p.SetState(1049) p.expr(12) } - case 9: + case 10: localctx = NewExpr_betweenContext(p, NewExprContext(p, _parentctx, _parentState)) p.PushNewRecursionContext(localctx, _startState, SQLiteParserRULE_expr) - p.SetState(1047) + p.SetState(1050) if !(p.Precpred(p.GetParserRuleContext(), 4)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 4)", "")) + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 4)", "")) + goto errorExit } - p.SetState(1049) + p.SetState(1052) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserNOT_ { { - p.SetState(1048) + p.SetState(1051) p.Match(SQLiteParserNOT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } { - p.SetState(1051) + p.SetState(1054) p.Match(SQLiteParserBETWEEN_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1052) + p.SetState(1055) p.expr(0) } { - p.SetState(1053) + p.SetState(1056) p.Match(SQLiteParserAND_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1054) + p.SetState(1057) p.expr(5) } - case 10: + case 11: localctx = NewExpr_in_selectContext(p, NewExprContext(p, _parentctx, _parentState)) p.PushNewRecursionContext(localctx, _startState, SQLiteParserRULE_expr) - p.SetState(1056) + p.SetState(1059) if !(p.Precpred(p.GetParserRuleContext(), 13)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 13)", "")) + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 13)", "")) + goto errorExit } - p.SetState(1058) + p.SetState(1061) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserNOT_ { { - p.SetState(1057) + p.SetState(1060) p.Match(SQLiteParserNOT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } { - p.SetState(1060) + p.SetState(1063) p.Match(SQLiteParserIN_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1099) + p.SetState(1102) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 140, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 140, p.GetParserRuleContext()) { case 1: { - p.SetState(1061) + p.SetState(1064) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1071) + p.SetState(1074) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 135, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 135, p.GetParserRuleContext()) == 1 { { - p.SetState(1062) + p.SetState(1065) p.Select_stmt() } - } else if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 135, p.GetParserRuleContext()) == 2 { + } else if p.HasError() { // JIM + goto errorExit + } else if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 135, p.GetParserRuleContext()) == 2 { { - p.SetState(1063) + p.SetState(1066) p.expr(0) } - p.SetState(1068) + p.SetState(1071) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1064) + p.SetState(1067) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1065) + p.SetState(1068) p.expr(0) } - p.SetState(1070) + p.SetState(1073) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1073) + p.SetState(1076) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 2: - p.SetState(1077) + p.SetState(1080) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 136, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 136, p.GetParserRuleContext()) == 1 { { - p.SetState(1074) + p.SetState(1077) p.Schema_name() } { - p.SetState(1075) + p.SetState(1078) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1079) + p.SetState(1082) p.Table_name() } case 3: - p.SetState(1083) + p.SetState(1086) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 137, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 137, p.GetParserRuleContext()) == 1 { { - p.SetState(1080) + p.SetState(1083) p.Schema_name() } { - p.SetState(1081) + p.SetState(1084) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1085) + p.SetState(1088) p.Table_function_name() } { - p.SetState(1086) + p.SetState(1089) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1095) + p.SetState(1098) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) - if ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&-33552632) != 0) || ((int64((_la-64)) & ^0x3f) == 0 && ((int64(1)<<(_la-64))&-1) != 0) || ((int64((_la-128)) & ^0x3f) == 0 && ((int64(1)<<(_la-128))&-270215977642229761) != 0) { + if ((int64((_la-3)) & ^0x3f) == 0 && ((int64(1)<<(_la-3))&-16776415) != 0) || ((int64((_la-67)) & ^0x3f) == 0 && ((int64(1)<<(_la-67))&-1) != 0) || ((int64((_la-131)) & ^0x3f) == 0 && ((int64(1)<<(_la-131))&9088264048033660927) != 0) { { - p.SetState(1087) + p.SetState(1090) p.expr(0) } - p.SetState(1092) + p.SetState(1095) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1088) + p.SetState(1091) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1089) + p.SetState(1092) p.expr(0) } - p.SetState(1094) + p.SetState(1097) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } } { - p.SetState(1097) + p.SetState(1100) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + case antlr.ATNInvalidAltNumber: + goto errorExit } - case 11: + case 12: localctx = NewExpr_collateContext(p, NewExprContext(p, _parentctx, _parentState)) p.PushNewRecursionContext(localctx, _startState, SQLiteParserRULE_expr) - p.SetState(1101) + p.SetState(1104) if !(p.Precpred(p.GetParserRuleContext(), 7)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 7)", "")) + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 7)", "")) + goto errorExit } { - p.SetState(1102) + p.SetState(1105) p.Match(SQLiteParserCOLLATE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1103) + p.SetState(1106) p.Collation_name() } - case 12: + case 13: localctx = NewExpr_comparisonContext(p, NewExprContext(p, _parentctx, _parentState)) p.PushNewRecursionContext(localctx, _startState, SQLiteParserRULE_expr) - p.SetState(1104) + p.SetState(1107) if !(p.Precpred(p.GetParserRuleContext(), 6)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 6)", "")) + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 6)", "")) + goto errorExit } - p.SetState(1106) + p.SetState(1109) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserNOT_ { { - p.SetState(1105) + p.SetState(1108) p.Match(SQLiteParserNOT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } { - p.SetState(1108) + p.SetState(1111) _la = p.GetTokenStream().LA(1) - if !((int64((_la-77)) & ^0x3f) == 0 && ((int64(1)<<(_la-77))&2199028498433) != 0) { + if !((int64((_la-79)) & ^0x3f) == 0 && ((int64(1)<<(_la-79))&2199028498433) != 0) { p.GetErrorHandler().RecoverInline(p) } else { p.GetErrorHandler().ReportMatch(p) @@ -13343,71 +14802,116 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { } } { - p.SetState(1109) + p.SetState(1112) p.expr(0) } - p.SetState(1112) + p.SetState(1115) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 142, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 142, p.GetParserRuleContext()) == 1 { { - p.SetState(1110) + p.SetState(1113) p.Match(SQLiteParserESCAPE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1111) + p.SetState(1114) p.expr(0) } + } else if p.HasError() { // JIM + goto errorExit } - case 13: + case 14: localctx = NewExpr_null_compContext(p, NewExprContext(p, _parentctx, _parentState)) p.PushNewRecursionContext(localctx, _startState, SQLiteParserRULE_expr) - p.SetState(1114) + p.SetState(1117) if !(p.Precpred(p.GetParserRuleContext(), 5)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 5)", "")) + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 5)", "")) + goto errorExit } - p.SetState(1119) + p.SetState(1122) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserISNULL_: { - p.SetState(1115) + p.SetState(1118) p.Match(SQLiteParserISNULL_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserNOTNULL_: { - p.SetState(1116) + p.SetState(1119) p.Match(SQLiteParserNOTNULL_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserNOT_: { - p.SetState(1117) + p.SetState(1120) p.Match(SQLiteParserNOT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1118) + p.SetState(1121) p.Match(SQLiteParserNULL_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } + case antlr.ATNInvalidAltNumber: + goto errorExit } } - p.SetState(1125) + p.SetState(1128) p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 145, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 145, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.UnrollRecursionContexts(_parentctx) return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IRaise_functionContext is an interface to support dynamic dispatch. @@ -13433,23 +14937,28 @@ type IRaise_functionContext interface { } type Raise_functionContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyRaise_functionContext() *Raise_functionContext { var p = new(Raise_functionContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_raise_function return p } +func InitEmptyRaise_functionContext(p *Raise_functionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_raise_function +} + func (*Raise_functionContext) IsRaise_functionContext() {} func NewRaise_functionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Raise_functionContext { var p = new(Raise_functionContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_raise_function @@ -13528,51 +15037,47 @@ func (s *Raise_functionContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Raise_function() (localctx IRaise_functionContext) { - this := p - _ = this - localctx = NewRaise_functionContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 70, SQLiteParserRULE_raise_function) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(1126) + p.SetState(1129) p.Match(SQLiteParserRAISE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1127) + p.SetState(1130) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1132) + p.SetState(1135) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserIGNORE_: { - p.SetState(1128) + p.SetState(1131) p.Match(SQLiteParserIGNORE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserABORT_, SQLiteParserFAIL_, SQLiteParserROLLBACK_: { - p.SetState(1129) + p.SetState(1132) _la = p.GetTokenStream().LA(1) if !(_la == SQLiteParserABORT_ || _la == SQLiteParserFAIL_ || _la == SQLiteParserROLLBACK_) { @@ -13583,23 +15088,42 @@ func (p *SQLiteParser) Raise_function() (localctx IRaise_functionContext) { } } { - p.SetState(1130) + p.SetState(1133) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1131) + p.SetState(1134) p.Error_message() } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } { - p.SetState(1134) + p.SetState(1137) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ILiteral_valueContext is an interface to support dynamic dispatch. @@ -13625,23 +15149,28 @@ type ILiteral_valueContext interface { } type Literal_valueContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyLiteral_valueContext() *Literal_valueContext { var p = new(Literal_valueContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_literal_value return p } +func InitEmptyLiteral_valueContext(p *Literal_valueContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_literal_value +} + func (*Literal_valueContext) IsLiteral_valueContext() {} func NewLiteral_valueContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Literal_valueContext { var p = new(Literal_valueContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_literal_value @@ -13708,35 +15237,16 @@ func (s *Literal_valueContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Literal_value() (localctx ILiteral_valueContext) { - this := p - _ = this - localctx = NewLiteral_valueContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 72, SQLiteParserRULE_literal_value) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(1136) + p.SetState(1139) _la = p.GetTokenStream().LA(1) - if !(((int64((_la-52)) & ^0x3f) == 0 && ((int64(1)<<(_la-52))&4503599627370503) != 0) || ((int64((_la-173)) & ^0x3f) == 0 && ((int64(1)<<(_la-173))&409603) != 0)) { + if !(((int64((_la-54)) & ^0x3f) == 0 && ((int64(1)<<(_la-54))&4503599627370503) != 0) || ((int64((_la-175)) & ^0x3f) == 0 && ((int64(1)<<(_la-175))&409603) != 0)) { p.GetErrorHandler().RecoverInline(p) } else { p.GetErrorHandler().ReportMatch(p) @@ -13744,7 +15254,17 @@ func (p *SQLiteParser) Literal_value() (localctx ILiteral_valueContext) { } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IInsert_stmtContext is an interface to support dynamic dispatch. @@ -13779,34 +15299,39 @@ type IInsert_stmtContext interface { AllExpr() []IExprContext Expr(i int) IExprContext Select_stmt() ISelect_stmtContext + DEFAULT_() antlr.TerminalNode Upsert_clause() IUpsert_clauseContext Returning_clause() IReturning_clauseContext AllCOMMA() []antlr.TerminalNode COMMA(i int) antlr.TerminalNode - DEFAULT_() antlr.TerminalNode // IsInsert_stmtContext differentiates from other interfaces. IsInsert_stmtContext() } type Insert_stmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyInsert_stmtContext() *Insert_stmtContext { var p = new(Insert_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_insert_stmt return p } +func InitEmptyInsert_stmtContext(p *Insert_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_insert_stmt +} + func (*Insert_stmtContext) IsInsert_stmtContext() {} func NewInsert_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Insert_stmtContext { var p = new(Insert_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_insert_stmt @@ -14038,6 +15563,10 @@ func (s *Insert_stmtContext) Select_stmt() ISelect_stmtContext { return t.(ISelect_stmtContext) } +func (s *Insert_stmtContext) DEFAULT_() antlr.TerminalNode { + return s.GetToken(SQLiteParserDEFAULT_, 0) +} + func (s *Insert_stmtContext) Upsert_clause() IUpsert_clauseContext { var t antlr.RuleContext for _, ctx := range s.GetChildren() { @@ -14078,10 +15607,6 @@ func (s *Insert_stmtContext) COMMA(i int) antlr.TerminalNode { return s.GetToken(SQLiteParserCOMMA, i) } -func (s *Insert_stmtContext) DEFAULT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDEFAULT_, 0) -} - func (s *Insert_stmtContext) GetRuleContext() antlr.RuleContext { return s } @@ -14103,287 +15628,401 @@ func (s *Insert_stmtContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Insert_stmt() (localctx IInsert_stmtContext) { - this := p - _ = this - localctx = NewInsert_stmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 74, SQLiteParserRULE_insert_stmt) var _la int - defer func() { - p.ExitRule() - }() + p.EnterOuterAlt(localctx, 1) + p.SetState(1142) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } + if _la == SQLiteParserWITH_ { + { + p.SetState(1141) + p.With_clause() } - }() - p.SetState(1211) + } + p.SetState(1149) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } - switch p.GetTokenStream().LA(1) { - case SQLiteParserINSERT_, SQLiteParserREPLACE_, SQLiteParserWITH_: - p.EnterOuterAlt(localctx, 1) - p.SetState(1139) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserWITH_ { - { - p.SetState(1138) - p.With_clause() + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 148, p.GetParserRuleContext()) { + case 1: + { + p.SetState(1144) + p.Match(SQLiteParserINSERT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit } - } - p.SetState(1146) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 148, p.GetParserRuleContext()) { - case 1: - { - p.SetState(1141) - p.Match(SQLiteParserINSERT_) - } - case 2: - { - p.SetState(1142) - p.Match(SQLiteParserREPLACE_) + case 2: + { + p.SetState(1145) + p.Match(SQLiteParserREPLACE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit } + } - case 3: - { - p.SetState(1143) - p.Match(SQLiteParserINSERT_) - } - { - p.SetState(1144) - p.Match(SQLiteParserOR_) + case 3: + { + p.SetState(1146) + p.Match(SQLiteParserINSERT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit } - { - p.SetState(1145) - _la = p.GetTokenStream().LA(1) - - if !(_la == SQLiteParserABORT_ || ((int64((_la-72)) & ^0x3f) == 0 && ((int64(1)<<(_la-72))&19140298416325121) != 0)) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } + } + { + p.SetState(1147) + p.Match(SQLiteParserOR_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit } - } { p.SetState(1148) - p.Match(SQLiteParserINTO_) - } - p.SetState(1152) - p.GetErrorHandler().Sync(p) + _la = p.GetTokenStream().LA(1) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 149, p.GetParserRuleContext()) == 1 { - { - p.SetState(1149) - p.Schema_name() - } - { - p.SetState(1150) - p.Match(SQLiteParserDOT) + if !(_la == SQLiteParserABORT_ || ((int64((_la-74)) & ^0x3f) == 0 && ((int64(1)<<(_la-74))&19140298416325121) != 0)) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() } + } + case antlr.ATNInvalidAltNumber: + goto errorExit + } + { + p.SetState(1151) + p.Match(SQLiteParserINTO_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit } + } + p.SetState(1155) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 149, p.GetParserRuleContext()) == 1 { { - p.SetState(1154) - p.Table_name() + p.SetState(1152) + p.Schema_name() } + { + p.SetState(1153) + p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + { p.SetState(1157) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) + p.Table_name() + } + p.SetState(1160) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) - if _la == SQLiteParserAS_ { - { - p.SetState(1155) - p.Match(SQLiteParserAS_) - } - { - p.SetState(1156) - p.Table_alias() + if _la == SQLiteParserAS_ { + { + p.SetState(1158) + p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit } + } + { + p.SetState(1159) + p.Table_alias() + } + + } + p.SetState(1173) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + if _la == SQLiteParserOPEN_PAR { + { + p.SetState(1162) + p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1163) + p.Column_name() } - p.SetState(1170) + p.SetState(1168) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) - if _la == SQLiteParserOPEN_PAR { + for _la == SQLiteParserCOMMA { { - p.SetState(1159) - p.Match(SQLiteParserOPEN_PAR) + p.SetState(1164) + p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1160) + p.SetState(1165) p.Column_name() } - p.SetState(1165) + + p.SetState(1170) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) + } + { + p.SetState(1171) + p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } - for _la == SQLiteParserCOMMA { - { - p.SetState(1161) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1162) - p.Column_name() - } + } - p.SetState(1167) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) + p.SetState(1206) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 156, p.GetParserRuleContext()) { + case 1: + { + p.SetState(1175) + p.Match(SQLiteParserVALUES_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit } - { - p.SetState(1168) - p.Match(SQLiteParserCLOSE_PAR) + } + { + p.SetState(1176) + p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit } - } - - p.SetState(1201) + { + p.SetState(1177) + p.expr(0) + } + p.SetState(1182) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 156, p.GetParserRuleContext()) { - case 1: - { - p.SetState(1172) - p.Match(SQLiteParserVALUES_) - } + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == SQLiteParserCOMMA { { - p.SetState(1173) - p.Match(SQLiteParserOPEN_PAR) + p.SetState(1178) + p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1174) + p.SetState(1179) p.expr(0) } - p.SetState(1179) + + p.SetState(1184) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) + } + { + p.SetState(1185) + p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(1200) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) - for _la == SQLiteParserCOMMA { - { - p.SetState(1175) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1176) - p.expr(0) + for _la == SQLiteParserCOMMA { + { + p.SetState(1186) + p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit } - - p.SetState(1181) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) } { - p.SetState(1182) - p.Match(SQLiteParserCLOSE_PAR) - } - p.SetState(1197) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1183) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1184) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(1185) - p.expr(0) + p.SetState(1187) + p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit } - p.SetState(1190) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1186) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1187) - p.expr(0) - } + } + { + p.SetState(1188) + p.expr(0) + } + p.SetState(1193) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) - p.SetState(1192) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) + for _la == SQLiteParserCOMMA { + { + p.SetState(1189) + p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1193) - p.Match(SQLiteParserCLOSE_PAR) + p.SetState(1190) + p.expr(0) } - p.SetState(1199) + p.SetState(1195) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } - - case 2: { - p.SetState(1200) - p.Select_stmt() + p.SetState(1196) + p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - } - p.SetState(1204) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserON_ { - { - p.SetState(1203) - p.Upsert_clause() + p.SetState(1202) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit } - + _la = p.GetTokenStream().LA(1) } - p.SetState(1207) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserRETURNING_ { - { - p.SetState(1206) - p.Returning_clause() - } + case 2: + { + p.SetState(1203) + p.Select_stmt() } - case SQLiteParserDEFAULT_: - p.EnterOuterAlt(localctx, 2) + case 3: { - p.SetState(1209) + p.SetState(1204) p.Match(SQLiteParserDEFAULT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1210) + p.SetState(1205) p.Match(SQLiteParserVALUES_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + p.SetState(1209) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == SQLiteParserON_ { + { + p.SetState(1208) + p.Upsert_clause() + } + + } + p.SetState(1212) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == SQLiteParserRETURNING_ { + { + p.SetState(1211) + p.Returning_clause() } - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IUpsert_clauseContext is an interface to support dynamic dispatch. @@ -14422,23 +16061,28 @@ type IUpsert_clauseContext interface { } type Upsert_clauseContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyUpsert_clauseContext() *Upsert_clauseContext { var p = new(Upsert_clauseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_upsert_clause return p } +func InitEmptyUpsert_clauseContext(p *Upsert_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_upsert_clause +} + func (*Upsert_clauseContext) IsUpsert_clauseContext() {} func NewUpsert_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Upsert_clauseContext { var p = new(Upsert_clauseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_upsert_clause @@ -14689,84 +16333,101 @@ func (s *Upsert_clauseContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Upsert_clause() (localctx IUpsert_clauseContext) { - this := p - _ = this - localctx = NewUpsert_clauseContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 76, SQLiteParserRULE_upsert_clause) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(1213) + p.SetState(1214) p.Match(SQLiteParserON_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1214) + p.SetState(1215) p.Match(SQLiteParserCONFLICT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1229) + p.SetState(1230) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserOPEN_PAR { { - p.SetState(1215) + p.SetState(1216) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1216) + p.SetState(1217) p.Indexed_column() } - p.SetState(1221) + p.SetState(1222) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1217) + p.SetState(1218) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1218) + p.SetState(1219) p.Indexed_column() } - p.SetState(1223) + p.SetState(1224) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { - p.SetState(1224) + p.SetState(1225) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1227) + p.SetState(1228) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserWHERE_ { { - p.SetState(1225) + p.SetState(1226) p.Match(SQLiteParserWHERE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1226) + p.SetState(1227) p.expr(0) } @@ -14774,112 +16435,179 @@ func (p *SQLiteParser) Upsert_clause() (localctx IUpsert_clauseContext) { } { - p.SetState(1231) + p.SetState(1232) p.Match(SQLiteParserDO_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1258) + p.SetState(1259) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserNOTHING_: { - p.SetState(1232) + p.SetState(1233) p.Match(SQLiteParserNOTHING_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserUPDATE_: { - p.SetState(1233) + p.SetState(1234) p.Match(SQLiteParserUPDATE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1234) + p.SetState(1235) p.Match(SQLiteParserSET_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1237) + p.SetState(1238) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 163, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 162, p.GetParserRuleContext()) { case 1: { - p.SetState(1235) + p.SetState(1236) p.Column_name() } case 2: { - p.SetState(1236) + p.SetState(1237) p.Column_name_list() } + case antlr.ATNInvalidAltNumber: + goto errorExit } { - p.SetState(1239) + p.SetState(1240) p.Match(SQLiteParserASSIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1240) + p.SetState(1241) p.expr(0) } - p.SetState(1251) + p.SetState(1252) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1241) + p.SetState(1242) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1244) + p.SetState(1245) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 164, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 163, p.GetParserRuleContext()) { case 1: { - p.SetState(1242) + p.SetState(1243) p.Column_name() } case 2: { - p.SetState(1243) + p.SetState(1244) p.Column_name_list() } + case antlr.ATNInvalidAltNumber: + goto errorExit } { - p.SetState(1246) + p.SetState(1247) p.Match(SQLiteParserASSIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1247) + p.SetState(1248) p.expr(0) } - p.SetState(1253) + p.SetState(1254) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } - p.SetState(1256) + p.SetState(1257) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserWHERE_ { { - p.SetState(1254) + p.SetState(1255) p.Match(SQLiteParserWHERE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1255) + p.SetState(1256) p.expr(0) } } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IPragma_stmtContext is an interface to support dynamic dispatch. @@ -14904,23 +16632,28 @@ type IPragma_stmtContext interface { } type Pragma_stmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyPragma_stmtContext() *Pragma_stmtContext { var p = new(Pragma_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_pragma_stmt return p } +func InitEmptyPragma_stmtContext(p *Pragma_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_pragma_stmt +} + func (*Pragma_stmtContext) IsPragma_stmtContext() {} func NewPragma_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Pragma_stmtContext { var p = new(Pragma_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_pragma_stmt @@ -15019,85 +16752,99 @@ func (s *Pragma_stmtContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Pragma_stmt() (localctx IPragma_stmtContext) { - this := p - _ = this - localctx = NewPragma_stmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 78, SQLiteParserRULE_pragma_stmt) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(1260) + p.SetState(1261) p.Match(SQLiteParserPRAGMA_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1264) + p.SetState(1265) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 168, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 167, p.GetParserRuleContext()) == 1 { { - p.SetState(1261) + p.SetState(1262) p.Schema_name() } { - p.SetState(1262) + p.SetState(1263) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1266) + p.SetState(1267) p.Pragma_name() } - p.SetState(1273) + p.SetState(1274) p.GetErrorHandler().Sync(p) - + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserASSIGN: { - p.SetState(1267) + p.SetState(1268) p.Match(SQLiteParserASSIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1268) + p.SetState(1269) p.Pragma_value() } case SQLiteParserOPEN_PAR: { - p.SetState(1269) + p.SetState(1270) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1270) + p.SetState(1271) p.Pragma_value() } { - p.SetState(1271) + p.SetState(1272) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - case SQLiteParserEOF, SQLiteParserSCOL, SQLiteParserALTER_, SQLiteParserANALYZE_, SQLiteParserATTACH_, SQLiteParserBEGIN_, SQLiteParserCOMMIT_, SQLiteParserCREATE_, SQLiteParserDEFAULT_, SQLiteParserDELETE_, SQLiteParserDETACH_, SQLiteParserDROP_, SQLiteParserEND_, SQLiteParserEXPLAIN_, SQLiteParserINSERT_, SQLiteParserPRAGMA_, SQLiteParserREINDEX_, SQLiteParserRELEASE_, SQLiteParserREPLACE_, SQLiteParserROLLBACK_, SQLiteParserSAVEPOINT_, SQLiteParserSELECT_, SQLiteParserUPDATE_, SQLiteParserVACUUM_, SQLiteParserVALUES_, SQLiteParserWITH_: + case SQLiteParserEOF, SQLiteParserSCOL, SQLiteParserALTER_, SQLiteParserANALYZE_, SQLiteParserATTACH_, SQLiteParserBEGIN_, SQLiteParserCOMMIT_, SQLiteParserCREATE_, SQLiteParserDELETE_, SQLiteParserDETACH_, SQLiteParserDROP_, SQLiteParserEND_, SQLiteParserEXPLAIN_, SQLiteParserINSERT_, SQLiteParserPRAGMA_, SQLiteParserREINDEX_, SQLiteParserRELEASE_, SQLiteParserREPLACE_, SQLiteParserROLLBACK_, SQLiteParserSAVEPOINT_, SQLiteParserSELECT_, SQLiteParserUPDATE_, SQLiteParserVACUUM_, SQLiteParserVALUES_, SQLiteParserWITH_: default: } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IPragma_valueContext is an interface to support dynamic dispatch. @@ -15117,23 +16864,28 @@ type IPragma_valueContext interface { } type Pragma_valueContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyPragma_valueContext() *Pragma_valueContext { var p = new(Pragma_valueContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_pragma_value return p } +func InitEmptyPragma_valueContext(p *Pragma_valueContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_pragma_value +} + func (*Pragma_valueContext) IsPragma_valueContext() {} func NewPragma_valueContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Pragma_valueContext { var p = new(Pragma_valueContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_pragma_value @@ -15200,55 +16952,55 @@ func (s *Pragma_valueContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Pragma_value() (localctx IPragma_valueContext) { - this := p - _ = this - localctx = NewPragma_valueContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 80, SQLiteParserRULE_pragma_value) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(1278) + p.SetState(1279) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 170, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 169, p.GetParserRuleContext()) { case 1: p.EnterOuterAlt(localctx, 1) { - p.SetState(1275) + p.SetState(1276) p.Signed_number() } case 2: p.EnterOuterAlt(localctx, 2) { - p.SetState(1276) + p.SetState(1277) p.Name() } case 3: p.EnterOuterAlt(localctx, 3) { - p.SetState(1277) + p.SetState(1278) p.Match(SQLiteParserSTRING_LITERAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + case antlr.ATNInvalidAltNumber: + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IReindex_stmtContext is an interface to support dynamic dispatch. @@ -15271,23 +17023,28 @@ type IReindex_stmtContext interface { } type Reindex_stmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyReindex_stmtContext() *Reindex_stmtContext { var p = new(Reindex_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_reindex_stmt return p } +func InitEmptyReindex_stmtContext(p *Reindex_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_reindex_stmt +} + func (*Reindex_stmtContext) IsReindex_stmtContext() {} func NewReindex_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Reindex_stmtContext { var p = new(Reindex_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_reindex_stmt @@ -15390,77 +17147,87 @@ func (s *Reindex_stmtContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Reindex_stmt() (localctx IReindex_stmtContext) { - this := p - _ = this - localctx = NewReindex_stmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 82, SQLiteParserRULE_reindex_stmt) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(1280) + p.SetState(1281) p.Match(SQLiteParserREINDEX_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1291) + p.SetState(1292) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 173, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 172, p.GetParserRuleContext()) == 1 { { - p.SetState(1281) + p.SetState(1282) p.Collation_name() } - } else if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 173, p.GetParserRuleContext()) == 2 { - p.SetState(1285) + } else if p.HasError() { // JIM + goto errorExit + } else if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 172, p.GetParserRuleContext()) == 2 { + p.SetState(1286) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 171, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 170, p.GetParserRuleContext()) == 1 { { - p.SetState(1282) + p.SetState(1283) p.Schema_name() } { - p.SetState(1283) + p.SetState(1284) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } - p.SetState(1289) + p.SetState(1290) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 172, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 171, p.GetParserRuleContext()) { case 1: { - p.SetState(1287) + p.SetState(1288) p.Table_name() } case 2: { - p.SetState(1288) + p.SetState(1289) p.Index_name() } + case antlr.ATNInvalidAltNumber: + goto errorExit } + } else if p.HasError() { // JIM + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ISelect_stmtContext is an interface to support dynamic dispatch. @@ -15484,23 +17251,28 @@ type ISelect_stmtContext interface { } type Select_stmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptySelect_stmtContext() *Select_stmtContext { var p = new(Select_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_select_stmt return p } +func InitEmptySelect_stmtContext(p *Select_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_select_stmt +} + func (*Select_stmtContext) IsSelect_stmtContext() {} func NewSelect_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Select_stmtContext { var p = new(Select_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_select_stmt @@ -15661,91 +17433,102 @@ func (s *Select_stmtContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Select_stmt() (localctx ISelect_stmtContext) { - this := p - _ = this - localctx = NewSelect_stmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 84, SQLiteParserRULE_select_stmt) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - var _alt int p.EnterOuterAlt(localctx, 1) - p.SetState(1294) + p.SetState(1295) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserWITH_ { { - p.SetState(1293) + p.SetState(1294) p.Common_table_stmt() } } { - p.SetState(1296) + p.SetState(1297) p.Select_core() } - p.SetState(1302) + p.SetState(1303) p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 175, p.GetParserRuleContext()) - + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 174, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { - p.SetState(1297) + p.SetState(1298) p.Compound_operator() } { - p.SetState(1298) + p.SetState(1299) p.Select_core() } } - p.SetState(1304) + p.SetState(1305) p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 175, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 174, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } } - p.SetState(1306) + p.SetState(1307) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserORDER_ { { - p.SetState(1305) + p.SetState(1306) p.Order_by_stmt() } } - p.SetState(1309) + p.SetState(1310) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserLIMIT_ { { - p.SetState(1308) + p.SetState(1309) p.Limit_stmt() } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IJoin_clauseContext is an interface to support dynamic dispatch. @@ -15768,23 +17551,28 @@ type IJoin_clauseContext interface { } type Join_clauseContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyJoin_clauseContext() *Join_clauseContext { var p = new(Join_clauseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_join_clause return p } +func InitEmptyJoin_clauseContext(p *Join_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_join_clause +} + func (*Join_clauseContext) IsJoin_clauseContext() {} func NewJoin_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Join_clauseContext { var p = new(Join_clauseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_join_clause @@ -15938,58 +17726,55 @@ func (s *Join_clauseContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Join_clause() (localctx IJoin_clauseContext) { - this := p - _ = this - localctx = NewJoin_clauseContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 86, SQLiteParserRULE_join_clause) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(1311) + p.SetState(1312) p.Table_or_subquery() } - p.SetState(1318) + p.SetState(1319) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) - for _la == SQLiteParserCOMMA || _la == SQLiteParserCROSS_ || ((int64((_la-76)) & ^0x3f) == 0 && ((int64(1)<<(_la-76))&562949971511297) != 0) { + for _la == SQLiteParserCOMMA || _la == SQLiteParserCROSS_ || ((int64((_la-78)) & ^0x3f) == 0 && ((int64(1)<<(_la-78))&562949971511297) != 0) { { - p.SetState(1312) + p.SetState(1313) p.Join_operator() } { - p.SetState(1313) + p.SetState(1314) p.Table_or_subquery() } { - p.SetState(1314) + p.SetState(1315) p.Join_constraint() } - p.SetState(1320) + p.SetState(1321) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ISelect_coreContext is an interface to support dynamic dispatch. @@ -16035,23 +17820,28 @@ type ISelect_coreContext interface { } type Select_coreContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptySelect_coreContext() *Select_coreContext { var p = new(Select_coreContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_select_core return p } +func InitEmptySelect_coreContext(p *Select_coreContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_select_core +} + func (*Select_coreContext) IsSelect_coreContext() {} func NewSelect_coreContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Select_coreContext { var p = new(Select_coreContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_select_core @@ -16375,45 +18165,33 @@ func (s *Select_coreContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Select_core() (localctx ISelect_coreContext) { - this := p - _ = this - localctx = NewSelect_coreContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 88, SQLiteParserRULE_select_core) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(1411) + p.SetState(1412) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserSELECT_: p.EnterOuterAlt(localctx, 1) { - p.SetState(1321) + p.SetState(1322) p.Match(SQLiteParserSELECT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1323) + p.SetState(1324) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 179, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 178, p.GetParserRuleContext()) == 1 { { - p.SetState(1322) + p.SetState(1323) _la = p.GetTokenStream().LA(1) if !(_la == SQLiteParserALL_ || _la == SQLiteParserDISTINCT_) { @@ -16424,186 +18202,281 @@ func (p *SQLiteParser) Select_core() (localctx ISelect_coreContext) { } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1325) + p.SetState(1326) p.Result_column() } - p.SetState(1330) + p.SetState(1331) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1326) + p.SetState(1327) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1327) + p.SetState(1328) p.Result_column() } - p.SetState(1332) + p.SetState(1333) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } - p.SetState(1345) + p.SetState(1346) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserFROM_ { { - p.SetState(1333) + p.SetState(1334) p.Match(SQLiteParserFROM_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1343) + p.SetState(1344) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 182, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 181, p.GetParserRuleContext()) { case 1: { - p.SetState(1334) + p.SetState(1335) p.Table_or_subquery() } - p.SetState(1339) + p.SetState(1340) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1335) + p.SetState(1336) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1336) + p.SetState(1337) p.Table_or_subquery() } - p.SetState(1341) + p.SetState(1342) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } case 2: { - p.SetState(1342) + p.SetState(1343) p.Join_clause() } + case antlr.ATNInvalidAltNumber: + goto errorExit } } - p.SetState(1349) + p.SetState(1350) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserWHERE_ { { - p.SetState(1347) + p.SetState(1348) p.Match(SQLiteParserWHERE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1348) + p.SetState(1349) p.expr(0) } } - p.SetState(1365) + p.SetState(1366) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserGROUP_ { { - p.SetState(1351) + p.SetState(1352) p.Match(SQLiteParserGROUP_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1352) + p.SetState(1353) p.Match(SQLiteParserBY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1353) + p.SetState(1354) p.expr(0) } - p.SetState(1358) + p.SetState(1359) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1354) + p.SetState(1355) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1355) + p.SetState(1356) p.expr(0) } - p.SetState(1360) + p.SetState(1361) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } - p.SetState(1363) + p.SetState(1364) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserHAVING_ { { - p.SetState(1361) + p.SetState(1362) p.Match(SQLiteParserHAVING_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1362) + p.SetState(1363) p.expr(0) } } } - p.SetState(1381) + p.SetState(1382) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserWINDOW_ { { - p.SetState(1367) + p.SetState(1368) p.Match(SQLiteParserWINDOW_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1368) + p.SetState(1369) p.Window_name() } { - p.SetState(1369) + p.SetState(1370) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1370) + p.SetState(1371) p.Window_defn() } - p.SetState(1378) + p.SetState(1379) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1371) + p.SetState(1372) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1372) + p.SetState(1373) p.Window_name() } { - p.SetState(1373) + p.SetState(1374) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1374) + p.SetState(1375) p.Window_defn() } - p.SetState(1380) + p.SetState(1381) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } @@ -16612,89 +18485,150 @@ func (p *SQLiteParser) Select_core() (localctx ISelect_coreContext) { case SQLiteParserVALUES_: p.EnterOuterAlt(localctx, 2) { - p.SetState(1383) + p.SetState(1384) p.Match(SQLiteParserVALUES_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1384) + p.SetState(1385) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1385) + p.SetState(1386) p.expr(0) } - p.SetState(1390) + p.SetState(1391) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1386) + p.SetState(1387) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1387) + p.SetState(1388) p.expr(0) } - p.SetState(1392) + p.SetState(1393) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { - p.SetState(1393) + p.SetState(1394) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1408) + p.SetState(1409) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1394) + p.SetState(1395) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1395) + p.SetState(1396) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1396) + p.SetState(1397) p.expr(0) } - p.SetState(1401) + p.SetState(1402) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1397) + p.SetState(1398) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1398) + p.SetState(1399) p.expr(0) } - p.SetState(1403) + p.SetState(1404) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { - p.SetState(1404) + p.SetState(1405) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1410) + p.SetState(1411) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IFactored_select_stmtContext is an interface to support dynamic dispatch. @@ -16712,23 +18646,28 @@ type IFactored_select_stmtContext interface { } type Factored_select_stmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyFactored_select_stmtContext() *Factored_select_stmtContext { var p = new(Factored_select_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_factored_select_stmt return p } +func InitEmptyFactored_select_stmtContext(p *Factored_select_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_factored_select_stmt +} + func (*Factored_select_stmtContext) IsFactored_select_stmtContext() {} func NewFactored_select_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Factored_select_stmtContext { var p = new(Factored_select_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_factored_select_stmt @@ -16775,35 +18714,25 @@ func (s *Factored_select_stmtContext) ExitRule(listener antlr.ParseTreeListener) } func (p *SQLiteParser) Factored_select_stmt() (localctx IFactored_select_stmtContext) { - this := p - _ = this - localctx = NewFactored_select_stmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 90, SQLiteParserRULE_factored_select_stmt) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(1413) + p.SetState(1414) p.Select_stmt() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ISimple_select_stmtContext is an interface to support dynamic dispatch. @@ -16824,23 +18753,28 @@ type ISimple_select_stmtContext interface { } type Simple_select_stmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptySimple_select_stmtContext() *Simple_select_stmtContext { var p = new(Simple_select_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_simple_select_stmt return p } +func InitEmptySimple_select_stmtContext(p *Simple_select_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_simple_select_stmt +} + func (*Simple_select_stmtContext) IsSimple_select_stmtContext() {} func NewSimple_select_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Simple_select_stmtContext { var p = new(Simple_select_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_simple_select_stmt @@ -16935,69 +18869,69 @@ func (s *Simple_select_stmtContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Simple_select_stmt() (localctx ISimple_select_stmtContext) { - this := p - _ = this - localctx = NewSimple_select_stmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 92, SQLiteParserRULE_simple_select_stmt) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) - p.SetState(1416) + p.SetState(1417) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserWITH_ { { - p.SetState(1415) + p.SetState(1416) p.Common_table_stmt() } } { - p.SetState(1418) + p.SetState(1419) p.Select_core() } - p.SetState(1420) + p.SetState(1421) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserORDER_ { { - p.SetState(1419) + p.SetState(1420) p.Order_by_stmt() } } - p.SetState(1423) + p.SetState(1424) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserLIMIT_ { { - p.SetState(1422) + p.SetState(1423) p.Limit_stmt() } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ICompound_select_stmtContext is an interface to support dynamic dispatch. @@ -17027,23 +18961,28 @@ type ICompound_select_stmtContext interface { } type Compound_select_stmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyCompound_select_stmtContext() *Compound_select_stmtContext { var p = new(Compound_select_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_compound_select_stmt return p } +func InitEmptyCompound_select_stmtContext(p *Compound_select_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_compound_select_stmt +} + func (*Compound_select_stmtContext) IsCompound_select_stmtContext() {} func NewCompound_select_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Compound_select_stmtContext { var p = new(Compound_select_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_compound_select_stmt @@ -17195,119 +19134,148 @@ func (s *Compound_select_stmtContext) ExitRule(listener antlr.ParseTreeListener) } func (p *SQLiteParser) Compound_select_stmt() (localctx ICompound_select_stmtContext) { - this := p - _ = this - localctx = NewCompound_select_stmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 94, SQLiteParserRULE_compound_select_stmt) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) - p.SetState(1426) + p.SetState(1427) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserWITH_ { { - p.SetState(1425) + p.SetState(1426) p.Common_table_stmt() } } { - p.SetState(1428) + p.SetState(1429) p.Select_core() } - p.SetState(1438) + p.SetState(1439) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for ok := true; ok; ok = _la == SQLiteParserEXCEPT_ || _la == SQLiteParserINTERSECT_ || _la == SQLiteParserUNION_ { - p.SetState(1435) + p.SetState(1436) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserUNION_: { - p.SetState(1429) + p.SetState(1430) p.Match(SQLiteParserUNION_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1431) + p.SetState(1432) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserALL_ { { - p.SetState(1430) + p.SetState(1431) p.Match(SQLiteParserALL_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } case SQLiteParserINTERSECT_: { - p.SetState(1433) + p.SetState(1434) p.Match(SQLiteParserINTERSECT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserEXCEPT_: { - p.SetState(1434) + p.SetState(1435) p.Match(SQLiteParserEXCEPT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } { - p.SetState(1437) + p.SetState(1438) p.Select_core() } - p.SetState(1440) + p.SetState(1441) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } - p.SetState(1443) + p.SetState(1444) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserORDER_ { { - p.SetState(1442) + p.SetState(1443) p.Order_by_stmt() } } - p.SetState(1446) + p.SetState(1447) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserLIMIT_ { { - p.SetState(1445) + p.SetState(1446) p.Limit_stmt() } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ITable_or_subqueryContext is an interface to support dynamic dispatch. @@ -17345,23 +19313,28 @@ type ITable_or_subqueryContext interface { } type Table_or_subqueryContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyTable_or_subqueryContext() *Table_or_subqueryContext { var p = new(Table_or_subqueryContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_table_or_subquery return p } +func InitEmptyTable_or_subqueryContext(p *Table_or_subqueryContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_table_or_subquery +} + func (*Table_or_subqueryContext) IsTable_or_subqueryContext() {} func NewTable_or_subqueryContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Table_or_subqueryContext { var p = new(Table_or_subqueryContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_table_or_subquery @@ -17638,175 +19611,228 @@ func (s *Table_or_subqueryContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Table_or_subquery() (localctx ITable_or_subqueryContext) { - this := p - _ = this - localctx = NewTable_or_subqueryContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 96, SQLiteParserRULE_table_or_subquery) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(1576) + p.SetState(1577) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 227, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 226, p.GetParserRuleContext()) { case 1: p.EnterOuterAlt(localctx, 1) - p.SetState(1451) + p.SetState(1452) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 203, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 202, p.GetParserRuleContext()) == 1 { { - p.SetState(1448) + p.SetState(1449) p.Schema_name() } { - p.SetState(1449) + p.SetState(1450) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1453) + p.SetState(1454) p.Table_name() } - p.SetState(1458) + p.SetState(1459) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserAS_ || _la == SQLiteParserIDENTIFIER || _la == SQLiteParserSTRING_LITERAL { - p.SetState(1455) + p.SetState(1456) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserAS_ { { - p.SetState(1454) + p.SetState(1455) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } { - p.SetState(1457) + p.SetState(1458) p.Table_alias() } } - p.SetState(1465) + p.SetState(1466) p.GetErrorHandler().Sync(p) - + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserINDEXED_: { - p.SetState(1460) + p.SetState(1461) p.Match(SQLiteParserINDEXED_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1461) + p.SetState(1462) p.Match(SQLiteParserBY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1462) + p.SetState(1463) p.Index_name() } case SQLiteParserNOT_: { - p.SetState(1463) + p.SetState(1464) p.Match(SQLiteParserNOT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1464) + p.SetState(1465) p.Match(SQLiteParserINDEXED_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - case SQLiteParserEOF, SQLiteParserSCOL, SQLiteParserCLOSE_PAR, SQLiteParserCOMMA, SQLiteParserALTER_, SQLiteParserANALYZE_, SQLiteParserATTACH_, SQLiteParserBEGIN_, SQLiteParserCOMMIT_, SQLiteParserCREATE_, SQLiteParserCROSS_, SQLiteParserDEFAULT_, SQLiteParserDELETE_, SQLiteParserDETACH_, SQLiteParserDROP_, SQLiteParserEND_, SQLiteParserEXCEPT_, SQLiteParserEXPLAIN_, SQLiteParserFULL_, SQLiteParserGROUP_, SQLiteParserINNER_, SQLiteParserINSERT_, SQLiteParserINTERSECT_, SQLiteParserJOIN_, SQLiteParserLEFT_, SQLiteParserLIMIT_, SQLiteParserNATURAL_, SQLiteParserON_, SQLiteParserORDER_, SQLiteParserPRAGMA_, SQLiteParserREINDEX_, SQLiteParserRELEASE_, SQLiteParserREPLACE_, SQLiteParserRETURNING_, SQLiteParserRIGHT_, SQLiteParserROLLBACK_, SQLiteParserSAVEPOINT_, SQLiteParserSELECT_, SQLiteParserUNION_, SQLiteParserUPDATE_, SQLiteParserUSING_, SQLiteParserVACUUM_, SQLiteParserVALUES_, SQLiteParserWHERE_, SQLiteParserWITH_, SQLiteParserWINDOW_: + case SQLiteParserEOF, SQLiteParserSCOL, SQLiteParserCLOSE_PAR, SQLiteParserCOMMA, SQLiteParserALTER_, SQLiteParserANALYZE_, SQLiteParserATTACH_, SQLiteParserBEGIN_, SQLiteParserCOMMIT_, SQLiteParserCREATE_, SQLiteParserCROSS_, SQLiteParserDELETE_, SQLiteParserDETACH_, SQLiteParserDROP_, SQLiteParserEND_, SQLiteParserEXCEPT_, SQLiteParserEXPLAIN_, SQLiteParserFULL_, SQLiteParserGROUP_, SQLiteParserINNER_, SQLiteParserINSERT_, SQLiteParserINTERSECT_, SQLiteParserJOIN_, SQLiteParserLEFT_, SQLiteParserLIMIT_, SQLiteParserNATURAL_, SQLiteParserON_, SQLiteParserORDER_, SQLiteParserPRAGMA_, SQLiteParserREINDEX_, SQLiteParserRELEASE_, SQLiteParserREPLACE_, SQLiteParserRETURNING_, SQLiteParserRIGHT_, SQLiteParserROLLBACK_, SQLiteParserSAVEPOINT_, SQLiteParserSELECT_, SQLiteParserUNION_, SQLiteParserUPDATE_, SQLiteParserUSING_, SQLiteParserVACUUM_, SQLiteParserVALUES_, SQLiteParserWHERE_, SQLiteParserWITH_, SQLiteParserWINDOW_: default: } case 2: p.EnterOuterAlt(localctx, 2) - p.SetState(1470) + p.SetState(1471) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 207, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 206, p.GetParserRuleContext()) == 1 { { - p.SetState(1467) + p.SetState(1468) p.Schema_name() } { - p.SetState(1468) + p.SetState(1469) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1472) + p.SetState(1473) p.Table_function_name() } { - p.SetState(1473) + p.SetState(1474) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1474) + p.SetState(1475) p.expr(0) } - p.SetState(1479) + p.SetState(1480) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1475) + p.SetState(1476) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1476) + p.SetState(1477) p.expr(0) } - p.SetState(1481) + p.SetState(1482) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { - p.SetState(1482) + p.SetState(1483) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1487) + p.SetState(1488) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserAS_ || _la == SQLiteParserIDENTIFIER || _la == SQLiteParserSTRING_LITERAL { - p.SetState(1484) + p.SetState(1485) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserAS_ { { - p.SetState(1483) + p.SetState(1484) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } { - p.SetState(1486) + p.SetState(1487) p.Table_alias() } @@ -17815,80 +19841,122 @@ func (p *SQLiteParser) Table_or_subquery() (localctx ITable_or_subqueryContext) case 3: p.EnterOuterAlt(localctx, 3) { - p.SetState(1489) + p.SetState(1490) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1499) + p.SetState(1500) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 212, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 211, p.GetParserRuleContext()) { case 1: { - p.SetState(1490) + p.SetState(1491) p.Table_or_subquery() } - p.SetState(1495) + p.SetState(1496) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1491) + p.SetState(1492) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1492) + p.SetState(1493) p.Table_or_subquery() } - p.SetState(1497) + p.SetState(1498) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } case 2: { - p.SetState(1498) + p.SetState(1499) p.Join_clause() } + case antlr.ATNInvalidAltNumber: + goto errorExit } { - p.SetState(1501) + p.SetState(1502) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 4: p.EnterOuterAlt(localctx, 4) { - p.SetState(1503) + p.SetState(1504) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1504) + p.SetState(1505) p.Select_stmt() } { - p.SetState(1505) + p.SetState(1506) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1510) + p.SetState(1511) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserAS_ || _la == SQLiteParserIDENTIFIER || _la == SQLiteParserSTRING_LITERAL { - p.SetState(1507) + p.SetState(1508) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserAS_ { { - p.SetState(1506) + p.SetState(1507) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } { - p.SetState(1509) + p.SetState(1510) p.Table_alias() } @@ -17896,231 +19964,347 @@ func (p *SQLiteParser) Table_or_subquery() (localctx ITable_or_subqueryContext) case 5: p.EnterOuterAlt(localctx, 5) - p.SetState(1515) + p.SetState(1516) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 215, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 214, p.GetParserRuleContext()) == 1 { { - p.SetState(1512) + p.SetState(1513) p.Schema_name() } { - p.SetState(1513) + p.SetState(1514) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1517) + p.SetState(1518) p.Table_name() } - p.SetState(1522) + p.SetState(1523) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 217, p.GetParserRuleContext()) == 1 { - p.SetState(1519) + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 216, p.GetParserRuleContext()) == 1 { + p.SetState(1520) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 216, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 215, p.GetParserRuleContext()) == 1 { { - p.SetState(1518) + p.SetState(1519) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1521) + p.SetState(1522) p.Table_alias_fallback() } + } else if p.HasError() { // JIM + goto errorExit } - p.SetState(1529) + p.SetState(1530) p.GetErrorHandler().Sync(p) - + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserINDEXED_: { - p.SetState(1524) + p.SetState(1525) p.Match(SQLiteParserINDEXED_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1525) + p.SetState(1526) p.Match(SQLiteParserBY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1526) + p.SetState(1527) p.Index_name() } case SQLiteParserNOT_: { - p.SetState(1527) + p.SetState(1528) p.Match(SQLiteParserNOT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1528) + p.SetState(1529) p.Match(SQLiteParserINDEXED_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - case SQLiteParserEOF, SQLiteParserSCOL, SQLiteParserCLOSE_PAR, SQLiteParserCOMMA, SQLiteParserALTER_, SQLiteParserANALYZE_, SQLiteParserATTACH_, SQLiteParserBEGIN_, SQLiteParserCOMMIT_, SQLiteParserCREATE_, SQLiteParserCROSS_, SQLiteParserDEFAULT_, SQLiteParserDELETE_, SQLiteParserDETACH_, SQLiteParserDROP_, SQLiteParserEND_, SQLiteParserEXCEPT_, SQLiteParserEXPLAIN_, SQLiteParserFULL_, SQLiteParserGROUP_, SQLiteParserINNER_, SQLiteParserINSERT_, SQLiteParserINTERSECT_, SQLiteParserJOIN_, SQLiteParserLEFT_, SQLiteParserLIMIT_, SQLiteParserNATURAL_, SQLiteParserON_, SQLiteParserORDER_, SQLiteParserPRAGMA_, SQLiteParserREINDEX_, SQLiteParserRELEASE_, SQLiteParserREPLACE_, SQLiteParserRETURNING_, SQLiteParserRIGHT_, SQLiteParserROLLBACK_, SQLiteParserSAVEPOINT_, SQLiteParserSELECT_, SQLiteParserUNION_, SQLiteParserUPDATE_, SQLiteParserUSING_, SQLiteParserVACUUM_, SQLiteParserVALUES_, SQLiteParserWHERE_, SQLiteParserWITH_, SQLiteParserWINDOW_: + case SQLiteParserEOF, SQLiteParserSCOL, SQLiteParserCLOSE_PAR, SQLiteParserCOMMA, SQLiteParserALTER_, SQLiteParserANALYZE_, SQLiteParserATTACH_, SQLiteParserBEGIN_, SQLiteParserCOMMIT_, SQLiteParserCREATE_, SQLiteParserCROSS_, SQLiteParserDELETE_, SQLiteParserDETACH_, SQLiteParserDROP_, SQLiteParserEND_, SQLiteParserEXCEPT_, SQLiteParserEXPLAIN_, SQLiteParserFULL_, SQLiteParserGROUP_, SQLiteParserINNER_, SQLiteParserINSERT_, SQLiteParserINTERSECT_, SQLiteParserJOIN_, SQLiteParserLEFT_, SQLiteParserLIMIT_, SQLiteParserNATURAL_, SQLiteParserON_, SQLiteParserORDER_, SQLiteParserPRAGMA_, SQLiteParserREINDEX_, SQLiteParserRELEASE_, SQLiteParserREPLACE_, SQLiteParserRETURNING_, SQLiteParserRIGHT_, SQLiteParserROLLBACK_, SQLiteParserSAVEPOINT_, SQLiteParserSELECT_, SQLiteParserUNION_, SQLiteParserUPDATE_, SQLiteParserUSING_, SQLiteParserVACUUM_, SQLiteParserVALUES_, SQLiteParserWHERE_, SQLiteParserWITH_, SQLiteParserWINDOW_: default: } case 6: p.EnterOuterAlt(localctx, 6) - p.SetState(1534) + p.SetState(1535) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 219, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 218, p.GetParserRuleContext()) == 1 { { - p.SetState(1531) + p.SetState(1532) p.Schema_name() } { - p.SetState(1532) + p.SetState(1533) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1536) + p.SetState(1537) p.Table_function_name() } { - p.SetState(1537) + p.SetState(1538) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1538) + p.SetState(1539) p.expr(0) } - p.SetState(1543) + p.SetState(1544) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1539) + p.SetState(1540) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1540) + p.SetState(1541) p.expr(0) } - p.SetState(1545) + p.SetState(1546) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { - p.SetState(1546) + p.SetState(1547) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1551) + p.SetState(1552) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 222, p.GetParserRuleContext()) == 1 { - p.SetState(1548) + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 221, p.GetParserRuleContext()) == 1 { + p.SetState(1549) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 221, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 220, p.GetParserRuleContext()) == 1 { { - p.SetState(1547) + p.SetState(1548) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1550) + p.SetState(1551) p.Table_alias_fallback() } + } else if p.HasError() { // JIM + goto errorExit } case 7: p.EnterOuterAlt(localctx, 7) { - p.SetState(1553) + p.SetState(1554) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1563) + p.SetState(1564) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 224, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 223, p.GetParserRuleContext()) { case 1: { - p.SetState(1554) + p.SetState(1555) p.Table_or_subquery() } - p.SetState(1559) + p.SetState(1560) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1555) + p.SetState(1556) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1556) + p.SetState(1557) p.Table_or_subquery() } - p.SetState(1561) + p.SetState(1562) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } case 2: { - p.SetState(1562) + p.SetState(1563) p.Join_clause() } + case antlr.ATNInvalidAltNumber: + goto errorExit } { - p.SetState(1565) + p.SetState(1566) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 8: p.EnterOuterAlt(localctx, 8) { - p.SetState(1567) + p.SetState(1568) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1568) + p.SetState(1569) p.Select_stmt() } { - p.SetState(1569) + p.SetState(1570) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1574) + p.SetState(1575) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 226, p.GetParserRuleContext()) == 1 { - p.SetState(1571) + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 225, p.GetParserRuleContext()) == 1 { + p.SetState(1572) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 225, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 224, p.GetParserRuleContext()) == 1 { { - p.SetState(1570) + p.SetState(1571) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1573) + p.SetState(1574) p.Table_alias_fallback() } + } else if p.HasError() { // JIM + goto errorExit } + case antlr.ATNInvalidAltNumber: + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IResult_columnContext is an interface to support dynamic dispatch. @@ -18143,23 +20327,28 @@ type IResult_columnContext interface { } type Result_columnContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyResult_columnContext() *Result_columnContext { var p = new(Result_columnContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_result_column return p } +func InitEmptyResult_columnContext(p *Result_columnContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_result_column +} + func (*Result_columnContext) IsResult_columnContext() {} func NewResult_columnContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Result_columnContext { var p = new(Result_columnContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_result_column @@ -18250,86 +20439,105 @@ func (s *Result_columnContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Result_column() (localctx IResult_columnContext) { - this := p - _ = this - localctx = NewResult_columnContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 98, SQLiteParserRULE_result_column) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(1590) + p.SetState(1591) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 230, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 229, p.GetParserRuleContext()) { case 1: p.EnterOuterAlt(localctx, 1) { - p.SetState(1578) + p.SetState(1579) p.Match(SQLiteParserSTAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 2: p.EnterOuterAlt(localctx, 2) { - p.SetState(1579) + p.SetState(1580) p.Table_name() } { - p.SetState(1580) + p.SetState(1581) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1581) + p.SetState(1582) p.Match(SQLiteParserSTAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 3: p.EnterOuterAlt(localctx, 3) { - p.SetState(1583) + p.SetState(1584) p.expr(0) } - p.SetState(1588) + p.SetState(1589) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserAS_ || _la == SQLiteParserIDENTIFIER || _la == SQLiteParserSTRING_LITERAL { - p.SetState(1585) + p.SetState(1586) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserAS_ { { - p.SetState(1584) + p.SetState(1585) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } { - p.SetState(1587) + p.SetState(1588) p.Column_alias() } } + case antlr.ATNInvalidAltNumber: + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IJoin_operatorContext is an interface to support dynamic dispatch. @@ -18355,23 +20563,28 @@ type IJoin_operatorContext interface { } type Join_operatorContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyJoin_operatorContext() *Join_operatorContext { var p = new(Join_operatorContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_join_operator return p } +func InitEmptyJoin_operatorContext(p *Join_operatorContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_join_operator +} + func (*Join_operatorContext) IsJoin_operatorContext() {} func NewJoin_operatorContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Join_operatorContext { var p = new(Join_operatorContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_join_operator @@ -18438,85 +20651,93 @@ func (s *Join_operatorContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Join_operator() (localctx IJoin_operatorContext) { - this := p - _ = this - localctx = NewJoin_operatorContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 100, SQLiteParserRULE_join_operator) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(1606) + p.SetState(1607) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserCOMMA: p.EnterOuterAlt(localctx, 1) { - p.SetState(1592) + p.SetState(1593) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserFULL_, SQLiteParserINNER_, SQLiteParserJOIN_, SQLiteParserLEFT_, SQLiteParserNATURAL_, SQLiteParserRIGHT_: p.EnterOuterAlt(localctx, 2) - p.SetState(1594) + p.SetState(1595) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserNATURAL_ { { - p.SetState(1593) + p.SetState(1594) p.Match(SQLiteParserNATURAL_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } - p.SetState(1601) + p.SetState(1602) p.GetErrorHandler().Sync(p) - + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserFULL_, SQLiteParserLEFT_, SQLiteParserRIGHT_: { - p.SetState(1596) + p.SetState(1597) _la = p.GetTokenStream().LA(1) - if !((int64((_la-76)) & ^0x3f) == 0 && ((int64(1)<<(_la-76))&562949954469889) != 0) { + if !((int64((_la-78)) & ^0x3f) == 0 && ((int64(1)<<(_la-78))&562949954469889) != 0) { p.GetErrorHandler().RecoverInline(p) } else { p.GetErrorHandler().ReportMatch(p) p.Consume() } } - p.SetState(1598) + p.SetState(1599) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserOUTER_ { { - p.SetState(1597) + p.SetState(1598) p.Match(SQLiteParserOUTER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } case SQLiteParserINNER_: { - p.SetState(1600) + p.SetState(1601) p.Match(SQLiteParserINNER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserJOIN_: @@ -18524,26 +20745,49 @@ func (p *SQLiteParser) Join_operator() (localctx IJoin_operatorContext) { default: } { - p.SetState(1603) + p.SetState(1604) p.Match(SQLiteParserJOIN_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserCROSS_: p.EnterOuterAlt(localctx, 3) { - p.SetState(1604) + p.SetState(1605) p.Match(SQLiteParserCROSS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1605) + p.SetState(1606) p.Match(SQLiteParserJOIN_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IJoin_constraintContext is an interface to support dynamic dispatch. @@ -18569,23 +20813,28 @@ type IJoin_constraintContext interface { } type Join_constraintContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyJoin_constraintContext() *Join_constraintContext { var p = new(Join_constraintContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_join_constraint return p } +func InitEmptyJoin_constraintContext(p *Join_constraintContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_join_constraint +} + func (*Join_constraintContext) IsJoin_constraintContext() {} func NewJoin_constraintContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Join_constraintContext { var p = new(Join_constraintContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_join_constraint @@ -18697,82 +20946,103 @@ func (s *Join_constraintContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Join_constraint() (localctx IJoin_constraintContext) { - this := p - _ = this - localctx = NewJoin_constraintContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 102, SQLiteParserRULE_join_constraint) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) - p.SetState(1622) + p.SetState(1623) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 236, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 235, p.GetParserRuleContext()) == 1 { { - p.SetState(1608) + p.SetState(1609) p.Match(SQLiteParserON_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1609) + p.SetState(1610) p.expr(0) } - } else if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 236, p.GetParserRuleContext()) == 2 { + } else if p.HasError() { // JIM + goto errorExit + } else if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 235, p.GetParserRuleContext()) == 2 { { - p.SetState(1610) + p.SetState(1611) p.Match(SQLiteParserUSING_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1611) + p.SetState(1612) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1612) + p.SetState(1613) p.Column_name() } - p.SetState(1617) + p.SetState(1618) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1613) + p.SetState(1614) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1614) + p.SetState(1615) p.Column_name() } - p.SetState(1619) + p.SetState(1620) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { - p.SetState(1620) + p.SetState(1621) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ICompound_operatorContext is an interface to support dynamic dispatch. @@ -18793,23 +21063,28 @@ type ICompound_operatorContext interface { } type Compound_operatorContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyCompound_operatorContext() *Compound_operatorContext { var p = new(Compound_operatorContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_compound_operator return p } +func InitEmptyCompound_operatorContext(p *Compound_operatorContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_compound_operator +} + func (*Compound_operatorContext) IsCompound_operatorContext() {} func NewCompound_operatorContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Compound_operatorContext { var p = new(Compound_operatorContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_compound_operator @@ -18856,47 +21131,42 @@ func (s *Compound_operatorContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Compound_operator() (localctx ICompound_operatorContext) { - this := p - _ = this - localctx = NewCompound_operatorContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 104, SQLiteParserRULE_compound_operator) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(1630) + p.SetState(1631) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserUNION_: p.EnterOuterAlt(localctx, 1) { - p.SetState(1624) + p.SetState(1625) p.Match(SQLiteParserUNION_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1626) + p.SetState(1627) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserALL_ { { - p.SetState(1625) + p.SetState(1626) p.Match(SQLiteParserALL_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } @@ -18904,22 +21174,41 @@ func (p *SQLiteParser) Compound_operator() (localctx ICompound_operatorContext) case SQLiteParserINTERSECT_: p.EnterOuterAlt(localctx, 2) { - p.SetState(1628) + p.SetState(1629) p.Match(SQLiteParserINTERSECT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserEXCEPT_: p.EnterOuterAlt(localctx, 3) { - p.SetState(1629) + p.SetState(1630) p.Match(SQLiteParserEXCEPT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IUpdate_stmtContext is an interface to support dynamic dispatch. @@ -18958,23 +21247,28 @@ type IUpdate_stmtContext interface { } type Update_stmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyUpdate_stmtContext() *Update_stmtContext { var p = new(Update_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_update_stmt return p } +func InitEmptyUpdate_stmtContext(p *Update_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_update_stmt +} + func (*Update_stmtContext) IsUpdate_stmtContext() {} func NewUpdate_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Update_stmtContext { var p = new(Update_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_update_stmt @@ -19228,58 +21522,50 @@ func (s *Update_stmtContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Update_stmt() (localctx IUpdate_stmtContext) { - this := p - _ = this - localctx = NewUpdate_stmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 106, SQLiteParserRULE_update_stmt) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) - p.SetState(1633) + p.SetState(1634) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserWITH_ { { - p.SetState(1632) + p.SetState(1633) p.With_clause() } } { - p.SetState(1635) + p.SetState(1636) p.Match(SQLiteParserUPDATE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1638) + p.SetState(1639) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 240, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 239, p.GetParserRuleContext()) == 1 { { - p.SetState(1636) + p.SetState(1637) p.Match(SQLiteParserOR_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1637) + p.SetState(1638) _la = p.GetTokenStream().LA(1) - if !(_la == SQLiteParserABORT_ || ((int64((_la-72)) & ^0x3f) == 0 && ((int64(1)<<(_la-72))&19140298416325121) != 0)) { + if !(_la == SQLiteParserABORT_ || ((int64((_la-74)) & ^0x3f) == 0 && ((int64(1)<<(_la-74))&19140298416325121) != 0)) { p.GetErrorHandler().RecoverInline(p) } else { p.GetErrorHandler().ReportMatch(p) @@ -19287,105 +21573,161 @@ func (p *SQLiteParser) Update_stmt() (localctx IUpdate_stmtContext) { } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1640) + p.SetState(1641) p.Qualified_table_name() } { - p.SetState(1641) + p.SetState(1642) p.Match(SQLiteParserSET_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1644) + p.SetState(1645) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 241, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 240, p.GetParserRuleContext()) { case 1: { - p.SetState(1642) + p.SetState(1643) p.Column_name() } case 2: { - p.SetState(1643) + p.SetState(1644) p.Column_name_list() } + case antlr.ATNInvalidAltNumber: + goto errorExit } { - p.SetState(1646) + p.SetState(1647) p.Match(SQLiteParserASSIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1647) + p.SetState(1648) p.expr(0) } - p.SetState(1658) + p.SetState(1659) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1648) + p.SetState(1649) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1651) + p.SetState(1652) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 242, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 241, p.GetParserRuleContext()) { case 1: { - p.SetState(1649) + p.SetState(1650) p.Column_name() } case 2: { - p.SetState(1650) + p.SetState(1651) p.Column_name_list() } + case antlr.ATNInvalidAltNumber: + goto errorExit } { - p.SetState(1653) + p.SetState(1654) p.Match(SQLiteParserASSIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1654) + p.SetState(1655) p.expr(0) } - p.SetState(1660) + p.SetState(1661) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } - p.SetState(1663) + p.SetState(1664) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserWHERE_ { { - p.SetState(1661) + p.SetState(1662) p.Match(SQLiteParserWHERE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1662) + p.SetState(1663) p.expr(0) } } - p.SetState(1666) + p.SetState(1667) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserRETURNING_ { { - p.SetState(1665) + p.SetState(1666) p.Returning_clause() } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IColumn_name_listContext is an interface to support dynamic dispatch. @@ -19408,23 +21750,28 @@ type IColumn_name_listContext interface { } type Column_name_listContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyColumn_name_listContext() *Column_name_listContext { var p = new(Column_name_listContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_column_name_list return p } +func InitEmptyColumn_name_listContext(p *Column_name_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_column_name_list +} + func (*Column_name_listContext) IsColumn_name_listContext() {} func NewColumn_name_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Column_name_listContext { var p = new(Column_name_listContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_column_name_list @@ -19512,62 +21859,71 @@ func (s *Column_name_listContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Column_name_list() (localctx IColumn_name_listContext) { - this := p - _ = this - localctx = NewColumn_name_listContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 108, SQLiteParserRULE_column_name_list) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(1668) + p.SetState(1669) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1669) + p.SetState(1670) p.Column_name() } - p.SetState(1674) + p.SetState(1675) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1670) + p.SetState(1671) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1671) + p.SetState(1672) p.Column_name() } - p.SetState(1676) + p.SetState(1677) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { - p.SetState(1677) + p.SetState(1678) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IUpdate_stmt_limitedContext is an interface to support dynamic dispatch. @@ -19607,23 +21963,28 @@ type IUpdate_stmt_limitedContext interface { } type Update_stmt_limitedContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyUpdate_stmt_limitedContext() *Update_stmt_limitedContext { var p = new(Update_stmt_limitedContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_update_stmt_limited return p } +func InitEmptyUpdate_stmt_limitedContext(p *Update_stmt_limitedContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_update_stmt_limited +} + func (*Update_stmt_limitedContext) IsUpdate_stmt_limitedContext() {} func NewUpdate_stmt_limitedContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Update_stmt_limitedContext { var p = new(Update_stmt_limitedContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_update_stmt_limited @@ -19893,58 +22254,50 @@ func (s *Update_stmt_limitedContext) ExitRule(listener antlr.ParseTreeListener) } func (p *SQLiteParser) Update_stmt_limited() (localctx IUpdate_stmt_limitedContext) { - this := p - _ = this - localctx = NewUpdate_stmt_limitedContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 110, SQLiteParserRULE_update_stmt_limited) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) - p.SetState(1680) + p.SetState(1681) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserWITH_ { { - p.SetState(1679) + p.SetState(1680) p.With_clause() } } { - p.SetState(1682) + p.SetState(1683) p.Match(SQLiteParserUPDATE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1685) + p.SetState(1686) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 248, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 247, p.GetParserRuleContext()) == 1 { { - p.SetState(1683) + p.SetState(1684) p.Match(SQLiteParserOR_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1684) + p.SetState(1685) _la = p.GetTokenStream().LA(1) - if !(_la == SQLiteParserABORT_ || ((int64((_la-72)) & ^0x3f) == 0 && ((int64(1)<<(_la-72))&19140298416325121) != 0)) { + if !(_la == SQLiteParserABORT_ || ((int64((_la-74)) & ^0x3f) == 0 && ((int64(1)<<(_la-74))&19140298416325121) != 0)) { p.GetErrorHandler().RecoverInline(p) } else { p.GetErrorHandler().ReportMatch(p) @@ -19952,116 +22305,175 @@ func (p *SQLiteParser) Update_stmt_limited() (localctx IUpdate_stmt_limitedConte } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1687) + p.SetState(1688) p.Qualified_table_name() } { - p.SetState(1688) + p.SetState(1689) p.Match(SQLiteParserSET_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1691) + p.SetState(1692) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 249, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 248, p.GetParserRuleContext()) { case 1: { - p.SetState(1689) + p.SetState(1690) p.Column_name() } case 2: { - p.SetState(1690) + p.SetState(1691) p.Column_name_list() } + case antlr.ATNInvalidAltNumber: + goto errorExit } { - p.SetState(1693) + p.SetState(1694) p.Match(SQLiteParserASSIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1694) + p.SetState(1695) p.expr(0) } - p.SetState(1705) + p.SetState(1706) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1695) + p.SetState(1696) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1698) + p.SetState(1699) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 250, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 249, p.GetParserRuleContext()) { case 1: { - p.SetState(1696) + p.SetState(1697) p.Column_name() } case 2: { - p.SetState(1697) + p.SetState(1698) p.Column_name_list() } + case antlr.ATNInvalidAltNumber: + goto errorExit } { - p.SetState(1700) + p.SetState(1701) p.Match(SQLiteParserASSIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1701) + p.SetState(1702) p.expr(0) } - p.SetState(1707) + p.SetState(1708) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } - p.SetState(1710) + p.SetState(1711) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserWHERE_ { { - p.SetState(1708) + p.SetState(1709) p.Match(SQLiteParserWHERE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1709) + p.SetState(1710) p.expr(0) } } - p.SetState(1716) + p.SetState(1717) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserLIMIT_ || _la == SQLiteParserORDER_ { - p.SetState(1713) + p.SetState(1714) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserORDER_ { { - p.SetState(1712) + p.SetState(1713) p.Order_by_stmt() } } { - p.SetState(1715) + p.SetState(1716) p.Limit_stmt() } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IQualified_table_nameContext is an interface to support dynamic dispatch. @@ -20087,23 +22499,28 @@ type IQualified_table_nameContext interface { } type Qualified_table_nameContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyQualified_table_nameContext() *Qualified_table_nameContext { var p = new(Qualified_table_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_qualified_table_name return p } +func InitEmptyQualified_table_nameContext(p *Qualified_table_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_qualified_table_name +} + func (*Qualified_table_nameContext) IsQualified_table_nameContext() {} func NewQualified_table_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Qualified_table_nameContext { var p = new(Qualified_table_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_qualified_table_name @@ -20218,97 +22635,119 @@ func (s *Qualified_table_nameContext) ExitRule(listener antlr.ParseTreeListener) } func (p *SQLiteParser) Qualified_table_name() (localctx IQualified_table_nameContext) { - this := p - _ = this - localctx = NewQualified_table_nameContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 112, SQLiteParserRULE_qualified_table_name) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) - p.SetState(1721) + p.SetState(1722) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 255, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 254, p.GetParserRuleContext()) == 1 { { - p.SetState(1718) + p.SetState(1719) p.Schema_name() } { - p.SetState(1719) + p.SetState(1720) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1723) + p.SetState(1724) p.Table_name() } - p.SetState(1726) + p.SetState(1727) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserAS_ { { - p.SetState(1724) + p.SetState(1725) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1725) + p.SetState(1726) p.Alias() } } - p.SetState(1733) + p.SetState(1734) p.GetErrorHandler().Sync(p) - + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserINDEXED_: { - p.SetState(1728) + p.SetState(1729) p.Match(SQLiteParserINDEXED_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1729) + p.SetState(1730) p.Match(SQLiteParserBY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1730) + p.SetState(1731) p.Index_name() } case SQLiteParserNOT_: { - p.SetState(1731) + p.SetState(1732) p.Match(SQLiteParserNOT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1732) + p.SetState(1733) p.Match(SQLiteParserINDEXED_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - case SQLiteParserEOF, SQLiteParserSCOL, SQLiteParserALTER_, SQLiteParserANALYZE_, SQLiteParserATTACH_, SQLiteParserBEGIN_, SQLiteParserCOMMIT_, SQLiteParserCREATE_, SQLiteParserDEFAULT_, SQLiteParserDELETE_, SQLiteParserDETACH_, SQLiteParserDROP_, SQLiteParserEND_, SQLiteParserEXPLAIN_, SQLiteParserINSERT_, SQLiteParserLIMIT_, SQLiteParserORDER_, SQLiteParserPRAGMA_, SQLiteParserREINDEX_, SQLiteParserRELEASE_, SQLiteParserREPLACE_, SQLiteParserRETURNING_, SQLiteParserROLLBACK_, SQLiteParserSAVEPOINT_, SQLiteParserSELECT_, SQLiteParserSET_, SQLiteParserUPDATE_, SQLiteParserVACUUM_, SQLiteParserVALUES_, SQLiteParserWHERE_, SQLiteParserWITH_: + case SQLiteParserEOF, SQLiteParserSCOL, SQLiteParserALTER_, SQLiteParserANALYZE_, SQLiteParserATTACH_, SQLiteParserBEGIN_, SQLiteParserCOMMIT_, SQLiteParserCREATE_, SQLiteParserDELETE_, SQLiteParserDETACH_, SQLiteParserDROP_, SQLiteParserEND_, SQLiteParserEXPLAIN_, SQLiteParserINSERT_, SQLiteParserLIMIT_, SQLiteParserORDER_, SQLiteParserPRAGMA_, SQLiteParserREINDEX_, SQLiteParserRELEASE_, SQLiteParserREPLACE_, SQLiteParserRETURNING_, SQLiteParserROLLBACK_, SQLiteParserSAVEPOINT_, SQLiteParserSELECT_, SQLiteParserSET_, SQLiteParserUPDATE_, SQLiteParserVACUUM_, SQLiteParserVALUES_, SQLiteParserWHERE_, SQLiteParserWITH_: default: } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IVacuum_stmtContext is an interface to support dynamic dispatch. @@ -20329,23 +22768,28 @@ type IVacuum_stmtContext interface { } type Vacuum_stmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyVacuum_stmtContext() *Vacuum_stmtContext { var p = new(Vacuum_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_vacuum_stmt return p } +func InitEmptyVacuum_stmtContext(p *Vacuum_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_vacuum_stmt +} + func (*Vacuum_stmtContext) IsVacuum_stmtContext() {} func NewVacuum_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Vacuum_stmtContext { var p = new(Vacuum_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_vacuum_stmt @@ -20416,61 +22860,65 @@ func (s *Vacuum_stmtContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Vacuum_stmt() (localctx IVacuum_stmtContext) { - this := p - _ = this - localctx = NewVacuum_stmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 114, SQLiteParserRULE_vacuum_stmt) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(1735) + p.SetState(1736) p.Match(SQLiteParserVACUUM_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1737) + p.SetState(1738) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 258, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 257, p.GetParserRuleContext()) == 1 { { - p.SetState(1736) + p.SetState(1737) p.Schema_name() } + } else if p.HasError() { // JIM + goto errorExit } - p.SetState(1741) + p.SetState(1742) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserINTO_ { { - p.SetState(1739) + p.SetState(1740) p.Match(SQLiteParserINTO_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1740) + p.SetState(1741) p.Filename() } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IFilter_clauseContext is an interface to support dynamic dispatch. @@ -20492,23 +22940,28 @@ type IFilter_clauseContext interface { } type Filter_clauseContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyFilter_clauseContext() *Filter_clauseContext { var p = new(Filter_clauseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_filter_clause return p } +func InitEmptyFilter_clauseContext(p *Filter_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_filter_clause +} + func (*Filter_clauseContext) IsFilter_clauseContext() {} func NewFilter_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Filter_clauseContext { var p = new(Filter_clauseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_filter_clause @@ -20571,51 +23024,57 @@ func (s *Filter_clauseContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Filter_clause() (localctx IFilter_clauseContext) { - this := p - _ = this - localctx = NewFilter_clauseContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 116, SQLiteParserRULE_filter_clause) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(1743) + p.SetState(1744) p.Match(SQLiteParserFILTER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1744) + p.SetState(1745) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1745) + p.SetState(1746) p.Match(SQLiteParserWHERE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1746) + p.SetState(1747) p.expr(0) } { - p.SetState(1747) + p.SetState(1748) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IWindow_defnContext is an interface to support dynamic dispatch. @@ -20646,23 +23105,28 @@ type IWindow_defnContext interface { } type Window_defnContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyWindow_defnContext() *Window_defnContext { var p = new(Window_defnContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_window_defn return p } +func InitEmptyWindow_defnContext(p *Window_defnContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_window_defn +} + func (*Window_defnContext) IsWindow_defnContext() {} func NewWindow_defnContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Window_defnContext { var p = new(Window_defnContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_window_defn @@ -20839,130 +23303,173 @@ func (s *Window_defnContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Window_defn() (localctx IWindow_defnContext) { - this := p - _ = this - localctx = NewWindow_defnContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 118, SQLiteParserRULE_window_defn) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() + p.EnterRule(localctx, 118, SQLiteParserRULE_window_defn) + var _la int p.EnterOuterAlt(localctx, 1) { - p.SetState(1749) + p.SetState(1750) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1751) + p.SetState(1752) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 260, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 259, p.GetParserRuleContext()) == 1 { { - p.SetState(1750) + p.SetState(1751) p.Base_window_name() } + } else if p.HasError() { // JIM + goto errorExit } - p.SetState(1763) + p.SetState(1764) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserPARTITION_ { { - p.SetState(1753) + p.SetState(1754) p.Match(SQLiteParserPARTITION_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1754) + p.SetState(1755) p.Match(SQLiteParserBY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1755) + p.SetState(1756) p.expr(0) } - p.SetState(1760) + p.SetState(1761) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1756) + p.SetState(1757) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1757) + p.SetState(1758) p.expr(0) } - p.SetState(1762) + p.SetState(1763) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } } { - p.SetState(1765) + p.SetState(1766) p.Match(SQLiteParserORDER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1766) + p.SetState(1767) p.Match(SQLiteParserBY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1767) + p.SetState(1768) p.Ordering_term() } - p.SetState(1772) + p.SetState(1773) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1768) + p.SetState(1769) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1769) + p.SetState(1770) p.Ordering_term() } - p.SetState(1774) + p.SetState(1775) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } - p.SetState(1776) + p.SetState(1777) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) - if (int64((_la-128)) & ^0x3f) == 0 && ((int64(1)<<(_la-128))&4503599761588225) != 0 { + if (int64((_la-130)) & ^0x3f) == 0 && ((int64(1)<<(_la-130))&4503599761588225) != 0 { { - p.SetState(1775) + p.SetState(1776) p.Frame_spec() } } { - p.SetState(1778) + p.SetState(1779) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IOver_clauseContext is an interface to support dynamic dispatch. @@ -20995,23 +23502,28 @@ type IOver_clauseContext interface { } type Over_clauseContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyOver_clauseContext() *Over_clauseContext { var p = new(Over_clauseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_over_clause return p } +func InitEmptyOver_clauseContext(p *Over_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_over_clause +} + func (*Over_clauseContext) IsOver_clauseContext() {} func NewOver_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Over_clauseContext { var p = new(Over_clauseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_over_clause @@ -21208,151 +23720,207 @@ func (s *Over_clauseContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Over_clause() (localctx IOver_clauseContext) { - this := p - _ = this - localctx = NewOver_clauseContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 120, SQLiteParserRULE_over_clause) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(1780) + p.SetState(1781) p.Match(SQLiteParserOVER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1814) + p.SetState(1815) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 271, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 270, p.GetParserRuleContext()) { case 1: { - p.SetState(1781) + p.SetState(1782) p.Window_name() } case 2: { - p.SetState(1782) + p.SetState(1783) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1784) + p.SetState(1785) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 265, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 264, p.GetParserRuleContext()) == 1 { { - p.SetState(1783) + p.SetState(1784) p.Base_window_name() } + } else if p.HasError() { // JIM + goto errorExit } - p.SetState(1796) + p.SetState(1797) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserPARTITION_ { { - p.SetState(1786) + p.SetState(1787) p.Match(SQLiteParserPARTITION_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1787) + p.SetState(1788) p.Match(SQLiteParserBY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1788) + p.SetState(1789) p.expr(0) } - p.SetState(1793) + p.SetState(1794) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1789) + p.SetState(1790) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1790) + p.SetState(1791) p.expr(0) } - p.SetState(1795) + p.SetState(1796) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } } - p.SetState(1808) + p.SetState(1809) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserORDER_ { { - p.SetState(1798) + p.SetState(1799) p.Match(SQLiteParserORDER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1799) + p.SetState(1800) p.Match(SQLiteParserBY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1800) + p.SetState(1801) p.Ordering_term() } - p.SetState(1805) + p.SetState(1806) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1801) + p.SetState(1802) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1802) + p.SetState(1803) p.Ordering_term() } - p.SetState(1807) + p.SetState(1808) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } } - p.SetState(1811) + p.SetState(1812) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) - if (int64((_la-128)) & ^0x3f) == 0 && ((int64(1)<<(_la-128))&4503599761588225) != 0 { + if (int64((_la-130)) & ^0x3f) == 0 && ((int64(1)<<(_la-130))&4503599761588225) != 0 { { - p.SetState(1810) + p.SetState(1811) p.Frame_spec() } } { - p.SetState(1813) + p.SetState(1814) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + case antlr.ATNInvalidAltNumber: + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IFrame_specContext is an interface to support dynamic dispatch. @@ -21377,23 +23945,28 @@ type IFrame_specContext interface { } type Frame_specContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyFrame_specContext() *Frame_specContext { var p = new(Frame_specContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_frame_spec return p } +func InitEmptyFrame_specContext(p *Frame_specContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_frame_spec +} + func (*Frame_specContext) IsFrame_specContext() {} func NewFrame_specContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Frame_specContext { var p = new(Frame_specContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_frame_spec @@ -21468,72 +24041,82 @@ func (s *Frame_specContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Frame_spec() (localctx IFrame_specContext) { - this := p - _ = this - localctx = NewFrame_specContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 122, SQLiteParserRULE_frame_spec) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(1816) + p.SetState(1817) p.Frame_clause() } - p.SetState(1824) + p.SetState(1825) p.GetErrorHandler().Sync(p) - + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserEXCLUDE_: { - p.SetState(1817) + p.SetState(1818) p.Match(SQLiteParserEXCLUDE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1818) + p.SetState(1819) p.Match(SQLiteParserNO_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1819) + p.SetState(1820) p.Match(SQLiteParserOTHERS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserCURRENT_: { - p.SetState(1820) + p.SetState(1821) p.Match(SQLiteParserCURRENT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1821) + p.SetState(1822) p.Match(SQLiteParserROW_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserGROUP_: { - p.SetState(1822) + p.SetState(1823) p.Match(SQLiteParserGROUP_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserTIES_: { - p.SetState(1823) + p.SetState(1824) p.Match(SQLiteParserTIES_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserCLOSE_PAR: @@ -21541,7 +24124,17 @@ func (p *SQLiteParser) Frame_spec() (localctx IFrame_specContext) { default: } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IFrame_clauseContext is an interface to support dynamic dispatch. @@ -21566,23 +24159,28 @@ type IFrame_clauseContext interface { } type Frame_clauseContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyFrame_clauseContext() *Frame_clauseContext { var p = new(Frame_clauseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_frame_clause return p } +func InitEmptyFrame_clauseContext(p *Frame_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_frame_clause +} + func (*Frame_clauseContext) IsFrame_clauseContext() {} func NewFrame_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Frame_clauseContext { var p = new(Frame_clauseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_frame_clause @@ -21681,71 +24279,76 @@ func (s *Frame_clauseContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Frame_clause() (localctx IFrame_clauseContext) { - this := p - _ = this - localctx = NewFrame_clauseContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 124, SQLiteParserRULE_frame_clause) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(1826) + p.SetState(1827) _la = p.GetTokenStream().LA(1) - if !((int64((_la-128)) & ^0x3f) == 0 && ((int64(1)<<(_la-128))&4503599761588225) != 0) { + if !((int64((_la-130)) & ^0x3f) == 0 && ((int64(1)<<(_la-130))&4503599761588225) != 0) { p.GetErrorHandler().RecoverInline(p) } else { p.GetErrorHandler().ReportMatch(p) p.Consume() } } - p.SetState(1833) + p.SetState(1834) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 273, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 272, p.GetParserRuleContext()) { case 1: { - p.SetState(1827) + p.SetState(1828) p.Frame_single() } case 2: { - p.SetState(1828) + p.SetState(1829) p.Match(SQLiteParserBETWEEN_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1829) + p.SetState(1830) p.Frame_left() } { - p.SetState(1830) + p.SetState(1831) p.Match(SQLiteParserAND_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1831) + p.SetState(1832) p.Frame_right() } + case antlr.ATNInvalidAltNumber: + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ISimple_function_invocationContext is an interface to support dynamic dispatch. @@ -21770,23 +24373,28 @@ type ISimple_function_invocationContext interface { } type Simple_function_invocationContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptySimple_function_invocationContext() *Simple_function_invocationContext { var p = new(Simple_function_invocationContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_simple_function_invocation return p } +func InitEmptySimple_function_invocationContext(p *Simple_function_invocationContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_simple_function_invocation +} + func (*Simple_function_invocationContext) IsSimple_function_invocationContext() {} func NewSimple_function_invocationContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Simple_function_invocationContext { var p = new(Simple_function_invocationContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_simple_function_invocation @@ -21894,81 +24502,98 @@ func (s *Simple_function_invocationContext) ExitRule(listener antlr.ParseTreeLis } func (p *SQLiteParser) Simple_function_invocation() (localctx ISimple_function_invocationContext) { - this := p - _ = this - localctx = NewSimple_function_invocationContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 126, SQLiteParserRULE_simple_function_invocation) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(1835) + p.SetState(1836) p.Simple_func() } { - p.SetState(1836) + p.SetState(1837) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1846) + p.SetState(1847) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserOPEN_PAR, SQLiteParserPLUS, SQLiteParserMINUS, SQLiteParserTILDE, SQLiteParserABORT_, SQLiteParserACTION_, SQLiteParserADD_, SQLiteParserAFTER_, SQLiteParserALL_, SQLiteParserALTER_, SQLiteParserANALYZE_, SQLiteParserAND_, SQLiteParserAS_, SQLiteParserASC_, SQLiteParserATTACH_, SQLiteParserAUTOINCREMENT_, SQLiteParserBEFORE_, SQLiteParserBEGIN_, SQLiteParserBETWEEN_, SQLiteParserBY_, SQLiteParserCASCADE_, SQLiteParserCASE_, SQLiteParserCAST_, SQLiteParserCHECK_, SQLiteParserCOLLATE_, SQLiteParserCOLUMN_, SQLiteParserCOMMIT_, SQLiteParserCONFLICT_, SQLiteParserCONSTRAINT_, SQLiteParserCREATE_, SQLiteParserCROSS_, SQLiteParserCURRENT_DATE_, SQLiteParserCURRENT_TIME_, SQLiteParserCURRENT_TIMESTAMP_, SQLiteParserDATABASE_, SQLiteParserDEFAULT_, SQLiteParserDEFERRABLE_, SQLiteParserDEFERRED_, SQLiteParserDELETE_, SQLiteParserDESC_, SQLiteParserDETACH_, SQLiteParserDISTINCT_, SQLiteParserDROP_, SQLiteParserEACH_, SQLiteParserELSE_, SQLiteParserEND_, SQLiteParserESCAPE_, SQLiteParserEXCEPT_, SQLiteParserEXCLUSIVE_, SQLiteParserEXISTS_, SQLiteParserEXPLAIN_, SQLiteParserFAIL_, SQLiteParserFOR_, SQLiteParserFOREIGN_, SQLiteParserFROM_, SQLiteParserFULL_, SQLiteParserGLOB_, SQLiteParserGROUP_, SQLiteParserHAVING_, SQLiteParserIF_, SQLiteParserIGNORE_, SQLiteParserIMMEDIATE_, SQLiteParserIN_, SQLiteParserINDEX_, SQLiteParserINDEXED_, SQLiteParserINITIALLY_, SQLiteParserINNER_, SQLiteParserINSERT_, SQLiteParserINSTEAD_, SQLiteParserINTERSECT_, SQLiteParserINTO_, SQLiteParserIS_, SQLiteParserISNULL_, SQLiteParserJOIN_, SQLiteParserKEY_, SQLiteParserLEFT_, SQLiteParserLIKE_, SQLiteParserLIMIT_, SQLiteParserMATCH_, SQLiteParserNATURAL_, SQLiteParserNO_, SQLiteParserNOT_, SQLiteParserNOTNULL_, SQLiteParserNULL_, SQLiteParserOF_, SQLiteParserOFFSET_, SQLiteParserON_, SQLiteParserOR_, SQLiteParserORDER_, SQLiteParserOUTER_, SQLiteParserPLAN_, SQLiteParserPRAGMA_, SQLiteParserPRIMARY_, SQLiteParserQUERY_, SQLiteParserRAISE_, SQLiteParserRECURSIVE_, SQLiteParserREFERENCES_, SQLiteParserREGEXP_, SQLiteParserREINDEX_, SQLiteParserRELEASE_, SQLiteParserRENAME_, SQLiteParserREPLACE_, SQLiteParserRESTRICT_, SQLiteParserRETURNING_, SQLiteParserRIGHT_, SQLiteParserROLLBACK_, SQLiteParserROW_, SQLiteParserROWS_, SQLiteParserSAVEPOINT_, SQLiteParserSELECT_, SQLiteParserSET_, SQLiteParserSTRICT_, SQLiteParserTABLE_, SQLiteParserTEMP_, SQLiteParserTEMPORARY_, SQLiteParserTHEN_, SQLiteParserTO_, SQLiteParserTRANSACTION_, SQLiteParserTRIGGER_, SQLiteParserUNION_, SQLiteParserUNIQUE_, SQLiteParserUPDATE_, SQLiteParserUSING_, SQLiteParserVACUUM_, SQLiteParserVALUES_, SQLiteParserVIEW_, SQLiteParserVIRTUAL_, SQLiteParserWHEN_, SQLiteParserWHERE_, SQLiteParserWITH_, SQLiteParserWITHOUT_, SQLiteParserFIRST_VALUE_, SQLiteParserOVER_, SQLiteParserPARTITION_, SQLiteParserRANGE_, SQLiteParserPRECEDING_, SQLiteParserUNBOUNDED_, SQLiteParserCURRENT_, SQLiteParserFOLLOWING_, SQLiteParserCUME_DIST_, SQLiteParserDENSE_RANK_, SQLiteParserLAG_, SQLiteParserLAST_VALUE_, SQLiteParserLEAD_, SQLiteParserNTH_VALUE_, SQLiteParserNTILE_, SQLiteParserPERCENT_RANK_, SQLiteParserRANK_, SQLiteParserROW_NUMBER_, SQLiteParserGENERATED_, SQLiteParserALWAYS_, SQLiteParserSTORED_, SQLiteParserTRUE_, SQLiteParserFALSE_, SQLiteParserWINDOW_, SQLiteParserNULLS_, SQLiteParserFIRST_, SQLiteParserLAST_, SQLiteParserFILTER_, SQLiteParserGROUPS_, SQLiteParserEXCLUDE_, SQLiteParserIDENTIFIER, SQLiteParserNUMERIC_LITERAL, SQLiteParserNUMBERED_BIND_PARAMETER, SQLiteParserNAMED_BIND_PARAMETER, SQLiteParserSTRING_LITERAL, SQLiteParserBLOB_LITERAL: { - p.SetState(1837) + p.SetState(1838) p.expr(0) } - p.SetState(1842) + p.SetState(1843) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1838) + p.SetState(1839) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1839) + p.SetState(1840) p.expr(0) } - p.SetState(1844) + p.SetState(1845) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } case SQLiteParserSTAR: { - p.SetState(1845) + p.SetState(1846) p.Match(SQLiteParserSTAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } { - p.SetState(1848) + p.SetState(1849) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IAggregate_function_invocationContext is an interface to support dynamic dispatch. @@ -21995,23 +24620,28 @@ type IAggregate_function_invocationContext interface { } type Aggregate_function_invocationContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyAggregate_function_invocationContext() *Aggregate_function_invocationContext { var p = new(Aggregate_function_invocationContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_aggregate_function_invocation return p } +func InitEmptyAggregate_function_invocationContext(p *Aggregate_function_invocationContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_aggregate_function_invocation +} + func (*Aggregate_function_invocationContext) IsAggregate_function_invocationContext() {} func NewAggregate_function_invocationContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Aggregate_function_invocationContext { var p = new(Aggregate_function_invocationContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_aggregate_function_invocation @@ -22139,80 +24769,87 @@ func (s *Aggregate_function_invocationContext) ExitRule(listener antlr.ParseTree } func (p *SQLiteParser) Aggregate_function_invocation() (localctx IAggregate_function_invocationContext) { - this := p - _ = this - localctx = NewAggregate_function_invocationContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 128, SQLiteParserRULE_aggregate_function_invocation) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(1850) + p.SetState(1851) p.Aggregate_func() } { - p.SetState(1851) + p.SetState(1852) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1864) + p.SetState(1865) p.GetErrorHandler().Sync(p) - + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserOPEN_PAR, SQLiteParserPLUS, SQLiteParserMINUS, SQLiteParserTILDE, SQLiteParserABORT_, SQLiteParserACTION_, SQLiteParserADD_, SQLiteParserAFTER_, SQLiteParserALL_, SQLiteParserALTER_, SQLiteParserANALYZE_, SQLiteParserAND_, SQLiteParserAS_, SQLiteParserASC_, SQLiteParserATTACH_, SQLiteParserAUTOINCREMENT_, SQLiteParserBEFORE_, SQLiteParserBEGIN_, SQLiteParserBETWEEN_, SQLiteParserBY_, SQLiteParserCASCADE_, SQLiteParserCASE_, SQLiteParserCAST_, SQLiteParserCHECK_, SQLiteParserCOLLATE_, SQLiteParserCOLUMN_, SQLiteParserCOMMIT_, SQLiteParserCONFLICT_, SQLiteParserCONSTRAINT_, SQLiteParserCREATE_, SQLiteParserCROSS_, SQLiteParserCURRENT_DATE_, SQLiteParserCURRENT_TIME_, SQLiteParserCURRENT_TIMESTAMP_, SQLiteParserDATABASE_, SQLiteParserDEFAULT_, SQLiteParserDEFERRABLE_, SQLiteParserDEFERRED_, SQLiteParserDELETE_, SQLiteParserDESC_, SQLiteParserDETACH_, SQLiteParserDISTINCT_, SQLiteParserDROP_, SQLiteParserEACH_, SQLiteParserELSE_, SQLiteParserEND_, SQLiteParserESCAPE_, SQLiteParserEXCEPT_, SQLiteParserEXCLUSIVE_, SQLiteParserEXISTS_, SQLiteParserEXPLAIN_, SQLiteParserFAIL_, SQLiteParserFOR_, SQLiteParserFOREIGN_, SQLiteParserFROM_, SQLiteParserFULL_, SQLiteParserGLOB_, SQLiteParserGROUP_, SQLiteParserHAVING_, SQLiteParserIF_, SQLiteParserIGNORE_, SQLiteParserIMMEDIATE_, SQLiteParserIN_, SQLiteParserINDEX_, SQLiteParserINDEXED_, SQLiteParserINITIALLY_, SQLiteParserINNER_, SQLiteParserINSERT_, SQLiteParserINSTEAD_, SQLiteParserINTERSECT_, SQLiteParserINTO_, SQLiteParserIS_, SQLiteParserISNULL_, SQLiteParserJOIN_, SQLiteParserKEY_, SQLiteParserLEFT_, SQLiteParserLIKE_, SQLiteParserLIMIT_, SQLiteParserMATCH_, SQLiteParserNATURAL_, SQLiteParserNO_, SQLiteParserNOT_, SQLiteParserNOTNULL_, SQLiteParserNULL_, SQLiteParserOF_, SQLiteParserOFFSET_, SQLiteParserON_, SQLiteParserOR_, SQLiteParserORDER_, SQLiteParserOUTER_, SQLiteParserPLAN_, SQLiteParserPRAGMA_, SQLiteParserPRIMARY_, SQLiteParserQUERY_, SQLiteParserRAISE_, SQLiteParserRECURSIVE_, SQLiteParserREFERENCES_, SQLiteParserREGEXP_, SQLiteParserREINDEX_, SQLiteParserRELEASE_, SQLiteParserRENAME_, SQLiteParserREPLACE_, SQLiteParserRESTRICT_, SQLiteParserRETURNING_, SQLiteParserRIGHT_, SQLiteParserROLLBACK_, SQLiteParserROW_, SQLiteParserROWS_, SQLiteParserSAVEPOINT_, SQLiteParserSELECT_, SQLiteParserSET_, SQLiteParserSTRICT_, SQLiteParserTABLE_, SQLiteParserTEMP_, SQLiteParserTEMPORARY_, SQLiteParserTHEN_, SQLiteParserTO_, SQLiteParserTRANSACTION_, SQLiteParserTRIGGER_, SQLiteParserUNION_, SQLiteParserUNIQUE_, SQLiteParserUPDATE_, SQLiteParserUSING_, SQLiteParserVACUUM_, SQLiteParserVALUES_, SQLiteParserVIEW_, SQLiteParserVIRTUAL_, SQLiteParserWHEN_, SQLiteParserWHERE_, SQLiteParserWITH_, SQLiteParserWITHOUT_, SQLiteParserFIRST_VALUE_, SQLiteParserOVER_, SQLiteParserPARTITION_, SQLiteParserRANGE_, SQLiteParserPRECEDING_, SQLiteParserUNBOUNDED_, SQLiteParserCURRENT_, SQLiteParserFOLLOWING_, SQLiteParserCUME_DIST_, SQLiteParserDENSE_RANK_, SQLiteParserLAG_, SQLiteParserLAST_VALUE_, SQLiteParserLEAD_, SQLiteParserNTH_VALUE_, SQLiteParserNTILE_, SQLiteParserPERCENT_RANK_, SQLiteParserRANK_, SQLiteParserROW_NUMBER_, SQLiteParserGENERATED_, SQLiteParserALWAYS_, SQLiteParserSTORED_, SQLiteParserTRUE_, SQLiteParserFALSE_, SQLiteParserWINDOW_, SQLiteParserNULLS_, SQLiteParserFIRST_, SQLiteParserLAST_, SQLiteParserFILTER_, SQLiteParserGROUPS_, SQLiteParserEXCLUDE_, SQLiteParserIDENTIFIER, SQLiteParserNUMERIC_LITERAL, SQLiteParserNUMBERED_BIND_PARAMETER, SQLiteParserNAMED_BIND_PARAMETER, SQLiteParserSTRING_LITERAL, SQLiteParserBLOB_LITERAL: - p.SetState(1853) + p.SetState(1854) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 276, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 275, p.GetParserRuleContext()) == 1 { { - p.SetState(1852) + p.SetState(1853) p.Match(SQLiteParserDISTINCT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1855) + p.SetState(1856) p.expr(0) } - p.SetState(1860) + p.SetState(1861) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1856) + p.SetState(1857) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1857) + p.SetState(1858) p.expr(0) } - p.SetState(1862) + p.SetState(1863) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } case SQLiteParserSTAR: { - p.SetState(1863) + p.SetState(1864) p.Match(SQLiteParserSTAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserCLOSE_PAR: @@ -22220,22 +24857,39 @@ func (p *SQLiteParser) Aggregate_function_invocation() (localctx IAggregate_func default: } { - p.SetState(1866) + p.SetState(1867) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1868) + p.SetState(1869) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserFILTER_ { { - p.SetState(1867) + p.SetState(1868) p.Filter_clause() } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IWindow_function_invocationContext is an interface to support dynamic dispatch. @@ -22264,23 +24918,28 @@ type IWindow_function_invocationContext interface { } type Window_function_invocationContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyWindow_function_invocationContext() *Window_function_invocationContext { var p = new(Window_function_invocationContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_window_function_invocation return p } +func InitEmptyWindow_function_invocationContext(p *Window_function_invocationContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_window_function_invocation +} + func (*Window_function_invocationContext) IsWindow_function_invocationContext() {} func NewWindow_function_invocationContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Window_function_invocationContext { var p = new(Window_function_invocationContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_window_function_invocation @@ -22440,70 +25099,71 @@ func (s *Window_function_invocationContext) ExitRule(listener antlr.ParseTreeLis } func (p *SQLiteParser) Window_function_invocation() (localctx IWindow_function_invocationContext) { - this := p - _ = this - localctx = NewWindow_function_invocationContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 130, SQLiteParserRULE_window_function_invocation) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(1870) + p.SetState(1871) p.Window_function() } { - p.SetState(1871) + p.SetState(1872) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1881) + p.SetState(1882) p.GetErrorHandler().Sync(p) - + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserOPEN_PAR, SQLiteParserPLUS, SQLiteParserMINUS, SQLiteParserTILDE, SQLiteParserABORT_, SQLiteParserACTION_, SQLiteParserADD_, SQLiteParserAFTER_, SQLiteParserALL_, SQLiteParserALTER_, SQLiteParserANALYZE_, SQLiteParserAND_, SQLiteParserAS_, SQLiteParserASC_, SQLiteParserATTACH_, SQLiteParserAUTOINCREMENT_, SQLiteParserBEFORE_, SQLiteParserBEGIN_, SQLiteParserBETWEEN_, SQLiteParserBY_, SQLiteParserCASCADE_, SQLiteParserCASE_, SQLiteParserCAST_, SQLiteParserCHECK_, SQLiteParserCOLLATE_, SQLiteParserCOLUMN_, SQLiteParserCOMMIT_, SQLiteParserCONFLICT_, SQLiteParserCONSTRAINT_, SQLiteParserCREATE_, SQLiteParserCROSS_, SQLiteParserCURRENT_DATE_, SQLiteParserCURRENT_TIME_, SQLiteParserCURRENT_TIMESTAMP_, SQLiteParserDATABASE_, SQLiteParserDEFAULT_, SQLiteParserDEFERRABLE_, SQLiteParserDEFERRED_, SQLiteParserDELETE_, SQLiteParserDESC_, SQLiteParserDETACH_, SQLiteParserDISTINCT_, SQLiteParserDROP_, SQLiteParserEACH_, SQLiteParserELSE_, SQLiteParserEND_, SQLiteParserESCAPE_, SQLiteParserEXCEPT_, SQLiteParserEXCLUSIVE_, SQLiteParserEXISTS_, SQLiteParserEXPLAIN_, SQLiteParserFAIL_, SQLiteParserFOR_, SQLiteParserFOREIGN_, SQLiteParserFROM_, SQLiteParserFULL_, SQLiteParserGLOB_, SQLiteParserGROUP_, SQLiteParserHAVING_, SQLiteParserIF_, SQLiteParserIGNORE_, SQLiteParserIMMEDIATE_, SQLiteParserIN_, SQLiteParserINDEX_, SQLiteParserINDEXED_, SQLiteParserINITIALLY_, SQLiteParserINNER_, SQLiteParserINSERT_, SQLiteParserINSTEAD_, SQLiteParserINTERSECT_, SQLiteParserINTO_, SQLiteParserIS_, SQLiteParserISNULL_, SQLiteParserJOIN_, SQLiteParserKEY_, SQLiteParserLEFT_, SQLiteParserLIKE_, SQLiteParserLIMIT_, SQLiteParserMATCH_, SQLiteParserNATURAL_, SQLiteParserNO_, SQLiteParserNOT_, SQLiteParserNOTNULL_, SQLiteParserNULL_, SQLiteParserOF_, SQLiteParserOFFSET_, SQLiteParserON_, SQLiteParserOR_, SQLiteParserORDER_, SQLiteParserOUTER_, SQLiteParserPLAN_, SQLiteParserPRAGMA_, SQLiteParserPRIMARY_, SQLiteParserQUERY_, SQLiteParserRAISE_, SQLiteParserRECURSIVE_, SQLiteParserREFERENCES_, SQLiteParserREGEXP_, SQLiteParserREINDEX_, SQLiteParserRELEASE_, SQLiteParserRENAME_, SQLiteParserREPLACE_, SQLiteParserRESTRICT_, SQLiteParserRETURNING_, SQLiteParserRIGHT_, SQLiteParserROLLBACK_, SQLiteParserROW_, SQLiteParserROWS_, SQLiteParserSAVEPOINT_, SQLiteParserSELECT_, SQLiteParserSET_, SQLiteParserSTRICT_, SQLiteParserTABLE_, SQLiteParserTEMP_, SQLiteParserTEMPORARY_, SQLiteParserTHEN_, SQLiteParserTO_, SQLiteParserTRANSACTION_, SQLiteParserTRIGGER_, SQLiteParserUNION_, SQLiteParserUNIQUE_, SQLiteParserUPDATE_, SQLiteParserUSING_, SQLiteParserVACUUM_, SQLiteParserVALUES_, SQLiteParserVIEW_, SQLiteParserVIRTUAL_, SQLiteParserWHEN_, SQLiteParserWHERE_, SQLiteParserWITH_, SQLiteParserWITHOUT_, SQLiteParserFIRST_VALUE_, SQLiteParserOVER_, SQLiteParserPARTITION_, SQLiteParserRANGE_, SQLiteParserPRECEDING_, SQLiteParserUNBOUNDED_, SQLiteParserCURRENT_, SQLiteParserFOLLOWING_, SQLiteParserCUME_DIST_, SQLiteParserDENSE_RANK_, SQLiteParserLAG_, SQLiteParserLAST_VALUE_, SQLiteParserLEAD_, SQLiteParserNTH_VALUE_, SQLiteParserNTILE_, SQLiteParserPERCENT_RANK_, SQLiteParserRANK_, SQLiteParserROW_NUMBER_, SQLiteParserGENERATED_, SQLiteParserALWAYS_, SQLiteParserSTORED_, SQLiteParserTRUE_, SQLiteParserFALSE_, SQLiteParserWINDOW_, SQLiteParserNULLS_, SQLiteParserFIRST_, SQLiteParserLAST_, SQLiteParserFILTER_, SQLiteParserGROUPS_, SQLiteParserEXCLUDE_, SQLiteParserIDENTIFIER, SQLiteParserNUMERIC_LITERAL, SQLiteParserNUMBERED_BIND_PARAMETER, SQLiteParserNAMED_BIND_PARAMETER, SQLiteParserSTRING_LITERAL, SQLiteParserBLOB_LITERAL: { - p.SetState(1872) + p.SetState(1873) p.expr(0) } - p.SetState(1877) + p.SetState(1878) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1873) + p.SetState(1874) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1874) + p.SetState(1875) p.expr(0) } - p.SetState(1879) + p.SetState(1880) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } case SQLiteParserSTAR: { - p.SetState(1880) + p.SetState(1881) p.Match(SQLiteParserSTAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserCLOSE_PAR: @@ -22511,42 +25171,69 @@ func (p *SQLiteParser) Window_function_invocation() (localctx IWindow_function_i default: } { - p.SetState(1883) + p.SetState(1884) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1885) + p.SetState(1886) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserFILTER_ { { - p.SetState(1884) + p.SetState(1885) p.Filter_clause() } } { - p.SetState(1887) + p.SetState(1888) p.Match(SQLiteParserOVER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1890) + p.SetState(1891) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 283, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 282, p.GetParserRuleContext()) { case 1: { - p.SetState(1888) + p.SetState(1889) p.Window_defn() } case 2: { - p.SetState(1889) + p.SetState(1890) p.Window_name() } + case antlr.ATNInvalidAltNumber: + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ICommon_table_stmtContext is an interface to support dynamic dispatch. @@ -22569,23 +25256,28 @@ type ICommon_table_stmtContext interface { } type Common_table_stmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyCommon_table_stmtContext() *Common_table_stmtContext { var p = new(Common_table_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_common_table_stmt return p } +func InitEmptyCommon_table_stmtContext(p *Common_table_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_common_table_stmt +} + func (*Common_table_stmtContext) IsCommon_table_stmtContext() {} func NewCommon_table_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Common_table_stmtContext { var p = new(Common_table_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_common_table_stmt @@ -22673,68 +25365,79 @@ func (s *Common_table_stmtContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Common_table_stmt() (localctx ICommon_table_stmtContext) { - this := p - _ = this - localctx = NewCommon_table_stmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 132, SQLiteParserRULE_common_table_stmt) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(1892) + p.SetState(1893) p.Match(SQLiteParserWITH_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1894) + p.SetState(1895) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 284, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 283, p.GetParserRuleContext()) == 1 { { - p.SetState(1893) + p.SetState(1894) p.Match(SQLiteParserRECURSIVE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1896) + p.SetState(1897) p.Common_table_expression() } - p.SetState(1901) + p.SetState(1902) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1897) + p.SetState(1898) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1898) + p.SetState(1899) p.Common_table_expression() } - p.SetState(1903) + p.SetState(1904) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IOrder_by_stmtContext is an interface to support dynamic dispatch. @@ -22757,23 +25460,28 @@ type IOrder_by_stmtContext interface { } type Order_by_stmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyOrder_by_stmtContext() *Order_by_stmtContext { var p = new(Order_by_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_order_by_stmt return p } +func InitEmptyOrder_by_stmtContext(p *Order_by_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_order_by_stmt +} + func (*Order_by_stmtContext) IsOrder_by_stmtContext() {} func NewOrder_by_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Order_by_stmtContext { var p = new(Order_by_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_order_by_stmt @@ -22861,62 +25569,71 @@ func (s *Order_by_stmtContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Order_by_stmt() (localctx IOrder_by_stmtContext) { - this := p - _ = this - localctx = NewOrder_by_stmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 134, SQLiteParserRULE_order_by_stmt) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(1904) + p.SetState(1905) p.Match(SQLiteParserORDER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1905) + p.SetState(1906) p.Match(SQLiteParserBY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1906) + p.SetState(1907) p.Ordering_term() } - p.SetState(1911) + p.SetState(1912) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1907) + p.SetState(1908) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1908) + p.SetState(1909) p.Ordering_term() } - p.SetState(1913) + p.SetState(1914) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ILimit_stmtContext is an interface to support dynamic dispatch. @@ -22938,23 +25655,28 @@ type ILimit_stmtContext interface { } type Limit_stmtContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyLimit_stmtContext() *Limit_stmtContext { var p = new(Limit_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_limit_stmt return p } +func InitEmptyLimit_stmtContext(p *Limit_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_limit_stmt +} + func (*Limit_stmtContext) IsLimit_stmtContext() {} func NewLimit_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Limit_stmtContext { var p = new(Limit_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_limit_stmt @@ -23038,45 +25760,33 @@ func (s *Limit_stmtContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Limit_stmt() (localctx ILimit_stmtContext) { - this := p - _ = this - localctx = NewLimit_stmtContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 136, SQLiteParserRULE_limit_stmt) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(1914) + p.SetState(1915) p.Match(SQLiteParserLIMIT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1915) + p.SetState(1916) p.expr(0) } - p.SetState(1918) + p.SetState(1919) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserCOMMA || _la == SQLiteParserOFFSET_ { { - p.SetState(1916) + p.SetState(1917) _la = p.GetTokenStream().LA(1) if !(_la == SQLiteParserCOMMA || _la == SQLiteParserOFFSET_) { @@ -23087,13 +25797,23 @@ func (p *SQLiteParser) Limit_stmt() (localctx ILimit_stmtContext) { } } { - p.SetState(1917) + p.SetState(1918) p.expr(0) } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IOrdering_termContext is an interface to support dynamic dispatch. @@ -23117,23 +25837,28 @@ type IOrdering_termContext interface { } type Ordering_termContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyOrdering_termContext() *Ordering_termContext { var p = new(Ordering_termContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_ordering_term return p } +func InitEmptyOrdering_termContext(p *Ordering_termContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_ordering_term +} + func (*Ordering_termContext) IsOrdering_termContext() {} func NewOrdering_termContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Ordering_termContext { var p = new(Ordering_termContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_ordering_term @@ -23228,71 +25953,69 @@ func (s *Ordering_termContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Ordering_term() (localctx IOrdering_termContext) { - this := p - _ = this - localctx = NewOrdering_termContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 138, SQLiteParserRULE_ordering_term) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(1920) + p.SetState(1921) p.expr(0) } - p.SetState(1923) + p.SetState(1924) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserCOLLATE_ { { - p.SetState(1921) + p.SetState(1922) p.Match(SQLiteParserCOLLATE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1922) + p.SetState(1923) p.Collation_name() } } - p.SetState(1926) + p.SetState(1927) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserASC_ || _la == SQLiteParserDESC_ { { - p.SetState(1925) + p.SetState(1926) p.Asc_desc() } } - p.SetState(1930) + p.SetState(1931) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserNULLS_ { { - p.SetState(1928) + p.SetState(1929) p.Match(SQLiteParserNULLS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1929) + p.SetState(1930) _la = p.GetTokenStream().LA(1) if !(_la == SQLiteParserFIRST_ || _la == SQLiteParserLAST_) { @@ -23305,7 +26028,17 @@ func (p *SQLiteParser) Ordering_term() (localctx IOrdering_termContext) { } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IAsc_descContext is an interface to support dynamic dispatch. @@ -23324,23 +26057,28 @@ type IAsc_descContext interface { } type Asc_descContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyAsc_descContext() *Asc_descContext { var p = new(Asc_descContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_asc_desc return p } +func InitEmptyAsc_descContext(p *Asc_descContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_asc_desc +} + func (*Asc_descContext) IsAsc_descContext() {} func NewAsc_descContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Asc_descContext { var p = new(Asc_descContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_asc_desc @@ -23379,32 +26117,13 @@ func (s *Asc_descContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Asc_desc() (localctx IAsc_descContext) { - this := p - _ = this - localctx = NewAsc_descContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 140, SQLiteParserRULE_asc_desc) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(1932) + p.SetState(1933) _la = p.GetTokenStream().LA(1) if !(_la == SQLiteParserASC_ || _la == SQLiteParserDESC_) { @@ -23415,7 +26134,17 @@ func (p *SQLiteParser) Asc_desc() (localctx IAsc_descContext) { } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IFrame_leftContext is an interface to support dynamic dispatch. @@ -23438,23 +26167,28 @@ type IFrame_leftContext interface { } type Frame_leftContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyFrame_leftContext() *Frame_leftContext { var p = new(Frame_leftContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_frame_left return p } +func InitEmptyFrame_leftContext(p *Frame_leftContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_frame_left +} + func (*Frame_leftContext) IsFrame_leftContext() {} func NewFrame_leftContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Frame_leftContext { var p = new(Frame_leftContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_frame_left @@ -23521,78 +26255,98 @@ func (s *Frame_leftContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Frame_left() (localctx IFrame_leftContext) { - this := p - _ = this - localctx = NewFrame_leftContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 142, SQLiteParserRULE_frame_left) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(1944) + p.SetState(1945) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 291, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 290, p.GetParserRuleContext()) { case 1: p.EnterOuterAlt(localctx, 1) { - p.SetState(1934) + p.SetState(1935) p.expr(0) } { - p.SetState(1935) + p.SetState(1936) p.Match(SQLiteParserPRECEDING_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 2: p.EnterOuterAlt(localctx, 2) { - p.SetState(1937) + p.SetState(1938) p.expr(0) } { - p.SetState(1938) + p.SetState(1939) p.Match(SQLiteParserFOLLOWING_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 3: p.EnterOuterAlt(localctx, 3) { - p.SetState(1940) + p.SetState(1941) p.Match(SQLiteParserCURRENT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1941) + p.SetState(1942) p.Match(SQLiteParserROW_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 4: p.EnterOuterAlt(localctx, 4) { - p.SetState(1942) + p.SetState(1943) p.Match(SQLiteParserUNBOUNDED_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1943) + p.SetState(1944) p.Match(SQLiteParserPRECEDING_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + case antlr.ATNInvalidAltNumber: + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IFrame_rightContext is an interface to support dynamic dispatch. @@ -23615,23 +26369,28 @@ type IFrame_rightContext interface { } type Frame_rightContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyFrame_rightContext() *Frame_rightContext { var p = new(Frame_rightContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_frame_right return p } +func InitEmptyFrame_rightContext(p *Frame_rightContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_frame_right +} + func (*Frame_rightContext) IsFrame_rightContext() {} func NewFrame_rightContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Frame_rightContext { var p = new(Frame_rightContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_frame_right @@ -23698,78 +26457,98 @@ func (s *Frame_rightContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Frame_right() (localctx IFrame_rightContext) { - this := p - _ = this - localctx = NewFrame_rightContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 144, SQLiteParserRULE_frame_right) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(1956) + p.SetState(1957) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 292, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 291, p.GetParserRuleContext()) { case 1: p.EnterOuterAlt(localctx, 1) { - p.SetState(1946) + p.SetState(1947) p.expr(0) } { - p.SetState(1947) + p.SetState(1948) p.Match(SQLiteParserPRECEDING_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 2: p.EnterOuterAlt(localctx, 2) { - p.SetState(1949) + p.SetState(1950) p.expr(0) } { - p.SetState(1950) + p.SetState(1951) p.Match(SQLiteParserFOLLOWING_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 3: p.EnterOuterAlt(localctx, 3) { - p.SetState(1952) + p.SetState(1953) p.Match(SQLiteParserCURRENT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1953) + p.SetState(1954) p.Match(SQLiteParserROW_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 4: p.EnterOuterAlt(localctx, 4) { - p.SetState(1954) + p.SetState(1955) p.Match(SQLiteParserUNBOUNDED_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1955) + p.SetState(1956) p.Match(SQLiteParserFOLLOWING_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + case antlr.ATNInvalidAltNumber: + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IFrame_singleContext is an interface to support dynamic dispatch. @@ -23791,23 +26570,28 @@ type IFrame_singleContext interface { } type Frame_singleContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyFrame_singleContext() *Frame_singleContext { var p = new(Frame_singleContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_frame_single return p } +func InitEmptyFrame_singleContext(p *Frame_singleContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_frame_single +} + func (*Frame_singleContext) IsFrame_singleContext() {} func NewFrame_singleContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Frame_singleContext { var p = new(Frame_singleContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_frame_single @@ -23870,67 +26654,83 @@ func (s *Frame_singleContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Frame_single() (localctx IFrame_singleContext) { - this := p - _ = this - localctx = NewFrame_singleContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 146, SQLiteParserRULE_frame_single) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(1965) + p.SetState(1966) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 293, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 292, p.GetParserRuleContext()) { case 1: p.EnterOuterAlt(localctx, 1) { - p.SetState(1958) + p.SetState(1959) p.expr(0) } { - p.SetState(1959) + p.SetState(1960) p.Match(SQLiteParserPRECEDING_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 2: p.EnterOuterAlt(localctx, 2) { - p.SetState(1961) + p.SetState(1962) p.Match(SQLiteParserUNBOUNDED_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1962) + p.SetState(1963) p.Match(SQLiteParserPRECEDING_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 3: p.EnterOuterAlt(localctx, 3) { - p.SetState(1963) + p.SetState(1964) p.Match(SQLiteParserCURRENT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1964) + p.SetState(1965) p.Match(SQLiteParserROW_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + case antlr.ATNInvalidAltNumber: + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IWindow_functionContext is an interface to support dynamic dispatch. @@ -23972,23 +26772,28 @@ type IWindow_functionContext interface { } type Window_functionContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyWindow_functionContext() *Window_functionContext { var p = new(Window_functionContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_window_function return p } +func InitEmptyWindow_functionContext(p *Window_functionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_window_function +} + func (*Window_functionContext) IsWindow_functionContext() {} func NewWindow_functionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Window_functionContext { var p = new(Window_functionContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_window_function @@ -24215,37 +27020,21 @@ func (s *Window_functionContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Window_function() (localctx IWindow_functionContext) { - this := p - _ = this - localctx = NewWindow_functionContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 148, SQLiteParserRULE_window_function) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(2052) + p.SetState(2053) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserFIRST_VALUE_, SQLiteParserLAST_VALUE_: p.EnterOuterAlt(localctx, 1) { - p.SetState(1967) + p.SetState(1968) _la = p.GetTokenStream().LA(1) if !(_la == SQLiteParserFIRST_VALUE_ || _la == SQLiteParserLAST_VALUE_) { @@ -24256,60 +27045,86 @@ func (p *SQLiteParser) Window_function() (localctx IWindow_functionContext) { } } { - p.SetState(1968) + p.SetState(1969) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1969) + p.SetState(1970) p.expr(0) } { - p.SetState(1970) + p.SetState(1971) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1971) + p.SetState(1972) p.Match(SQLiteParserOVER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1972) + p.SetState(1973) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1974) + p.SetState(1975) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserPARTITION_ { { - p.SetState(1973) + p.SetState(1974) p.Partition_by() } } { - p.SetState(1976) + p.SetState(1977) p.Order_by_expr_asc_desc() } - p.SetState(1978) + p.SetState(1979) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) - if (int64((_la-128)) & ^0x3f) == 0 && ((int64(1)<<(_la-128))&4503599761588225) != 0 { + if (int64((_la-130)) & ^0x3f) == 0 && ((int64(1)<<(_la-130))&4503599761588225) != 0 { { - p.SetState(1977) + p.SetState(1978) p.Frame_clause() } } { - p.SetState(1980) + p.SetState(1981) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserCUME_DIST_, SQLiteParserPERCENT_RANK_: p.EnterOuterAlt(localctx, 2) { - p.SetState(1982) + p.SetState(1983) _la = p.GetTokenStream().LA(1) if !(_la == SQLiteParserCUME_DIST_ || _la == SQLiteParserPERCENT_RANK_) { @@ -24320,55 +27135,81 @@ func (p *SQLiteParser) Window_function() (localctx IWindow_functionContext) { } } { - p.SetState(1983) + p.SetState(1984) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1984) + p.SetState(1985) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1985) + p.SetState(1986) p.Match(SQLiteParserOVER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1986) + p.SetState(1987) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1988) + p.SetState(1989) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserPARTITION_ { { - p.SetState(1987) + p.SetState(1988) p.Partition_by() } } - p.SetState(1991) + p.SetState(1992) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserORDER_ { { - p.SetState(1990) + p.SetState(1991) p.Order_by_expr() } } { - p.SetState(1993) + p.SetState(1994) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserDENSE_RANK_, SQLiteParserRANK_, SQLiteParserROW_NUMBER_: p.EnterOuterAlt(localctx, 3) { - p.SetState(1994) + p.SetState(1995) _la = p.GetTokenStream().LA(1) - if !((int64((_la-161)) & ^0x3f) == 0 && ((int64(1)<<(_la-161))&385) != 0) { + if !((int64((_la-163)) & ^0x3f) == 0 && ((int64(1)<<(_la-163))&385) != 0) { p.GetErrorHandler().RecoverInline(p) } else { p.GetErrorHandler().ReportMatch(p) @@ -24376,45 +27217,68 @@ func (p *SQLiteParser) Window_function() (localctx IWindow_functionContext) { } } { - p.SetState(1995) + p.SetState(1996) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1996) + p.SetState(1997) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1997) + p.SetState(1998) p.Match(SQLiteParserOVER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1998) + p.SetState(1999) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(2000) + p.SetState(2001) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserPARTITION_ { { - p.SetState(1999) + p.SetState(2000) p.Partition_by() } } { - p.SetState(2002) + p.SetState(2003) p.Order_by_expr_asc_desc() } { - p.SetState(2003) + p.SetState(2004) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserLAG_, SQLiteParserLEAD_: p.EnterOuterAlt(localctx, 4) { - p.SetState(2005) + p.SetState(2006) _la = p.GetTokenStream().LA(1) if !(_la == SQLiteParserLAG_ || _la == SQLiteParserLEAD_) { @@ -24425,182 +27289,282 @@ func (p *SQLiteParser) Window_function() (localctx IWindow_functionContext) { } } { - p.SetState(2006) + p.SetState(2007) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2007) + p.SetState(2008) p.expr(0) } - p.SetState(2009) + p.SetState(2010) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 299, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 298, p.GetParserRuleContext()) == 1 { { - p.SetState(2008) + p.SetState(2009) p.Of_OF_fset() } + } else if p.HasError() { // JIM + goto errorExit } - p.SetState(2012) + p.SetState(2013) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserCOMMA { { - p.SetState(2011) + p.SetState(2012) p.Default_DEFAULT__value() } } { - p.SetState(2014) + p.SetState(2015) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2015) + p.SetState(2016) p.Match(SQLiteParserOVER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2016) + p.SetState(2017) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(2018) + p.SetState(2019) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserPARTITION_ { { - p.SetState(2017) + p.SetState(2018) p.Partition_by() } } { - p.SetState(2020) + p.SetState(2021) p.Order_by_expr_asc_desc() } { - p.SetState(2021) + p.SetState(2022) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserNTH_VALUE_: p.EnterOuterAlt(localctx, 5) { - p.SetState(2023) + p.SetState(2024) p.Match(SQLiteParserNTH_VALUE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2024) + p.SetState(2025) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2025) + p.SetState(2026) p.expr(0) } { - p.SetState(2026) + p.SetState(2027) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2027) + p.SetState(2028) p.Signed_number() } { - p.SetState(2028) + p.SetState(2029) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2029) + p.SetState(2030) p.Match(SQLiteParserOVER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2030) + p.SetState(2031) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(2032) + p.SetState(2033) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserPARTITION_ { { - p.SetState(2031) + p.SetState(2032) p.Partition_by() } } { - p.SetState(2034) + p.SetState(2035) p.Order_by_expr_asc_desc() } - p.SetState(2036) + p.SetState(2037) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) - if (int64((_la-128)) & ^0x3f) == 0 && ((int64(1)<<(_la-128))&4503599761588225) != 0 { + if (int64((_la-130)) & ^0x3f) == 0 && ((int64(1)<<(_la-130))&4503599761588225) != 0 { { - p.SetState(2035) + p.SetState(2036) p.Frame_clause() } } { - p.SetState(2038) + p.SetState(2039) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserNTILE_: p.EnterOuterAlt(localctx, 6) { - p.SetState(2040) + p.SetState(2041) p.Match(SQLiteParserNTILE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2041) + p.SetState(2042) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2042) + p.SetState(2043) p.expr(0) } { - p.SetState(2043) + p.SetState(2044) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2044) + p.SetState(2045) p.Match(SQLiteParserOVER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2045) + p.SetState(2046) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(2047) + p.SetState(2048) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserPARTITION_ { { - p.SetState(2046) + p.SetState(2047) p.Partition_by() } } { - p.SetState(2049) + p.SetState(2050) p.Order_by_expr_asc_desc() } { - p.SetState(2050) + p.SetState(2051) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IOf_OF_fsetContext is an interface to support dynamic dispatch. @@ -24619,23 +27583,28 @@ type IOf_OF_fsetContext interface { } type Of_OF_fsetContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyOf_OF_fsetContext() *Of_OF_fsetContext { var p = new(Of_OF_fsetContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_of_OF_fset return p } +func InitEmptyOf_OF_fsetContext(p *Of_OF_fsetContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_of_OF_fset +} + func (*Of_OF_fsetContext) IsOf_OF_fsetContext() {} func NewOf_OF_fsetContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Of_OF_fsetContext { var p = new(Of_OF_fsetContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_of_OF_fset @@ -24686,39 +27655,33 @@ func (s *Of_OF_fsetContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Of_OF_fset() (localctx IOf_OF_fsetContext) { - this := p - _ = this - localctx = NewOf_OF_fsetContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 150, SQLiteParserRULE_of_OF_fset) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2054) + p.SetState(2055) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2055) + p.SetState(2056) p.Signed_number() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IDefault_DEFAULT__valueContext is an interface to support dynamic dispatch. @@ -24737,15 +27700,20 @@ type IDefault_DEFAULT__valueContext interface { } type Default_DEFAULT__valueContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyDefault_DEFAULT__valueContext() *Default_DEFAULT__valueContext { var p = new(Default_DEFAULT__valueContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_default_DEFAULT__value + return p +} + +func InitEmptyDefault_DEFAULT__valueContext(p *Default_DEFAULT__valueContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_default_DEFAULT__value - return p } func (*Default_DEFAULT__valueContext) IsDefault_DEFAULT__valueContext() {} @@ -24753,7 +27721,7 @@ func (*Default_DEFAULT__valueContext) IsDefault_DEFAULT__valueContext() {} func NewDefault_DEFAULT__valueContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Default_DEFAULT__valueContext { var p = new(Default_DEFAULT__valueContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_default_DEFAULT__value @@ -24804,39 +27772,33 @@ func (s *Default_DEFAULT__valueContext) ExitRule(listener antlr.ParseTreeListene } func (p *SQLiteParser) Default_DEFAULT__value() (localctx IDefault_DEFAULT__valueContext) { - this := p - _ = this - localctx = NewDefault_DEFAULT__valueContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 152, SQLiteParserRULE_default_DEFAULT__value) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2057) + p.SetState(2058) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2058) + p.SetState(2059) p.Signed_number() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IPartition_byContext is an interface to support dynamic dispatch. @@ -24857,23 +27819,28 @@ type IPartition_byContext interface { } type Partition_byContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyPartition_byContext() *Partition_byContext { var p = new(Partition_byContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_partition_by return p } +func InitEmptyPartition_byContext(p *Partition_byContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_partition_by +} + func (*Partition_byContext) IsPartition_byContext() {} func NewPartition_byContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Partition_byContext { var p = new(Partition_byContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_partition_by @@ -24953,60 +27920,65 @@ func (s *Partition_byContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Partition_by() (localctx IPartition_byContext) { - this := p - _ = this - localctx = NewPartition_byContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 154, SQLiteParserRULE_partition_by) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - var _alt int p.EnterOuterAlt(localctx, 1) { - p.SetState(2060) + p.SetState(2061) p.Match(SQLiteParserPARTITION_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2061) + p.SetState(2062) p.Match(SQLiteParserBY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(2063) + p.SetState(2064) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _alt = 1 for ok := true; ok; ok = _alt != 2 && _alt != antlr.ATNInvalidAltNumber { switch _alt { case 1: { - p.SetState(2062) + p.SetState(2063) p.expr(0) } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } - p.SetState(2065) + p.SetState(2066) p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 306, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 305, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IOrder_by_exprContext is an interface to support dynamic dispatch. @@ -25027,23 +27999,28 @@ type IOrder_by_exprContext interface { } type Order_by_exprContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyOrder_by_exprContext() *Order_by_exprContext { var p = new(Order_by_exprContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_order_by_expr return p } +func InitEmptyOrder_by_exprContext(p *Order_by_exprContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_order_by_expr +} + func (*Order_by_exprContext) IsOrder_by_exprContext() {} func NewOrder_by_exprContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Order_by_exprContext { var p = new(Order_by_exprContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_order_by_expr @@ -25123,54 +28100,59 @@ func (s *Order_by_exprContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Order_by_expr() (localctx IOrder_by_exprContext) { - this := p - _ = this - localctx = NewOrder_by_exprContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 156, SQLiteParserRULE_order_by_expr) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2067) + p.SetState(2068) p.Match(SQLiteParserORDER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2068) + p.SetState(2069) p.Match(SQLiteParserBY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(2070) + p.SetState(2071) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) - for ok := true; ok; ok = ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&-33552632) != 0) || ((int64((_la-64)) & ^0x3f) == 0 && ((int64(1)<<(_la-64))&-1) != 0) || ((int64((_la-128)) & ^0x3f) == 0 && ((int64(1)<<(_la-128))&-270215977642229761) != 0) { + for ok := true; ok; ok = ((int64((_la-3)) & ^0x3f) == 0 && ((int64(1)<<(_la-3))&-16776415) != 0) || ((int64((_la-67)) & ^0x3f) == 0 && ((int64(1)<<(_la-67))&-1) != 0) || ((int64((_la-131)) & ^0x3f) == 0 && ((int64(1)<<(_la-131))&9088264048033660927) != 0) { { - p.SetState(2069) + p.SetState(2070) p.expr(0) } - p.SetState(2072) + p.SetState(2073) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IOrder_by_expr_asc_descContext is an interface to support dynamic dispatch. @@ -25190,23 +28172,28 @@ type IOrder_by_expr_asc_descContext interface { } type Order_by_expr_asc_descContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyOrder_by_expr_asc_descContext() *Order_by_expr_asc_descContext { var p = new(Order_by_expr_asc_descContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_order_by_expr_asc_desc return p } +func InitEmptyOrder_by_expr_asc_descContext(p *Order_by_expr_asc_descContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_order_by_expr_asc_desc +} + func (*Order_by_expr_asc_descContext) IsOrder_by_expr_asc_descContext() {} func NewOrder_by_expr_asc_descContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Order_by_expr_asc_descContext { var p = new(Order_by_expr_asc_descContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_order_by_expr_asc_desc @@ -25261,43 +28248,41 @@ func (s *Order_by_expr_asc_descContext) ExitRule(listener antlr.ParseTreeListene } func (p *SQLiteParser) Order_by_expr_asc_desc() (localctx IOrder_by_expr_asc_descContext) { - this := p - _ = this - localctx = NewOrder_by_expr_asc_descContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 158, SQLiteParserRULE_order_by_expr_asc_desc) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2074) + p.SetState(2075) p.Match(SQLiteParserORDER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2075) + p.SetState(2076) p.Match(SQLiteParserBY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2076) + p.SetState(2077) p.Order_by_expr_asc_desc() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IExpr_asc_descContext is an interface to support dynamic dispatch. @@ -25320,23 +28305,28 @@ type IExpr_asc_descContext interface { } type Expr_asc_descContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyExpr_asc_descContext() *Expr_asc_descContext { var p = new(Expr_asc_descContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_expr_asc_desc return p } +func InitEmptyExpr_asc_descContext(p *Expr_asc_descContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_expr_asc_desc +} + func (*Expr_asc_descContext) IsExpr_asc_descContext() {} func NewExpr_asc_descContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Expr_asc_descContext { var p = new(Expr_asc_descContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_expr_asc_desc @@ -25457,76 +28447,83 @@ func (s *Expr_asc_descContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Expr_asc_desc() (localctx IExpr_asc_descContext) { - this := p - _ = this - localctx = NewExpr_asc_descContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 160, SQLiteParserRULE_expr_asc_desc) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2078) + p.SetState(2079) p.expr(0) } - p.SetState(2080) + p.SetState(2081) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserASC_ || _la == SQLiteParserDESC_ { { - p.SetState(2079) + p.SetState(2080) p.Asc_desc() } } - p.SetState(2089) + p.SetState(2090) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(2082) + p.SetState(2083) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2083) + p.SetState(2084) p.expr(0) } - p.SetState(2085) + p.SetState(2086) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserASC_ || _la == SQLiteParserDESC_ { { - p.SetState(2084) + p.SetState(2085) p.Asc_desc() } } - p.SetState(2091) + p.SetState(2092) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IInitial_selectContext is an interface to support dynamic dispatch. @@ -25544,23 +28541,28 @@ type IInitial_selectContext interface { } type Initial_selectContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyInitial_selectContext() *Initial_selectContext { var p = new(Initial_selectContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_initial_select return p } +func InitEmptyInitial_selectContext(p *Initial_selectContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_initial_select +} + func (*Initial_selectContext) IsInitial_selectContext() {} func NewInitial_selectContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Initial_selectContext { var p = new(Initial_selectContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_initial_select @@ -25607,35 +28609,25 @@ func (s *Initial_selectContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Initial_select() (localctx IInitial_selectContext) { - this := p - _ = this - localctx = NewInitial_selectContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 162, SQLiteParserRULE_initial_select) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2092) + p.SetState(2093) p.Select_stmt() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IRecursive__selectContext is an interface to support dynamic dispatch. @@ -25653,23 +28645,28 @@ type IRecursive__selectContext interface { } type Recursive__selectContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyRecursive__selectContext() *Recursive__selectContext { var p = new(Recursive__selectContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_recursive__select return p } +func InitEmptyRecursive__selectContext(p *Recursive__selectContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_recursive__select +} + func (*Recursive__selectContext) IsRecursive__selectContext() {} func NewRecursive__selectContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Recursive__selectContext { var p = new(Recursive__selectContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_recursive__select @@ -25716,35 +28713,25 @@ func (s *Recursive__selectContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Recursive__select() (localctx IRecursive__selectContext) { - this := p - _ = this - localctx = NewRecursive__selectContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 164, SQLiteParserRULE_recursive__select) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2094) + p.SetState(2095) p.Select_stmt() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IUnary_operatorContext is an interface to support dynamic dispatch. @@ -25765,23 +28752,28 @@ type IUnary_operatorContext interface { } type Unary_operatorContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyUnary_operatorContext() *Unary_operatorContext { var p = new(Unary_operatorContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_unary_operator return p } +func InitEmptyUnary_operatorContext(p *Unary_operatorContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_unary_operator +} + func (*Unary_operatorContext) IsUnary_operatorContext() {} func NewUnary_operatorContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Unary_operatorContext { var p = new(Unary_operatorContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_unary_operator @@ -25828,35 +28820,16 @@ func (s *Unary_operatorContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Unary_operator() (localctx IUnary_operatorContext) { - this := p - _ = this - localctx = NewUnary_operatorContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 166, SQLiteParserRULE_unary_operator) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2096) + p.SetState(2097) _la = p.GetTokenStream().LA(1) - if !(((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&1792) != 0) || _la == SQLiteParserNOT_) { + if !(((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&6400) != 0) || _la == SQLiteParserNOT_) { p.GetErrorHandler().RecoverInline(p) } else { p.GetErrorHandler().ReportMatch(p) @@ -25864,7 +28837,17 @@ func (p *SQLiteParser) Unary_operator() (localctx IUnary_operatorContext) { } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IError_messageContext is an interface to support dynamic dispatch. @@ -25882,23 +28865,28 @@ type IError_messageContext interface { } type Error_messageContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyError_messageContext() *Error_messageContext { var p = new(Error_messageContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_error_message return p } +func InitEmptyError_messageContext(p *Error_messageContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_error_message +} + func (*Error_messageContext) IsError_messageContext() {} func NewError_messageContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Error_messageContext { var p = new(Error_messageContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_error_message @@ -25933,35 +28921,29 @@ func (s *Error_messageContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Error_message() (localctx IError_messageContext) { - this := p - _ = this - localctx = NewError_messageContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 168, SQLiteParserRULE_error_message) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2098) + p.SetState(2099) p.Match(SQLiteParserSTRING_LITERAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IModule_argumentContext is an interface to support dynamic dispatch. @@ -25980,23 +28962,28 @@ type IModule_argumentContext interface { } type Module_argumentContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyModule_argumentContext() *Module_argumentContext { var p = new(Module_argumentContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_module_argument return p } +func InitEmptyModule_argumentContext(p *Module_argumentContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_module_argument +} + func (*Module_argumentContext) IsModule_argumentContext() {} func NewModule_argumentContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Module_argumentContext { var p = new(Module_argumentContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_module_argument @@ -26059,48 +29046,44 @@ func (s *Module_argumentContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Module_argument() (localctx IModule_argumentContext) { - this := p - _ = this - localctx = NewModule_argumentContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 170, SQLiteParserRULE_module_argument) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(2102) + p.SetState(2103) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 311, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 310, p.GetParserRuleContext()) { case 1: p.EnterOuterAlt(localctx, 1) { - p.SetState(2100) + p.SetState(2101) p.expr(0) } case 2: p.EnterOuterAlt(localctx, 2) { - p.SetState(2101) + p.SetState(2102) p.Column_def() } + case antlr.ATNInvalidAltNumber: + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IColumn_aliasContext is an interface to support dynamic dispatch. @@ -26119,23 +29102,28 @@ type IColumn_aliasContext interface { } type Column_aliasContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyColumn_aliasContext() *Column_aliasContext { var p = new(Column_aliasContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_column_alias return p } +func InitEmptyColumn_aliasContext(p *Column_aliasContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_column_alias +} + func (*Column_aliasContext) IsColumn_aliasContext() {} func NewColumn_aliasContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Column_aliasContext { var p = new(Column_aliasContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_column_alias @@ -26174,32 +29162,13 @@ func (s *Column_aliasContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Column_alias() (localctx IColumn_aliasContext) { - this := p - _ = this - localctx = NewColumn_aliasContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 172, SQLiteParserRULE_column_alias) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2104) + p.SetState(2105) _la = p.GetTokenStream().LA(1) if !(_la == SQLiteParserIDENTIFIER || _la == SQLiteParserSTRING_LITERAL) { @@ -26210,7 +29179,17 @@ func (p *SQLiteParser) Column_alias() (localctx IColumn_aliasContext) { } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IKeywordContext is an interface to support dynamic dispatch. @@ -26384,23 +29363,28 @@ type IKeywordContext interface { } type KeywordContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyKeywordContext() *KeywordContext { var p = new(KeywordContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_keyword return p } +func InitEmptyKeywordContext(p *KeywordContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_keyword +} + func (*KeywordContext) IsKeywordContext() {} func NewKeywordContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *KeywordContext { var p = new(KeywordContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_keyword @@ -27059,35 +30043,16 @@ func (s *KeywordContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Keyword() (localctx IKeywordContext) { - this := p - _ = this - localctx = NewKeywordContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 174, SQLiteParserRULE_keyword) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2106) + p.SetState(2107) _la = p.GetTokenStream().LA(1) - if !(((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&-33554432) != 0) || ((int64((_la-64)) & ^0x3f) == 0 && ((int64(1)<<(_la-64))&-1) != 0) || ((int64((_la-128)) & ^0x3f) == 0 && ((int64(1)<<(_la-128))&18014398509481983) != 0)) { + if !(((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&-134217728) != 0) || ((int64((_la-64)) & ^0x3f) == 0 && ((int64(1)<<(_la-64))&-1) != 0) || ((int64((_la-128)) & ^0x3f) == 0 && ((int64(1)<<(_la-128))&72057594037927935) != 0)) { p.GetErrorHandler().RecoverInline(p) } else { p.GetErrorHandler().ReportMatch(p) @@ -27095,7 +30060,17 @@ func (p *SQLiteParser) Keyword() (localctx IKeywordContext) { } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // INameContext is an interface to support dynamic dispatch. @@ -27113,23 +30088,28 @@ type INameContext interface { } type NameContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyNameContext() *NameContext { var p = new(NameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_name return p } +func InitEmptyNameContext(p *NameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_name +} + func (*NameContext) IsNameContext() {} func NewNameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *NameContext { var p = new(NameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_name @@ -27176,35 +30156,25 @@ func (s *NameContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Name() (localctx INameContext) { - this := p - _ = this - localctx = NewNameContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 176, SQLiteParserRULE_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2108) + p.SetState(2109) p.Any_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IFunction_nameContext is an interface to support dynamic dispatch. @@ -27222,23 +30192,28 @@ type IFunction_nameContext interface { } type Function_nameContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyFunction_nameContext() *Function_nameContext { var p = new(Function_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_function_name return p } +func InitEmptyFunction_nameContext(p *Function_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_function_name +} + func (*Function_nameContext) IsFunction_nameContext() {} func NewFunction_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Function_nameContext { var p = new(Function_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_function_name @@ -27285,35 +30260,25 @@ func (s *Function_nameContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Function_name() (localctx IFunction_nameContext) { - this := p - _ = this - localctx = NewFunction_nameContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 178, SQLiteParserRULE_function_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2110) + p.SetState(2111) p.Any_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IQualified_function_nameContext is an interface to support dynamic dispatch. @@ -27333,23 +30298,28 @@ type IQualified_function_nameContext interface { } type Qualified_function_nameContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyQualified_function_nameContext() *Qualified_function_nameContext { var p = new(Qualified_function_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_qualified_function_name return p } +func InitEmptyQualified_function_nameContext(p *Qualified_function_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_qualified_function_name +} + func (*Qualified_function_nameContext) IsQualified_function_nameContext() {} func NewQualified_function_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Qualified_function_nameContext { var p = new(Qualified_function_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_qualified_function_name @@ -27416,49 +30386,45 @@ func (s *Qualified_function_nameContext) ExitRule(listener antlr.ParseTreeListen } func (p *SQLiteParser) Qualified_function_name() (localctx IQualified_function_nameContext) { - this := p - _ = this - localctx = NewQualified_function_nameContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 180, SQLiteParserRULE_qualified_function_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) - p.SetState(2115) + p.SetState(2116) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 312, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 311, p.GetParserRuleContext()) == 1 { { - p.SetState(2112) + p.SetState(2113) p.Schema_name() } { - p.SetState(2113) + p.SetState(2114) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(2117) + p.SetState(2118) p.Function_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ISchema_nameContext is an interface to support dynamic dispatch. @@ -27476,23 +30442,28 @@ type ISchema_nameContext interface { } type Schema_nameContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptySchema_nameContext() *Schema_nameContext { var p = new(Schema_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_schema_name return p } +func InitEmptySchema_nameContext(p *Schema_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_schema_name +} + func (*Schema_nameContext) IsSchema_nameContext() {} func NewSchema_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Schema_nameContext { var p = new(Schema_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_schema_name @@ -27539,35 +30510,25 @@ func (s *Schema_nameContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Schema_name() (localctx ISchema_nameContext) { - this := p - _ = this - localctx = NewSchema_nameContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 182, SQLiteParserRULE_schema_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2119) + p.SetState(2120) p.Any_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ITable_nameContext is an interface to support dynamic dispatch. @@ -27585,23 +30546,28 @@ type ITable_nameContext interface { } type Table_nameContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyTable_nameContext() *Table_nameContext { var p = new(Table_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_table_name return p } +func InitEmptyTable_nameContext(p *Table_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_table_name +} + func (*Table_nameContext) IsTable_nameContext() {} func NewTable_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Table_nameContext { var p = new(Table_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_table_name @@ -27648,35 +30614,25 @@ func (s *Table_nameContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Table_name() (localctx ITable_nameContext) { - this := p - _ = this - localctx = NewTable_nameContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 184, SQLiteParserRULE_table_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2121) + p.SetState(2122) p.Any_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ITable_or_index_nameContext is an interface to support dynamic dispatch. @@ -27694,23 +30650,28 @@ type ITable_or_index_nameContext interface { } type Table_or_index_nameContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyTable_or_index_nameContext() *Table_or_index_nameContext { var p = new(Table_or_index_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_table_or_index_name return p } +func InitEmptyTable_or_index_nameContext(p *Table_or_index_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_table_or_index_name +} + func (*Table_or_index_nameContext) IsTable_or_index_nameContext() {} func NewTable_or_index_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Table_or_index_nameContext { var p = new(Table_or_index_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_table_or_index_name @@ -27757,35 +30718,25 @@ func (s *Table_or_index_nameContext) ExitRule(listener antlr.ParseTreeListener) } func (p *SQLiteParser) Table_or_index_name() (localctx ITable_or_index_nameContext) { - this := p - _ = this - localctx = NewTable_or_index_nameContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 186, SQLiteParserRULE_table_or_index_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2123) + p.SetState(2124) p.Any_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // INew_table_nameContext is an interface to support dynamic dispatch. @@ -27803,23 +30754,28 @@ type INew_table_nameContext interface { } type New_table_nameContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyNew_table_nameContext() *New_table_nameContext { var p = new(New_table_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_new_table_name return p } +func InitEmptyNew_table_nameContext(p *New_table_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_new_table_name +} + func (*New_table_nameContext) IsNew_table_nameContext() {} func NewNew_table_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *New_table_nameContext { var p = new(New_table_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_new_table_name @@ -27866,35 +30822,25 @@ func (s *New_table_nameContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) New_table_name() (localctx INew_table_nameContext) { - this := p - _ = this - localctx = NewNew_table_nameContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 188, SQLiteParserRULE_new_table_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2125) + p.SetState(2126) p.Any_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IColumn_nameContext is an interface to support dynamic dispatch. @@ -27912,23 +30858,28 @@ type IColumn_nameContext interface { } type Column_nameContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyColumn_nameContext() *Column_nameContext { var p = new(Column_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_column_name return p } +func InitEmptyColumn_nameContext(p *Column_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_column_name +} + func (*Column_nameContext) IsColumn_nameContext() {} func NewColumn_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Column_nameContext { var p = new(Column_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_column_name @@ -27971,39 +30922,29 @@ func (s *Column_nameContext) EnterRule(listener antlr.ParseTreeListener) { func (s *Column_nameContext) ExitRule(listener antlr.ParseTreeListener) { if listenerT, ok := listener.(SQLiteParserListener); ok { listenerT.ExitColumn_name(s) - } -} - -func (p *SQLiteParser) Column_name() (localctx IColumn_nameContext) { - this := p - _ = this - - localctx = NewColumn_nameContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 190, SQLiteParserRULE_column_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() + } +} +func (p *SQLiteParser) Column_name() (localctx IColumn_nameContext) { + localctx = NewColumn_nameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 190, SQLiteParserRULE_column_name) p.EnterOuterAlt(localctx, 1) { - p.SetState(2127) + p.SetState(2128) p.Any_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ICollation_nameContext is an interface to support dynamic dispatch. @@ -28021,23 +30962,28 @@ type ICollation_nameContext interface { } type Collation_nameContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyCollation_nameContext() *Collation_nameContext { var p = new(Collation_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_collation_name return p } +func InitEmptyCollation_nameContext(p *Collation_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_collation_name +} + func (*Collation_nameContext) IsCollation_nameContext() {} func NewCollation_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Collation_nameContext { var p = new(Collation_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_collation_name @@ -28084,35 +31030,25 @@ func (s *Collation_nameContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Collation_name() (localctx ICollation_nameContext) { - this := p - _ = this - localctx = NewCollation_nameContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 192, SQLiteParserRULE_collation_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2129) + p.SetState(2130) p.Any_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IForeign_tableContext is an interface to support dynamic dispatch. @@ -28130,23 +31066,28 @@ type IForeign_tableContext interface { } type Foreign_tableContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyForeign_tableContext() *Foreign_tableContext { var p = new(Foreign_tableContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_foreign_table return p } +func InitEmptyForeign_tableContext(p *Foreign_tableContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_foreign_table +} + func (*Foreign_tableContext) IsForeign_tableContext() {} func NewForeign_tableContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Foreign_tableContext { var p = new(Foreign_tableContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_foreign_table @@ -28193,35 +31134,25 @@ func (s *Foreign_tableContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Foreign_table() (localctx IForeign_tableContext) { - this := p - _ = this - localctx = NewForeign_tableContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 194, SQLiteParserRULE_foreign_table) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2131) + p.SetState(2132) p.Any_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IIndex_nameContext is an interface to support dynamic dispatch. @@ -28239,23 +31170,28 @@ type IIndex_nameContext interface { } type Index_nameContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyIndex_nameContext() *Index_nameContext { var p = new(Index_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_index_name return p } +func InitEmptyIndex_nameContext(p *Index_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_index_name +} + func (*Index_nameContext) IsIndex_nameContext() {} func NewIndex_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Index_nameContext { var p = new(Index_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_index_name @@ -28302,35 +31238,25 @@ func (s *Index_nameContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Index_name() (localctx IIndex_nameContext) { - this := p - _ = this - localctx = NewIndex_nameContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 196, SQLiteParserRULE_index_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2133) + p.SetState(2134) p.Any_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ITrigger_nameContext is an interface to support dynamic dispatch. @@ -28348,23 +31274,28 @@ type ITrigger_nameContext interface { } type Trigger_nameContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyTrigger_nameContext() *Trigger_nameContext { var p = new(Trigger_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_trigger_name return p } +func InitEmptyTrigger_nameContext(p *Trigger_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_trigger_name +} + func (*Trigger_nameContext) IsTrigger_nameContext() {} func NewTrigger_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Trigger_nameContext { var p = new(Trigger_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_trigger_name @@ -28411,35 +31342,25 @@ func (s *Trigger_nameContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Trigger_name() (localctx ITrigger_nameContext) { - this := p - _ = this - localctx = NewTrigger_nameContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 198, SQLiteParserRULE_trigger_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2135) + p.SetState(2136) p.Any_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IView_nameContext is an interface to support dynamic dispatch. @@ -28457,23 +31378,28 @@ type IView_nameContext interface { } type View_nameContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyView_nameContext() *View_nameContext { var p = new(View_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_view_name return p } +func InitEmptyView_nameContext(p *View_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_view_name +} + func (*View_nameContext) IsView_nameContext() {} func NewView_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *View_nameContext { var p = new(View_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_view_name @@ -28520,35 +31446,25 @@ func (s *View_nameContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) View_name() (localctx IView_nameContext) { - this := p - _ = this - localctx = NewView_nameContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 200, SQLiteParserRULE_view_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2137) + p.SetState(2138) p.Any_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IModule_nameContext is an interface to support dynamic dispatch. @@ -28566,23 +31482,28 @@ type IModule_nameContext interface { } type Module_nameContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyModule_nameContext() *Module_nameContext { var p = new(Module_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_module_name return p } +func InitEmptyModule_nameContext(p *Module_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_module_name +} + func (*Module_nameContext) IsModule_nameContext() {} func NewModule_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Module_nameContext { var p = new(Module_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_module_name @@ -28629,35 +31550,25 @@ func (s *Module_nameContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Module_name() (localctx IModule_nameContext) { - this := p - _ = this - localctx = NewModule_nameContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 202, SQLiteParserRULE_module_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2139) + p.SetState(2140) p.Any_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IPragma_nameContext is an interface to support dynamic dispatch. @@ -28675,23 +31586,28 @@ type IPragma_nameContext interface { } type Pragma_nameContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyPragma_nameContext() *Pragma_nameContext { var p = new(Pragma_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_pragma_name return p } +func InitEmptyPragma_nameContext(p *Pragma_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_pragma_name +} + func (*Pragma_nameContext) IsPragma_nameContext() {} func NewPragma_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Pragma_nameContext { var p = new(Pragma_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_pragma_name @@ -28738,35 +31654,25 @@ func (s *Pragma_nameContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Pragma_name() (localctx IPragma_nameContext) { - this := p - _ = this - localctx = NewPragma_nameContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 204, SQLiteParserRULE_pragma_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2141) + p.SetState(2142) p.Any_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ISavepoint_nameContext is an interface to support dynamic dispatch. @@ -28784,23 +31690,28 @@ type ISavepoint_nameContext interface { } type Savepoint_nameContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptySavepoint_nameContext() *Savepoint_nameContext { var p = new(Savepoint_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_savepoint_name return p } +func InitEmptySavepoint_nameContext(p *Savepoint_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_savepoint_name +} + func (*Savepoint_nameContext) IsSavepoint_nameContext() {} func NewSavepoint_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Savepoint_nameContext { var p = new(Savepoint_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_savepoint_name @@ -28847,35 +31758,25 @@ func (s *Savepoint_nameContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Savepoint_name() (localctx ISavepoint_nameContext) { - this := p - _ = this - localctx = NewSavepoint_nameContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 206, SQLiteParserRULE_savepoint_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2143) + p.SetState(2144) p.Any_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ITable_aliasContext is an interface to support dynamic dispatch. @@ -28894,23 +31795,28 @@ type ITable_aliasContext interface { } type Table_aliasContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyTable_aliasContext() *Table_aliasContext { var p = new(Table_aliasContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_table_alias return p } +func InitEmptyTable_aliasContext(p *Table_aliasContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_table_alias +} + func (*Table_aliasContext) IsTable_aliasContext() {} func NewTable_aliasContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Table_aliasContext { var p = new(Table_aliasContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_table_alias @@ -28949,32 +31855,13 @@ func (s *Table_aliasContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Table_alias() (localctx ITable_aliasContext) { - this := p - _ = this - localctx = NewTable_aliasContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 208, SQLiteParserRULE_table_alias) var _la int - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2145) + p.SetState(2146) _la = p.GetTokenStream().LA(1) if !(_la == SQLiteParserIDENTIFIER || _la == SQLiteParserSTRING_LITERAL) { @@ -28985,7 +31872,17 @@ func (p *SQLiteParser) Table_alias() (localctx ITable_aliasContext) { } } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ITable_alias_fallbackContext is an interface to support dynamic dispatch. @@ -29003,23 +31900,28 @@ type ITable_alias_fallbackContext interface { } type Table_alias_fallbackContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyTable_alias_fallbackContext() *Table_alias_fallbackContext { var p = new(Table_alias_fallbackContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_table_alias_fallback return p } +func InitEmptyTable_alias_fallbackContext(p *Table_alias_fallbackContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_table_alias_fallback +} + func (*Table_alias_fallbackContext) IsTable_alias_fallbackContext() {} func NewTable_alias_fallbackContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Table_alias_fallbackContext { var p = new(Table_alias_fallbackContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_table_alias_fallback @@ -29066,35 +31968,25 @@ func (s *Table_alias_fallbackContext) ExitRule(listener antlr.ParseTreeListener) } func (p *SQLiteParser) Table_alias_fallback() (localctx ITable_alias_fallbackContext) { - this := p - _ = this - localctx = NewTable_alias_fallbackContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 210, SQLiteParserRULE_table_alias_fallback) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2147) + p.SetState(2148) p.Any_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ITransaction_nameContext is an interface to support dynamic dispatch. @@ -29112,23 +32004,28 @@ type ITransaction_nameContext interface { } type Transaction_nameContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyTransaction_nameContext() *Transaction_nameContext { var p = new(Transaction_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_transaction_name return p } +func InitEmptyTransaction_nameContext(p *Transaction_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_transaction_name +} + func (*Transaction_nameContext) IsTransaction_nameContext() {} func NewTransaction_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Transaction_nameContext { var p = new(Transaction_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_transaction_name @@ -29175,35 +32072,25 @@ func (s *Transaction_nameContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Transaction_name() (localctx ITransaction_nameContext) { - this := p - _ = this - localctx = NewTransaction_nameContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 212, SQLiteParserRULE_transaction_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2149) + p.SetState(2150) p.Any_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IWindow_nameContext is an interface to support dynamic dispatch. @@ -29221,23 +32108,28 @@ type IWindow_nameContext interface { } type Window_nameContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyWindow_nameContext() *Window_nameContext { var p = new(Window_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_window_name return p } +func InitEmptyWindow_nameContext(p *Window_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_window_name +} + func (*Window_nameContext) IsWindow_nameContext() {} func NewWindow_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Window_nameContext { var p = new(Window_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_window_name @@ -29284,35 +32176,25 @@ func (s *Window_nameContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Window_name() (localctx IWindow_nameContext) { - this := p - _ = this - localctx = NewWindow_nameContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 214, SQLiteParserRULE_window_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2151) + p.SetState(2152) p.Any_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IAliasContext is an interface to support dynamic dispatch. @@ -29330,23 +32212,28 @@ type IAliasContext interface { } type AliasContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyAliasContext() *AliasContext { var p = new(AliasContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_alias return p } +func InitEmptyAliasContext(p *AliasContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_alias +} + func (*AliasContext) IsAliasContext() {} func NewAliasContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AliasContext { var p = new(AliasContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_alias @@ -29393,35 +32280,25 @@ func (s *AliasContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Alias() (localctx IAliasContext) { - this := p - _ = this - localctx = NewAliasContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 216, SQLiteParserRULE_alias) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2153) + p.SetState(2154) p.Any_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IFilenameContext is an interface to support dynamic dispatch. @@ -29439,23 +32316,28 @@ type IFilenameContext interface { } type FilenameContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyFilenameContext() *FilenameContext { var p = new(FilenameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_filename return p } +func InitEmptyFilenameContext(p *FilenameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_filename +} + func (*FilenameContext) IsFilenameContext() {} func NewFilenameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *FilenameContext { var p = new(FilenameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_filename @@ -29502,35 +32384,25 @@ func (s *FilenameContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Filename() (localctx IFilenameContext) { - this := p - _ = this - localctx = NewFilenameContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 218, SQLiteParserRULE_filename) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2155) + p.SetState(2156) p.Any_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IBase_window_nameContext is an interface to support dynamic dispatch. @@ -29548,23 +32420,28 @@ type IBase_window_nameContext interface { } type Base_window_nameContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyBase_window_nameContext() *Base_window_nameContext { var p = new(Base_window_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_base_window_name return p } +func InitEmptyBase_window_nameContext(p *Base_window_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_base_window_name +} + func (*Base_window_nameContext) IsBase_window_nameContext() {} func NewBase_window_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Base_window_nameContext { var p = new(Base_window_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_base_window_name @@ -29611,35 +32488,25 @@ func (s *Base_window_nameContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Base_window_name() (localctx IBase_window_nameContext) { - this := p - _ = this - localctx = NewBase_window_nameContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 220, SQLiteParserRULE_base_window_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2157) + p.SetState(2158) p.Any_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ISimple_funcContext is an interface to support dynamic dispatch. @@ -29657,23 +32524,28 @@ type ISimple_funcContext interface { } type Simple_funcContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptySimple_funcContext() *Simple_funcContext { var p = new(Simple_funcContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_simple_func return p } +func InitEmptySimple_funcContext(p *Simple_funcContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_simple_func +} + func (*Simple_funcContext) IsSimple_funcContext() {} func NewSimple_funcContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Simple_funcContext { var p = new(Simple_funcContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_simple_func @@ -29720,35 +32592,25 @@ func (s *Simple_funcContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Simple_func() (localctx ISimple_funcContext) { - this := p - _ = this - localctx = NewSimple_funcContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 222, SQLiteParserRULE_simple_func) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2159) + p.SetState(2160) p.Any_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IAggregate_funcContext is an interface to support dynamic dispatch. @@ -29766,23 +32628,28 @@ type IAggregate_funcContext interface { } type Aggregate_funcContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyAggregate_funcContext() *Aggregate_funcContext { var p = new(Aggregate_funcContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_aggregate_func return p } +func InitEmptyAggregate_funcContext(p *Aggregate_funcContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_aggregate_func +} + func (*Aggregate_funcContext) IsAggregate_funcContext() {} func NewAggregate_funcContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Aggregate_funcContext { var p = new(Aggregate_funcContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_aggregate_func @@ -29829,35 +32696,25 @@ func (s *Aggregate_funcContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Aggregate_func() (localctx IAggregate_funcContext) { - this := p - _ = this - localctx = NewAggregate_funcContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 224, SQLiteParserRULE_aggregate_func) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2161) + p.SetState(2162) p.Any_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // ITable_function_nameContext is an interface to support dynamic dispatch. @@ -29875,23 +32732,28 @@ type ITable_function_nameContext interface { } type Table_function_nameContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyTable_function_nameContext() *Table_function_nameContext { var p = new(Table_function_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_table_function_name return p } +func InitEmptyTable_function_nameContext(p *Table_function_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_table_function_name +} + func (*Table_function_nameContext) IsTable_function_nameContext() {} func NewTable_function_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Table_function_nameContext { var p = new(Table_function_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_table_function_name @@ -29938,35 +32800,25 @@ func (s *Table_function_nameContext) ExitRule(listener antlr.ParseTreeListener) } func (p *SQLiteParser) Table_function_name() (localctx ITable_function_nameContext) { - this := p - _ = this - localctx = NewTable_function_nameContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 226, SQLiteParserRULE_table_function_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2163) + p.SetState(2164) p.Any_name() } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } // IAny_nameContext is an interface to support dynamic dispatch. @@ -29989,23 +32841,28 @@ type IAny_nameContext interface { } type Any_nameContext struct { - *antlr.BaseParserRuleContext + antlr.BaseParserRuleContext parser antlr.Parser } func NewEmptyAny_nameContext() *Any_nameContext { var p = new(Any_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) p.RuleIndex = SQLiteParserRULE_any_name return p } +func InitEmptyAny_nameContext(p *Any_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = SQLiteParserRULE_any_name +} + func (*Any_nameContext) IsAny_nameContext() {} func NewAny_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Any_nameContext { var p = new(Any_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser p.RuleIndex = SQLiteParserRULE_any_name @@ -30084,73 +32941,83 @@ func (s *Any_nameContext) ExitRule(listener antlr.ParseTreeListener) { } func (p *SQLiteParser) Any_name() (localctx IAny_nameContext) { - this := p - _ = this - localctx = NewAny_nameContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 228, SQLiteParserRULE_any_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(2172) + p.SetState(2173) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserIDENTIFIER: p.EnterOuterAlt(localctx, 1) { - p.SetState(2165) + p.SetState(2166) p.Match(SQLiteParserIDENTIFIER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserABORT_, SQLiteParserACTION_, SQLiteParserADD_, SQLiteParserAFTER_, SQLiteParserALL_, SQLiteParserALTER_, SQLiteParserANALYZE_, SQLiteParserAND_, SQLiteParserAS_, SQLiteParserASC_, SQLiteParserATTACH_, SQLiteParserAUTOINCREMENT_, SQLiteParserBEFORE_, SQLiteParserBEGIN_, SQLiteParserBETWEEN_, SQLiteParserBY_, SQLiteParserCASCADE_, SQLiteParserCASE_, SQLiteParserCAST_, SQLiteParserCHECK_, SQLiteParserCOLLATE_, SQLiteParserCOLUMN_, SQLiteParserCOMMIT_, SQLiteParserCONFLICT_, SQLiteParserCONSTRAINT_, SQLiteParserCREATE_, SQLiteParserCROSS_, SQLiteParserCURRENT_DATE_, SQLiteParserCURRENT_TIME_, SQLiteParserCURRENT_TIMESTAMP_, SQLiteParserDATABASE_, SQLiteParserDEFAULT_, SQLiteParserDEFERRABLE_, SQLiteParserDEFERRED_, SQLiteParserDELETE_, SQLiteParserDESC_, SQLiteParserDETACH_, SQLiteParserDISTINCT_, SQLiteParserDROP_, SQLiteParserEACH_, SQLiteParserELSE_, SQLiteParserEND_, SQLiteParserESCAPE_, SQLiteParserEXCEPT_, SQLiteParserEXCLUSIVE_, SQLiteParserEXISTS_, SQLiteParserEXPLAIN_, SQLiteParserFAIL_, SQLiteParserFOR_, SQLiteParserFOREIGN_, SQLiteParserFROM_, SQLiteParserFULL_, SQLiteParserGLOB_, SQLiteParserGROUP_, SQLiteParserHAVING_, SQLiteParserIF_, SQLiteParserIGNORE_, SQLiteParserIMMEDIATE_, SQLiteParserIN_, SQLiteParserINDEX_, SQLiteParserINDEXED_, SQLiteParserINITIALLY_, SQLiteParserINNER_, SQLiteParserINSERT_, SQLiteParserINSTEAD_, SQLiteParserINTERSECT_, SQLiteParserINTO_, SQLiteParserIS_, SQLiteParserISNULL_, SQLiteParserJOIN_, SQLiteParserKEY_, SQLiteParserLEFT_, SQLiteParserLIKE_, SQLiteParserLIMIT_, SQLiteParserMATCH_, SQLiteParserNATURAL_, SQLiteParserNO_, SQLiteParserNOT_, SQLiteParserNOTNULL_, SQLiteParserNULL_, SQLiteParserOF_, SQLiteParserOFFSET_, SQLiteParserON_, SQLiteParserOR_, SQLiteParserORDER_, SQLiteParserOUTER_, SQLiteParserPLAN_, SQLiteParserPRAGMA_, SQLiteParserPRIMARY_, SQLiteParserQUERY_, SQLiteParserRAISE_, SQLiteParserRECURSIVE_, SQLiteParserREFERENCES_, SQLiteParserREGEXP_, SQLiteParserREINDEX_, SQLiteParserRELEASE_, SQLiteParserRENAME_, SQLiteParserREPLACE_, SQLiteParserRESTRICT_, SQLiteParserRETURNING_, SQLiteParserRIGHT_, SQLiteParserROLLBACK_, SQLiteParserROW_, SQLiteParserROWS_, SQLiteParserSAVEPOINT_, SQLiteParserSELECT_, SQLiteParserSET_, SQLiteParserSTRICT_, SQLiteParserTABLE_, SQLiteParserTEMP_, SQLiteParserTEMPORARY_, SQLiteParserTHEN_, SQLiteParserTO_, SQLiteParserTRANSACTION_, SQLiteParserTRIGGER_, SQLiteParserUNION_, SQLiteParserUNIQUE_, SQLiteParserUPDATE_, SQLiteParserUSING_, SQLiteParserVACUUM_, SQLiteParserVALUES_, SQLiteParserVIEW_, SQLiteParserVIRTUAL_, SQLiteParserWHEN_, SQLiteParserWHERE_, SQLiteParserWITH_, SQLiteParserWITHOUT_, SQLiteParserFIRST_VALUE_, SQLiteParserOVER_, SQLiteParserPARTITION_, SQLiteParserRANGE_, SQLiteParserPRECEDING_, SQLiteParserUNBOUNDED_, SQLiteParserCURRENT_, SQLiteParserFOLLOWING_, SQLiteParserCUME_DIST_, SQLiteParserDENSE_RANK_, SQLiteParserLAG_, SQLiteParserLAST_VALUE_, SQLiteParserLEAD_, SQLiteParserNTH_VALUE_, SQLiteParserNTILE_, SQLiteParserPERCENT_RANK_, SQLiteParserRANK_, SQLiteParserROW_NUMBER_, SQLiteParserGENERATED_, SQLiteParserALWAYS_, SQLiteParserSTORED_, SQLiteParserTRUE_, SQLiteParserFALSE_, SQLiteParserWINDOW_, SQLiteParserNULLS_, SQLiteParserFIRST_, SQLiteParserLAST_, SQLiteParserFILTER_, SQLiteParserGROUPS_, SQLiteParserEXCLUDE_: p.EnterOuterAlt(localctx, 2) { - p.SetState(2166) + p.SetState(2167) p.Keyword() } case SQLiteParserSTRING_LITERAL: p.EnterOuterAlt(localctx, 3) { - p.SetState(2167) + p.SetState(2168) p.Match(SQLiteParserSTRING_LITERAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserOPEN_PAR: p.EnterOuterAlt(localctx, 4) { - p.SetState(2168) + p.SetState(2169) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2169) + p.SetState(2170) p.Any_name() } { - p.SetState(2170) + p.SetState(2171) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() return localctx + goto errorExit // Trick to prevent compiler error if the label is not used } func (p *SQLiteParser) Sempred(localctx antlr.RuleContext, ruleIndex, predIndex int) bool { @@ -30168,47 +33035,47 @@ func (p *SQLiteParser) Sempred(localctx antlr.RuleContext, ruleIndex, predIndex } func (p *SQLiteParser) Expr_Sempred(localctx antlr.RuleContext, predIndex int) bool { - this := p - _ = this - switch predIndex { case 0: - return p.Precpred(p.GetParserRuleContext(), 19) + return p.Precpred(p.GetParserRuleContext(), 20) case 1: - return p.Precpred(p.GetParserRuleContext(), 18) + return p.Precpred(p.GetParserRuleContext(), 19) case 2: - return p.Precpred(p.GetParserRuleContext(), 17) + return p.Precpred(p.GetParserRuleContext(), 18) case 3: - return p.Precpred(p.GetParserRuleContext(), 16) + return p.Precpred(p.GetParserRuleContext(), 17) case 4: - return p.Precpred(p.GetParserRuleContext(), 15) + return p.Precpred(p.GetParserRuleContext(), 16) case 5: - return p.Precpred(p.GetParserRuleContext(), 14) + return p.Precpred(p.GetParserRuleContext(), 15) case 6: - return p.Precpred(p.GetParserRuleContext(), 12) + return p.Precpred(p.GetParserRuleContext(), 14) case 7: - return p.Precpred(p.GetParserRuleContext(), 11) + return p.Precpred(p.GetParserRuleContext(), 12) case 8: - return p.Precpred(p.GetParserRuleContext(), 4) + return p.Precpred(p.GetParserRuleContext(), 11) case 9: - return p.Precpred(p.GetParserRuleContext(), 13) + return p.Precpred(p.GetParserRuleContext(), 4) case 10: - return p.Precpred(p.GetParserRuleContext(), 7) + return p.Precpred(p.GetParserRuleContext(), 13) case 11: - return p.Precpred(p.GetParserRuleContext(), 6) + return p.Precpred(p.GetParserRuleContext(), 7) case 12: + return p.Precpred(p.GetParserRuleContext(), 6) + + case 13: return p.Precpred(p.GetParserRuleContext(), 5) default: diff --git a/internal/engine/sqlite/parser/sqliteparser_base_listener.go b/internal/engine/sqlite/parser/sqliteparser_base_listener.go index 27a6bf8578..1480f105f7 100644 --- a/internal/engine/sqlite/parser/sqliteparser_base_listener.go +++ b/internal/engine/sqlite/parser/sqliteparser_base_listener.go @@ -1,8 +1,8 @@ -// Code generated from SQLiteParser.g4 by ANTLR 4.12.0. DO NOT EDIT. +// Code generated from SQLiteParser.g4 by ANTLR 4.13.1. DO NOT EDIT. package parser // SQLiteParser -import "github.com/antlr/antlr4/runtime/Go/antlr/v4" +import "github.com/antlr4-go/antlr/v4" // BaseSQLiteParserListener is a complete listener for a parse tree produced by SQLiteParser. type BaseSQLiteParserListener struct{} @@ -252,6 +252,12 @@ func (s *BaseSQLiteParserListener) EnterExpr_comparison(ctx *Expr_comparisonCont // ExitExpr_comparison is called when production expr_comparison is exited. func (s *BaseSQLiteParserListener) ExitExpr_comparison(ctx *Expr_comparisonContext) {} +// EnterExpr_bool is called when production expr_bool is entered. +func (s *BaseSQLiteParserListener) EnterExpr_bool(ctx *Expr_boolContext) {} + +// ExitExpr_bool is called when production expr_bool is exited. +func (s *BaseSQLiteParserListener) ExitExpr_bool(ctx *Expr_boolContext) {} + // EnterExpr_binary is called when production expr_binary is entered. func (s *BaseSQLiteParserListener) EnterExpr_binary(ctx *Expr_binaryContext) {} @@ -302,12 +308,6 @@ func (s *BaseSQLiteParserListener) EnterExpr_qualified_column_name(ctx *Expr_qua func (s *BaseSQLiteParserListener) ExitExpr_qualified_column_name(ctx *Expr_qualified_column_nameContext) { } -// EnterExpr_math_op is called when production expr_math_op is entered. -func (s *BaseSQLiteParserListener) EnterExpr_math_op(ctx *Expr_math_opContext) {} - -// ExitExpr_math_op is called when production expr_math_op is exited. -func (s *BaseSQLiteParserListener) ExitExpr_math_op(ctx *Expr_math_opContext) {} - // EnterExpr_unary is called when production expr_unary is entered. func (s *BaseSQLiteParserListener) EnterExpr_unary(ctx *Expr_unaryContext) {} diff --git a/internal/engine/sqlite/parser/sqliteparser_listener.go b/internal/engine/sqlite/parser/sqliteparser_listener.go index f121faf872..4dfcb9632f 100644 --- a/internal/engine/sqlite/parser/sqliteparser_listener.go +++ b/internal/engine/sqlite/parser/sqliteparser_listener.go @@ -1,8 +1,8 @@ -// Code generated from SQLiteParser.g4 by ANTLR 4.12.0. DO NOT EDIT. +// Code generated from SQLiteParser.g4 by ANTLR 4.13.1. DO NOT EDIT. package parser // SQLiteParser -import "github.com/antlr/antlr4/runtime/Go/antlr/v4" +import "github.com/antlr4-go/antlr/v4" // SQLiteParserListener is a complete listener for a parse tree produced by SQLiteParser. type SQLiteParserListener interface { @@ -122,6 +122,9 @@ type SQLiteParserListener interface { // EnterExpr_comparison is called when entering the expr_comparison production. EnterExpr_comparison(c *Expr_comparisonContext) + // EnterExpr_bool is called when entering the expr_bool production. + EnterExpr_bool(c *Expr_boolContext) + // EnterExpr_binary is called when entering the expr_binary production. EnterExpr_binary(c *Expr_binaryContext) @@ -146,9 +149,6 @@ type SQLiteParserListener interface { // EnterExpr_qualified_column_name is called when entering the expr_qualified_column_name production. EnterExpr_qualified_column_name(c *Expr_qualified_column_nameContext) - // EnterExpr_math_op is called when entering the expr_math_op production. - EnterExpr_math_op(c *Expr_math_opContext) - // EnterExpr_unary is called when entering the expr_unary production. EnterExpr_unary(c *Expr_unaryContext) @@ -512,6 +512,9 @@ type SQLiteParserListener interface { // ExitExpr_comparison is called when exiting the expr_comparison production. ExitExpr_comparison(c *Expr_comparisonContext) + // ExitExpr_bool is called when exiting the expr_bool production. + ExitExpr_bool(c *Expr_boolContext) + // ExitExpr_binary is called when exiting the expr_binary production. ExitExpr_binary(c *Expr_binaryContext) @@ -536,9 +539,6 @@ type SQLiteParserListener interface { // ExitExpr_qualified_column_name is called when exiting the expr_qualified_column_name production. ExitExpr_qualified_column_name(c *Expr_qualified_column_nameContext) - // ExitExpr_math_op is called when exiting the expr_math_op production. - ExitExpr_math_op(c *Expr_math_opContext) - // ExitExpr_unary is called when exiting the expr_unary production. ExitExpr_unary(c *Expr_unaryContext) diff --git a/internal/engine/sqlite/utils.go b/internal/engine/sqlite/utils.go index f3b5ee289d..874d53ab41 100644 --- a/internal/engine/sqlite/utils.go +++ b/internal/engine/sqlite/utils.go @@ -12,7 +12,7 @@ type tableNamer interface { func parseTableName(c tableNamer) *ast.TableName { name := ast.TableName{ - Name: c.Table_name().GetText(), + Name: identifier(c.Table_name().GetText()), } if c.Schema_name() != nil { name.Schema = c.Schema_name().GetText() diff --git a/internal/ext/handler.go b/internal/ext/handler.go index adeacff695..2542dc1a82 100644 --- a/internal/ext/handler.go +++ b/internal/ext/handler.go @@ -2,22 +2,51 @@ package ext import ( "context" + "fmt" + + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "github.com/sqlc-dev/sqlc/internal/plugin" ) type Handler interface { - Generate(context.Context, *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) + Generate(context.Context, *plugin.GenerateRequest) (*plugin.GenerateResponse, error) + + Invoke(ctx context.Context, method string, args any, reply any, opts ...grpc.CallOption) error + NewStream(ctx context.Context, desc *grpc.StreamDesc, method string, opts ...grpc.CallOption) (grpc.ClientStream, error) } type wrapper struct { - fn func(context.Context, *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) + fn func(context.Context, *plugin.GenerateRequest) (*plugin.GenerateResponse, error) } -func (w *wrapper) Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) { +func (w *wrapper) Generate(ctx context.Context, req *plugin.GenerateRequest) (*plugin.GenerateResponse, error) { return w.fn(ctx, req) } -func HandleFunc(fn func(context.Context, *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error)) Handler { +func (w *wrapper) Invoke(ctx context.Context, method string, args any, reply any, opts ...grpc.CallOption) error { + req, ok := args.(*plugin.GenerateRequest) + if !ok { + return fmt.Errorf("args isn't a GenerateRequest") + } + resp, ok := reply.(*plugin.GenerateResponse) + if !ok { + return fmt.Errorf("reply isn't a GenerateResponse") + } + res, err := w.Generate(ctx, req) + if err != nil { + return err + } + resp.Files = res.Files + return nil +} + +func (w *wrapper) NewStream(ctx context.Context, desc *grpc.StreamDesc, method string, opts ...grpc.CallOption) (grpc.ClientStream, error) { + return nil, status.Error(codes.Unimplemented, "") +} + +func HandleFunc(fn func(context.Context, *plugin.GenerateRequest) (*plugin.GenerateResponse, error)) Handler { return &wrapper{fn} } diff --git a/internal/ext/process/gen.go b/internal/ext/process/gen.go index 7a48038444..b5720dbc33 100644 --- a/internal/ext/process/gen.go +++ b/internal/ext/process/gen.go @@ -8,35 +8,66 @@ import ( "os" "os/exec" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" - "github.com/sqlc-dev/sqlc/internal/plugin" + "github.com/sqlc-dev/sqlc/internal/info" ) type Runner struct { - Cmd string - Env []string + Cmd string + Format string + Env []string } -// TODO: Update the gen func signature to take a ctx -func (r Runner) Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) { - stdin, err := proto.Marshal(req) - if err != nil { - return nil, fmt.Errorf("failed to encode codegen request: %s", err) +func (r *Runner) Invoke(ctx context.Context, method string, args any, reply any, opts ...grpc.CallOption) error { + req, ok := args.(protoreflect.ProtoMessage) + if !ok { + return fmt.Errorf("args isn't a protoreflect.ProtoMessage") + } + + var stdin []byte + var err error + switch r.Format { + case "json": + m := &protojson.MarshalOptions{ + EmitUnpopulated: true, + Indent: "", + UseProtoNames: true, + } + stdin, err = m.Marshal(req) + + if err != nil { + return fmt.Errorf("failed to encode codegen request: %w", err) + } + case "", "protobuf": + stdin, err = proto.Marshal(req) + if err != nil { + return fmt.Errorf("failed to encode codegen request: %w", err) + } + default: + return fmt.Errorf("unknown plugin format: %s", r.Format) } // Check if the output plugin exists path, err := exec.LookPath(r.Cmd) if err != nil { - return nil, fmt.Errorf("process: %s not found", r.Cmd) + return fmt.Errorf("process: %s not found", r.Cmd) } - cmd := exec.CommandContext(ctx, path) + cmd := exec.CommandContext(ctx, path, method) cmd.Stdin = bytes.NewReader(stdin) cmd.Env = []string{ - fmt.Sprintf("SQLC_VERSION=%s", req.SqlcVersion), + fmt.Sprintf("SQLC_VERSION=%s", info.Version), } for _, key := range r.Env { + if key == "SQLC_AUTH_TOKEN" { + continue + } cmd.Env = append(cmd.Env, fmt.Sprintf("%s=%s", key, os.Getenv(key))) } @@ -47,13 +78,28 @@ func (r Runner) Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plug if errors.As(err, &exit) { stderr = string(exit.Stderr) } - return nil, fmt.Errorf("process: error running command %s", stderr) + return fmt.Errorf("process: error running command %s", stderr) } - var resp plugin.CodeGenResponse - if err := proto.Unmarshal(out, &resp); err != nil { - return nil, fmt.Errorf("process: failed to read codegen resp: %s", err) + resp, ok := reply.(protoreflect.ProtoMessage) + if !ok { + return fmt.Errorf("reply isn't a protoreflect.ProtoMessage") } - return &resp, nil + switch r.Format { + case "json": + if err := protojson.Unmarshal(out, resp); err != nil { + return fmt.Errorf("process: failed to read codegen resp: %w", err) + } + default: + if err := proto.Unmarshal(out, resp); err != nil { + return fmt.Errorf("process: failed to read codegen resp: %w", err) + } + } + + return nil +} + +func (r *Runner) NewStream(ctx context.Context, desc *grpc.StreamDesc, method string, opts ...grpc.CallOption) (grpc.ClientStream, error) { + return nil, status.Error(codes.Unimplemented, "") } diff --git a/internal/ext/wasm/nowasm.go b/internal/ext/wasm/nowasm.go deleted file mode 100644 index c28db6fc73..0000000000 --- a/internal/ext/wasm/nowasm.go +++ /dev/null @@ -1,14 +0,0 @@ -//go:build nowasm || !(cgo && ((linux && amd64) || (linux && arm64) || (darwin && amd64) || (darwin && arm64) || (windows && amd64))) - -package wasm - -import ( - "context" - "fmt" - - "github.com/sqlc-dev/sqlc/internal/plugin" -) - -func (r *Runner) Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) { - return nil, fmt.Errorf("sqlc built without wasmtime support") -} diff --git a/internal/ext/wasm/wasm.go b/internal/ext/wasm/wasm.go index 1e7f271621..58384a9c95 100644 --- a/internal/ext/wasm/wasm.go +++ b/internal/ext/wasm/wasm.go @@ -1,177 +1,133 @@ -//go:build !nowasm && cgo && ((linux && amd64) || (linux && arm64) || (darwin && amd64) || (darwin && arm64) || (windows && amd64)) - -// The above build constraint is based of the cgo directives in this file: -// https://github.com/bytecodealliance/wasmtime-go/blob/main/ffi.go package wasm import ( + "bytes" "context" "crypto/sha256" - _ "embed" "errors" "fmt" "io" + "log/slog" "net/http" "os" "path/filepath" "runtime" - "runtime/trace" "strings" - wasmtime "github.com/bytecodealliance/wasmtime-go/v13" + "github.com/tetratelabs/wazero" + "github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1" + "github.com/tetratelabs/wazero/sys" "golang.org/x/sync/singleflight" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "github.com/sqlc-dev/sqlc/internal/cache" "github.com/sqlc-dev/sqlc/internal/info" "github.com/sqlc-dev/sqlc/internal/plugin" ) -// This version must be updated whenever the wasmtime-go dependency is updated -const wasmtimeVersion = `v13.0.0` - -func cacheDir() (string, error) { - cache := os.Getenv("SQLCCACHE") - if cache != "" { - return cache, nil - } - cacheHome := os.Getenv("XDG_CACHE_HOME") - if cacheHome == "" { - home, err := os.UserHomeDir() - if err != nil { - return "", err - } - cacheHome = filepath.Join(home, ".cache") - } - return filepath.Join(cacheHome, "sqlc"), nil -} - var flight singleflight.Group -// Verify the provided sha256 is valid. -func (r *Runner) parseChecksum() (string, error) { - if r.SHA256 == "" { - return "", fmt.Errorf("missing SHA-256 checksum") - } - return r.SHA256, nil +type runtimeAndCode struct { + rt wazero.Runtime + code wazero.CompiledModule } -func (r *Runner) loadModule(ctx context.Context, engine *wasmtime.Engine) (*wasmtime.Module, error) { - expected, err := r.parseChecksum() - if err != nil { - return nil, err +// Verify the provided sha256 is valid. +func (r *Runner) getChecksum(ctx context.Context) (string, error) { + if r.SHA256 != "" { + return r.SHA256, nil } - value, err, _ := flight.Do(expected, func() (interface{}, error) { - return r.loadSerializedModule(ctx, engine) - }) + // TODO: Add a log line here about something + _, sum, err := r.fetch(ctx, r.URL) if err != nil { - return nil, err - } - data, ok := value.([]byte) - if !ok { - return nil, fmt.Errorf("returned value was not a byte slice") + return "", err } - return wasmtime.NewModuleDeserialize(engine, data) + slog.Warn("fetching WASM binary to calculate sha256. Set this value in sqlc.yaml to prevent unneeded work", "sha256", sum) + return sum, nil } -func (r *Runner) loadSerializedModule(ctx context.Context, engine *wasmtime.Engine) ([]byte, error) { - expected, err := r.parseChecksum() +func (r *Runner) loadAndCompile(ctx context.Context) (*runtimeAndCode, error) { + expected, err := r.getChecksum(ctx) if err != nil { return nil, err } - cacheRoot, err := cacheDir() + cacheDir, err := cache.PluginsDir() if err != nil { return nil, err } - cache := filepath.Join(cacheRoot, "plugins") - if err := os.MkdirAll(cache, 0755); err != nil && !os.IsExist(err) { - return nil, fmt.Errorf("failed to create cache directory: %w", err) - } - - pluginDir := filepath.Join(cache, expected) - modName := fmt.Sprintf("plugin_%s_%s_%s.module", runtime.GOOS, runtime.GOARCH, wasmtimeVersion) - modPath := filepath.Join(pluginDir, modName) - _, staterr := os.Stat(modPath) - if staterr == nil { - data, err := os.ReadFile(modPath) - if err != nil { - return nil, err - } - return data, nil - } - - wmod, err := r.loadWASM(ctx, cache, expected) + value, err, _ := flight.Do(expected, func() (interface{}, error) { + return r.loadAndCompileWASM(ctx, cacheDir, expected) + }) if err != nil { return nil, err } - - moduRegion := trace.StartRegion(ctx, "wasmtime.NewModule") - module, err := wasmtime.NewModule(engine, wmod) - moduRegion.End() - if err != nil { - return nil, fmt.Errorf("define wasi: %w", err) - } - - err = os.Mkdir(pluginDir, 0755) - if err != nil && !os.IsExist(err) { - return nil, fmt.Errorf("mkdirall: %w", err) - } - out, err := module.Serialize() - if err != nil { - return nil, fmt.Errorf("serialize: %w", err) - } - if err := os.WriteFile(modPath, out, 0444); err != nil { - return nil, fmt.Errorf("cache wasm: %w", err) + data, ok := value.(*runtimeAndCode) + if !ok { + return nil, fmt.Errorf("returned value was not a compiled module") } - - return out, nil + return data, nil } -func (r *Runner) loadWASM(ctx context.Context, cache string, expected string) ([]byte, error) { - pluginDir := filepath.Join(cache, expected) - pluginPath := filepath.Join(pluginDir, "plugin.wasm") - _, staterr := os.Stat(pluginPath) - +func (r *Runner) fetch(ctx context.Context, uri string) ([]byte, string, error) { var body io.ReadCloser + switch { - case staterr == nil: - file, err := os.Open(pluginPath) - if err != nil { - return nil, fmt.Errorf("os.Open: %s %w", pluginPath, err) - } - body = file - case strings.HasPrefix(r.URL, "file://"): - file, err := os.Open(strings.TrimPrefix(r.URL, "file://")) + case strings.HasPrefix(uri, "file://"): + file, err := os.Open(strings.TrimPrefix(uri, "file://")) if err != nil { - return nil, fmt.Errorf("os.Open: %s %w", r.URL, err) + return nil, "", fmt.Errorf("os.Open: %s %w", uri, err) } body = file - case strings.HasPrefix(r.URL, "https://"): - req, err := http.NewRequestWithContext(ctx, "GET", r.URL, nil) + case strings.HasPrefix(uri, "https://"): + req, err := http.NewRequestWithContext(ctx, "GET", uri, nil) if err != nil { - return nil, fmt.Errorf("http.Get: %s %w", r.URL, err) + return nil, "", fmt.Errorf("http.Get: %s %w", uri, err) } req.Header.Set("User-Agent", fmt.Sprintf("sqlc/%s Go/%s (%s %s)", info.Version, runtime.Version(), runtime.GOOS, runtime.GOARCH)) resp, err := http.DefaultClient.Do(req) if err != nil { - return nil, fmt.Errorf("http.Get: %s %w", r.URL, err) + return nil, "", fmt.Errorf("http.Get: %s %w", r.URL, err) } body = resp.Body default: - return nil, fmt.Errorf("unknown scheme: %s", r.URL) + return nil, "", fmt.Errorf("unknown scheme: %s", r.URL) } defer body.Close() wmod, err := io.ReadAll(body) if err != nil { - return nil, fmt.Errorf("readall: %w", err) + return nil, "", fmt.Errorf("readall: %w", err) } sum := sha256.Sum256(wmod) actual := fmt.Sprintf("%x", sum) + return wmod, actual, nil +} + +func (r *Runner) loadAndCompileWASM(ctx context.Context, cache string, expected string) (*runtimeAndCode, error) { + pluginDir := filepath.Join(cache, expected) + pluginPath := filepath.Join(pluginDir, "plugin.wasm") + _, staterr := os.Stat(pluginPath) + + uri := r.URL + if staterr == nil { + uri = "file://" + pluginPath + } + + wmod, actual, err := r.fetch(ctx, uri) + if err != nil { + return nil, err + } + if expected != actual { return nil, fmt.Errorf("invalid checksum: expected %s, got %s", expected, actual) } @@ -186,14 +142,33 @@ func (r *Runner) loadWASM(ctx context.Context, cache string, expected string) ([ } } - return wmod, nil + wazeroCache, err := wazero.NewCompilationCacheWithDir(filepath.Join(cache, "wazero")) + if err != nil { + return nil, fmt.Errorf("wazero.NewCompilationCacheWithDir: %w", err) + } + + config := wazero.NewRuntimeConfig().WithCompilationCache(wazeroCache) + rt := wazero.NewRuntimeWithConfig(ctx, config) + + if _, err := wasi_snapshot_preview1.Instantiate(ctx, rt); err != nil { + return nil, fmt.Errorf("wasi_snapshot_preview1 instantiate: %w", err) + } + + // Compile the Wasm binary once so that we can skip the entire compilation + // time during instantiation. + code, err := rt.CompileModule(ctx, wmod) + if err != nil { + return nil, fmt.Errorf("compile module: %w", err) + } + + return &runtimeAndCode{rt: rt, code: code}, nil } // removePGCatalog removes the pg_catalog schema from the request. There is a // mysterious (reason unknown) bug with wasm plugins when a large amount of // tables (like there are in the catalog) are sent. // @see https://github.com/sqlc-dev/sqlc/pull/1748 -func removePGCatalog(req *plugin.CodeGenRequest) { +func removePGCatalog(req *plugin.GenerateRequest) { if req.Catalog == nil || req.Catalog.Schemas == nil { return } @@ -210,105 +185,84 @@ func removePGCatalog(req *plugin.CodeGenRequest) { req.Catalog.Schemas = filtered } -func (r *Runner) Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) { - // Remove the pg_catalog schema. Its sheer size causes unknown issues with wasm plugins - removePGCatalog(req) - - stdinBlob, err := req.MarshalVT() - if err != nil { - return nil, err - } - - engine := wasmtime.NewEngine() - module, err := r.loadModule(ctx, engine) - if err != nil { - return nil, fmt.Errorf("loadModule: %w", err) +func (r *Runner) Invoke(ctx context.Context, method string, args any, reply any, opts ...grpc.CallOption) error { + req, ok := args.(protoreflect.ProtoMessage) + if !ok { + return status.Error(codes.InvalidArgument, "args isn't a protoreflect.ProtoMessage") } - linker := wasmtime.NewLinker(engine) - if err := linker.DefineWasi(); err != nil { - return nil, err + // Remove the pg_catalog schema. Its sheer size causes unknown issues with wasm plugins + genReq, ok := req.(*plugin.GenerateRequest) + if ok { + removePGCatalog(genReq) + req = genReq } - dir, err := os.MkdirTemp(os.Getenv("SQLCTMPDIR"), "out") + stdinBlob, err := proto.Marshal(req) if err != nil { - return nil, fmt.Errorf("temp dir: %w", err) + return fmt.Errorf("failed to encode codegen request: %w", err) } - defer os.RemoveAll(dir) - stdinPath := filepath.Join(dir, "stdin") - stderrPath := filepath.Join(dir, "stderr") - stdoutPath := filepath.Join(dir, "stdout") - - if err := os.WriteFile(stdinPath, stdinBlob, 0755); err != nil { - return nil, fmt.Errorf("write file: %w", err) + runtimeAndCode, err := r.loadAndCompile(ctx) + if err != nil { + return fmt.Errorf("loadBytes: %w", err) } - // Configure WASI imports to write stdout into a file. - wasiConfig := wasmtime.NewWasiConfig() - wasiConfig.SetStdinFile(stdinPath) - wasiConfig.SetStdoutFile(stdoutPath) - wasiConfig.SetStderrFile(stderrPath) + var stderr, stdout bytes.Buffer - keys := []string{"SQLC_VERSION"} - vals := []string{req.SqlcVersion} + conf := wazero.NewModuleConfig(). + WithName(""). + WithArgs("plugin.wasm", method). + WithStdin(bytes.NewReader(stdinBlob)). + WithStdout(&stdout). + WithStderr(&stderr). + WithEnv("SQLC_VERSION", info.Version) for _, key := range r.Env { - keys = append(keys, key) - vals = append(vals, os.Getenv(key)) + conf = conf.WithEnv(key, os.Getenv(key)) } - wasiConfig.SetEnv(keys, vals) - - store := wasmtime.NewStore(engine) - store.SetWasi(wasiConfig) - linkRegion := trace.StartRegion(ctx, "linker.DefineModule") - err = linker.DefineModule(store, "", module) - linkRegion.End() - if err != nil { - return nil, fmt.Errorf("define wasi: %w", err) + result, err := runtimeAndCode.rt.InstantiateModule(ctx, runtimeAndCode.code, conf) + if err == nil { + defer result.Close(ctx) } - - // Run the function - fn, err := linker.GetDefault(store, "") - if err != nil { - return nil, fmt.Errorf("wasi: get default: %w", err) + if cerr := checkError(err, stderr); cerr != nil { + return cerr } - callRegion := trace.StartRegion(ctx, "call _start") - _, err = fn.Call(store) - callRegion.End() + // Print WASM stdout + stdoutBlob := stdout.Bytes() - if cerr := checkError(err, stderrPath); cerr != nil { - return nil, cerr + resp, ok := reply.(protoreflect.ProtoMessage) + if !ok { + return fmt.Errorf("reply isn't a GenerateResponse") } - // Print WASM stdout - stdoutBlob, err := os.ReadFile(stdoutPath) - if err != nil { - return nil, fmt.Errorf("read file: %w", err) + if err := proto.Unmarshal(stdoutBlob, resp); err != nil { + return err } - var resp plugin.CodeGenResponse - return &resp, resp.UnmarshalVT(stdoutBlob) + return nil } -func checkError(err error, stderrPath string) error { +func (r *Runner) NewStream(ctx context.Context, desc *grpc.StreamDesc, method string, opts ...grpc.CallOption) (grpc.ClientStream, error) { + return nil, status.Error(codes.Unimplemented, "") +} + +func checkError(err error, stderr bytes.Buffer) error { if err == nil { return err } - var wtError *wasmtime.Error - if errors.As(err, &wtError) { - if code, ok := wtError.ExitStatus(); ok { - if code == 0 { - return nil - } + if exitErr, ok := err.(*sys.ExitError); ok { + if exitErr.ExitCode() == 0 { + return nil } } + // Print WASM stdout - stderrBlob, rferr := os.ReadFile(stderrPath) - if rferr == nil && len(stderrBlob) > 0 { - return errors.New(string(stderrBlob)) + stderrBlob := stderr.String() + if len(stderrBlob) > 0 { + return errors.New(stderrBlob) } return fmt.Errorf("call: %w", err) } diff --git a/internal/inflection/singular.go b/internal/inflection/singular.go index edac927603..64e042a6ab 100644 --- a/internal/inflection/singular.go +++ b/internal/inflection/singular.go @@ -43,5 +43,10 @@ func Singular(s SingularParams) string { if strings.ToLower(s.Name) == "waves" { return "wave" } + + if strings.ToLower(s.Name) == "metadata" { + return "metadata" + } + return upstream.Singular(s.Name) } diff --git a/internal/info/facts.go b/internal/info/facts.go index e150dae4d3..dbae7b84ae 100644 --- a/internal/info/facts.go +++ b/internal/info/facts.go @@ -2,4 +2,4 @@ package info // When no version is set, return the next bug fix version // after the most recent tag -const Version = "v1.22.0" +const Version = "v1.30.0" diff --git a/internal/metadata/meta.go b/internal/metadata/meta.go index 4176da1e2b..8f63624d2c 100644 --- a/internal/metadata/meta.go +++ b/internal/metadata/meta.go @@ -1,15 +1,29 @@ package metadata import ( + "bufio" "fmt" + "github.com/sqlc-dev/sqlc/internal/constants" "strings" "unicode" + + "github.com/sqlc-dev/sqlc/internal/source" ) -type CommentSyntax struct { - Dash bool - Hash bool - SlashStar bool +type CommentSyntax source.CommentSyntax + +type Metadata struct { + Name string + Cmd string + Comments []string + Params map[string]string + Flags map[string]bool + + // RuleSkiplist contains the names of rules to disable vetting for. + // If the map is empty, but the disable vet flag is specified, then all rules are ignored. + RuleSkiplist map[string]struct{} + + Filename string } const ( @@ -83,7 +97,7 @@ func ParseQueryNameAndType(t string, commentStyle CommentSyntax) (string, string if prefix == "/*" { part = part[:len(part)-1] // removes the trailing "*/" element } - if len(part) == 2 { + if len(part) == 3 { return "", "", fmt.Errorf("missing query type [':one', ':many', ':exec', ':execrows', ':execlastid', ':execresult', ':copyfrom', 'batchexec', 'batchmany', 'batchone']: %s", line) } if len(part) != 4 { @@ -104,19 +118,55 @@ func ParseQueryNameAndType(t string, commentStyle CommentSyntax) (string, string return "", "", nil } -func ParseQueryFlags(comments []string) (map[string]bool, error) { +// ParseCommentFlags processes the comments provided with queries to determine the metadata params, flags and rules to skip. +// All flags in query comments are prefixed with `@`, e.g. @param, @@sqlc-vet-disable. +func ParseCommentFlags(comments []string) (map[string]string, map[string]bool, map[string]struct{}, error) { + params := make(map[string]string) flags := make(map[string]bool) + ruleSkiplist := make(map[string]struct{}) + for _, line := range comments { - cleanLine := strings.TrimPrefix(line, "--") - cleanLine = strings.TrimPrefix(cleanLine, "/*") - cleanLine = strings.TrimPrefix(cleanLine, "#") - cleanLine = strings.TrimSuffix(cleanLine, "*/") - cleanLine = strings.TrimSpace(cleanLine) - if strings.HasPrefix(cleanLine, "@") { - flagName := strings.SplitN(cleanLine, " ", 2)[0] - flags[flagName] = true + s := bufio.NewScanner(strings.NewReader(line)) + s.Split(bufio.ScanWords) + + s.Scan() + token := s.Text() + + if !strings.HasPrefix(token, "@") { continue } + + switch token { + case constants.QueryFlagParam: + s.Scan() + name := s.Text() + var rest []string + for s.Scan() { + paramToken := s.Text() + rest = append(rest, paramToken) + } + params[name] = strings.Join(rest, " ") + + case constants.QueryFlagSqlcVetDisable: + flags[token] = true + + // Vet rules can all be disabled in the same line or split across lines .i.e. + // /* @sqlc-vet-disable sqlc/db-prepare delete-without-where */ + // is equivalent to: + // /* @sqlc-vet-disable sqlc/db-prepare */ + // /* @sqlc-vet-disable delete-without-where */ + for s.Scan() { + ruleSkiplist[s.Text()] = struct{}{} + } + + default: + flags[token] = true + } + + if s.Err() != nil { + return params, flags, ruleSkiplist, s.Err() + } } - return flags, nil + + return params, flags, ruleSkiplist, nil } diff --git a/internal/metadata/meta_test.go b/internal/metadata/meta_test.go index cbfcb6fba6..e9ef54586e 100644 --- a/internal/metadata/meta_test.go +++ b/internal/metadata/meta_test.go @@ -1,6 +1,8 @@ package metadata -import "testing" +import ( + "testing" +) func TestParseQueryNameAndType(t *testing.T) { @@ -32,34 +34,149 @@ func TestParseQueryNameAndType(t *testing.T) { } } - query := `-- name: CreateFoo :one` - queryName, queryType, err := ParseQueryNameAndType(query, CommentSyntax{Dash: true}) - if err != nil { - t.Errorf("expected valid metadata: %q", query) - } - if queryName != "CreateFoo" { - t.Errorf("incorrect queryName parsed: %q", query) - } - if queryType != CmdOne { - t.Errorf("incorrect queryType parsed: %q", query) + for query, cs := range map[string]CommentSyntax{ + `-- name: CreateFoo :one`: {Dash: true}, + `# name: CreateFoo :one`: {Hash: true}, + `/* name: CreateFoo :one */`: {SlashStar: true}, + } { + queryName, queryCmd, err := ParseQueryNameAndType(query, cs) + if err != nil { + t.Errorf("expected valid metadata: %q", query) + } + if queryName != "CreateFoo" { + t.Errorf("incorrect queryName parsed: (%q) %q", queryName, query) + } + if queryCmd != CmdOne { + t.Errorf("incorrect queryCmd parsed: (%q) %q", queryCmd, query) + } } } +func TestParseQueryParams(t *testing.T) { + for _, comments := range [][]string{ + { + " name: CreateFoo :one", + " @param foo_id UUID", + }, + { + " name: CreateFoo :one ", + " @param foo_id UUID ", + }, + { + " name: CreateFoo :one", + "@param foo_id UUID", + " invalid", + }, + { + " name: CreateFoo :one", + " @invalid", + " @param foo_id UUID", + }, + { + " name: GetFoos :many ", + " @param foo_id UUID ", + " @param @invalid UUID ", + }, + } { + params, _, _, err := ParseCommentFlags(comments) + if err != nil { + t.Errorf("expected comments to parse, got err: %s", err) + } + + pt, ok := params["foo_id"] + if !ok { + t.Errorf("expected param not found") + } + + if pt != "UUID" { + t.Error("unexpected param metadata:", pt) + } + + _, ok = params["invalid"] + if ok { + t.Errorf("unexpected param found") + } + } +} + func TestParseQueryFlags(t *testing.T) { for _, comments := range [][]string{ { - "-- name: CreateFoo :one", - "-- @flag-foo", + " name: CreateFoo :one", + " @flag-foo", + }, + { + " name: CreateFoo :one ", + "@flag-foo ", + }, + { + " name: CreateFoo :one", + " @flag-foo @flag-bar", + }, + { + " name: GetFoos :many", + " @param @flag-bar UUID", + " @flag-foo", + }, + { + " name: GetFoos :many", + " @flag-foo", + " @param @flag-bar UUID", }, } { - flags, err := ParseQueryFlags(comments) + _, flags, _, err := ParseCommentFlags(comments) if err != nil { - t.Errorf("expected query flags to parse, got error: %s", err) + t.Errorf("expected comments to parse, got err: %s", err) } if !flags["@flag-foo"] { t.Errorf("expected flag not found") } + + if flags["@flag-bar"] { + t.Errorf("unexpected flag found") + } } -} \ No newline at end of file +} + +func TestParseQueryRuleSkiplist(t *testing.T) { + for _, comments := range [][]string{ + { + " name: CreateFoo :one", + " @sqlc-vet-disable sqlc/db-prepare delete-without-where ", + }, + { + " name: CreateFoo :one ", + " @sqlc-vet-disable sqlc/db-prepare ", + " @sqlc-vet-disable delete-without-where ", + }, + { + " name: CreateFoo :one", + " @sqlc-vet-disable sqlc/db-prepare ", + " update-without where", + " @sqlc-vet-disable delete-without-where ", + }, + } { + _, flags, ruleSkiplist, err := ParseCommentFlags(comments) + if err != nil { + t.Errorf("expected comments to parse, got err: %s", err) + } + + if !flags["@sqlc-vet-disable"] { + t.Errorf("expected @sqlc-vet-disable flag not found") + } + + if _, ok := ruleSkiplist["sqlc/db-prepare"]; !ok { + t.Errorf("expected rule not found in skiplist") + } + + if _, ok := ruleSkiplist["delete-without-where"]; !ok { + t.Errorf("expected rule not found in skiplist") + } + + if _, ok := ruleSkiplist["update-without-where"]; ok { + t.Errorf("unexpected rule found in skiplist") + } + } +} diff --git a/internal/migrations/migrations.go b/internal/migrations/migrations.go index ac0e8b3d9a..4ade6045a4 100644 --- a/internal/migrations/migrations.go +++ b/internal/migrations/migrations.go @@ -15,16 +15,17 @@ func RemoveRollbackStatements(contents string) string { s := bufio.NewScanner(strings.NewReader(contents)) var lines []string for s.Scan() { - if strings.HasPrefix(s.Text(), "-- +goose Down") { + statement := strings.ToLower(s.Text()) + if strings.HasPrefix(statement, "-- +goose down") { break } - if strings.HasPrefix(s.Text(), "-- +migrate Down") { + if strings.HasPrefix(statement, "-- +migrate down") { break } - if strings.HasPrefix(s.Text(), "---- create above / drop below ----") { + if strings.HasPrefix(statement, "---- create above / drop below ----") { break } - if strings.HasPrefix(s.Text(), "-- migrate:down") { + if strings.HasPrefix(statement, "-- migrate:down") { break } lines = append(lines, s.Text()) diff --git a/internal/opts/debug.go b/internal/opts/debug.go index 94cda87863..b92cbd4ae8 100644 --- a/internal/opts/debug.go +++ b/internal/opts/debug.go @@ -12,18 +12,20 @@ import ( // dumpcatalog: setting dumpcatalog=1 will print the parsed database schema // trace: setting trace= will output a trace // processplugins: setting processplugins=0 will disable process-based plugins +// databases: setting databases=managed will disable connections to databases via URI // dumpvetenv: setting dumpvetenv=1 will print the variables available to // a vet rule during evaluation // dumpexplain: setting dumpexplain=1 will print the JSON-formatted output // from executing EXPLAIN ... on a query during vet rule evaluation type Debug struct { - DumpAST bool - DumpCatalog bool - Trace string - ProcessPlugins bool - DumpVetEnv bool - DumpExplain bool + DumpAST bool + DumpCatalog bool + Trace string + ProcessPlugins bool + OnlyManagedDatabases bool + DumpVetEnv bool + DumpExplain bool } func DebugFromEnv() Debug { @@ -53,6 +55,8 @@ func DebugFromString(val string) Debug { } case pair == "processplugins=0": d.ProcessPlugins = false + case pair == "databases=managed": + d.OnlyManagedDatabases = true case pair == "dumpvetenv=1": d.DumpVetEnv = true case pair == "dumpexplain=1": diff --git a/internal/pgx/poolcache/poolcache.go b/internal/pgx/poolcache/poolcache.go new file mode 100644 index 0000000000..3fce3cb131 --- /dev/null +++ b/internal/pgx/poolcache/poolcache.go @@ -0,0 +1,61 @@ +package poolcache + +import ( + "context" + "fmt" + "sync" + + "github.com/jackc/pgx/v5/pgxpool" +) + +type Cache struct { + lock sync.RWMutex + closed bool + pools map[string]*pgxpool.Pool +} + +func New() *Cache { + return &Cache{ + pools: map[string]*pgxpool.Pool{}, + } +} + +func (c *Cache) Open(ctx context.Context, uri string) (*pgxpool.Pool, error) { + if c.closed { + return nil, fmt.Errorf("poolcache is closed") + } + + c.lock.RLock() + existing, found := c.pools[uri] + c.lock.RUnlock() + + if found { + return existing, nil + } + + pool, err := pgxpool.New(ctx, uri) + if err != nil { + return nil, err + } + + c.lock.Lock() + c.pools[uri] = pool + c.lock.Unlock() + + return pool, nil +} + +func (c *Cache) Close() error { + c.lock.Lock() + defer c.lock.Unlock() + + var closeErr error + for _, pool := range c.pools { + pool.Close() + } + + c.closed = true + clear(c.pools) + + return closeErr +} diff --git a/internal/plugin/codegen.pb.go b/internal/plugin/codegen.pb.go index ed90c7b7db..525ffc72ef 100644 --- a/internal/plugin/codegen.pb.go +++ b/internal/plugin/codegen.pb.go @@ -75,214 +75,22 @@ func (x *File) GetContents() []byte { return nil } -type Override struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // name of the type to use, e.g. `github.com/segmentio/ksuid.KSUID` or `mymodule.Type` - CodeType string `protobuf:"bytes,1,opt,name=code_type,proto3" json:"code_type,omitempty"` - // name of the type to use, e.g. `text` - DbType string `protobuf:"bytes,3,opt,name=db_type,proto3" json:"db_type,omitempty"` - // True if the override should apply to a nullable database type - Nullable bool `protobuf:"varint,5,opt,name=nullable,proto3" json:"nullable,omitempty"` - // fully qualified name of the column, e.g. `accounts.id` - Column string `protobuf:"bytes,6,opt,name=column,proto3" json:"column,omitempty"` - Table *Identifier `protobuf:"bytes,7,opt,name=table,proto3" json:"table,omitempty"` - ColumnName string `protobuf:"bytes,8,opt,name=column_name,proto3" json:"column_name,omitempty"` - GoType *ParsedGoType `protobuf:"bytes,10,opt,name=go_type,json=goType,proto3" json:"go_type,omitempty"` - // True if the override should apply to a unsigned database type - Unsigned bool `protobuf:"varint,11,opt,name=unsigned,proto3" json:"unsigned,omitempty"` -} - -func (x *Override) Reset() { - *x = Override{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Override) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Override) ProtoMessage() {} - -func (x *Override) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Override.ProtoReflect.Descriptor instead. -func (*Override) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{1} -} - -func (x *Override) GetCodeType() string { - if x != nil { - return x.CodeType - } - return "" -} - -func (x *Override) GetDbType() string { - if x != nil { - return x.DbType - } - return "" -} - -func (x *Override) GetNullable() bool { - if x != nil { - return x.Nullable - } - return false -} - -func (x *Override) GetColumn() string { - if x != nil { - return x.Column - } - return "" -} - -func (x *Override) GetTable() *Identifier { - if x != nil { - return x.Table - } - return nil -} - -func (x *Override) GetColumnName() string { - if x != nil { - return x.ColumnName - } - return "" -} - -func (x *Override) GetGoType() *ParsedGoType { - if x != nil { - return x.GoType - } - return nil -} - -func (x *Override) GetUnsigned() bool { - if x != nil { - return x.Unsigned - } - return false -} - -type ParsedGoType struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ImportPath string `protobuf:"bytes,1,opt,name=import_path,json=importPath,proto3" json:"import_path,omitempty"` - Package string `protobuf:"bytes,2,opt,name=package,proto3" json:"package,omitempty"` - TypeName string `protobuf:"bytes,3,opt,name=type_name,json=typeName,proto3" json:"type_name,omitempty"` - BasicType bool `protobuf:"varint,4,opt,name=basic_type,json=basicType,proto3" json:"basic_type,omitempty"` - StructTags map[string]string `protobuf:"bytes,5,rep,name=struct_tags,json=structTags,proto3" json:"struct_tags,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (x *ParsedGoType) Reset() { - *x = ParsedGoType{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ParsedGoType) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ParsedGoType) ProtoMessage() {} - -func (x *ParsedGoType) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ParsedGoType.ProtoReflect.Descriptor instead. -func (*ParsedGoType) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{2} -} - -func (x *ParsedGoType) GetImportPath() string { - if x != nil { - return x.ImportPath - } - return "" -} - -func (x *ParsedGoType) GetPackage() string { - if x != nil { - return x.Package - } - return "" -} - -func (x *ParsedGoType) GetTypeName() string { - if x != nil { - return x.TypeName - } - return "" -} - -func (x *ParsedGoType) GetBasicType() bool { - if x != nil { - return x.BasicType - } - return false -} - -func (x *ParsedGoType) GetStructTags() map[string]string { - if x != nil { - return x.StructTags - } - return nil -} - type Settings struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - Engine string `protobuf:"bytes,2,opt,name=engine,proto3" json:"engine,omitempty"` - Schema []string `protobuf:"bytes,3,rep,name=schema,proto3" json:"schema,omitempty"` - Queries []string `protobuf:"bytes,4,rep,name=queries,proto3" json:"queries,omitempty"` - Rename map[string]string `protobuf:"bytes,5,rep,name=rename,proto3" json:"rename,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Overrides []*Override `protobuf:"bytes,6,rep,name=overrides,proto3" json:"overrides,omitempty"` - Codegen *Codegen `protobuf:"bytes,12,opt,name=codegen,proto3" json:"codegen,omitempty"` - // TODO: Refactor codegen settings - Go *GoCode `protobuf:"bytes,10,opt,name=go,proto3" json:"go,omitempty"` - Json *JSONCode `protobuf:"bytes,11,opt,name=json,proto3" json:"json,omitempty"` + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + Engine string `protobuf:"bytes,2,opt,name=engine,proto3" json:"engine,omitempty"` + Schema []string `protobuf:"bytes,3,rep,name=schema,proto3" json:"schema,omitempty"` + Queries []string `protobuf:"bytes,4,rep,name=queries,proto3" json:"queries,omitempty"` + Codegen *Codegen `protobuf:"bytes,12,opt,name=codegen,proto3" json:"codegen,omitempty"` } func (x *Settings) Reset() { *x = Settings{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[3] + mi := &file_plugin_codegen_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -295,438 +103,87 @@ func (x *Settings) String() string { func (*Settings) ProtoMessage() {} func (x *Settings) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Settings.ProtoReflect.Descriptor instead. -func (*Settings) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{3} -} - -func (x *Settings) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - -func (x *Settings) GetEngine() string { - if x != nil { - return x.Engine - } - return "" -} - -func (x *Settings) GetSchema() []string { - if x != nil { - return x.Schema - } - return nil -} - -func (x *Settings) GetQueries() []string { - if x != nil { - return x.Queries - } - return nil -} - -func (x *Settings) GetRename() map[string]string { - if x != nil { - return x.Rename - } - return nil -} - -func (x *Settings) GetOverrides() []*Override { - if x != nil { - return x.Overrides - } - return nil -} - -func (x *Settings) GetCodegen() *Codegen { - if x != nil { - return x.Codegen - } - return nil -} - -func (x *Settings) GetGo() *GoCode { - if x != nil { - return x.Go - } - return nil -} - -func (x *Settings) GetJson() *JSONCode { - if x != nil { - return x.Json - } - return nil -} - -type Codegen struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Out string `protobuf:"bytes,1,opt,name=out,proto3" json:"out,omitempty"` - Plugin string `protobuf:"bytes,2,opt,name=plugin,proto3" json:"plugin,omitempty"` - Options []byte `protobuf:"bytes,3,opt,name=options,proto3" json:"options,omitempty"` -} - -func (x *Codegen) Reset() { - *x = Codegen{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Codegen) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Codegen) ProtoMessage() {} - -func (x *Codegen) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Codegen.ProtoReflect.Descriptor instead. -func (*Codegen) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{4} -} - -func (x *Codegen) GetOut() string { - if x != nil { - return x.Out - } - return "" -} - -func (x *Codegen) GetPlugin() string { - if x != nil { - return x.Plugin - } - return "" -} - -func (x *Codegen) GetOptions() []byte { - if x != nil { - return x.Options - } - return nil -} - -type GoCode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - EmitInterface bool `protobuf:"varint,1,opt,name=emit_interface,json=emitInterface,proto3" json:"emit_interface,omitempty"` - EmitJsonTags bool `protobuf:"varint,2,opt,name=emit_json_tags,json=emitJsonTags,proto3" json:"emit_json_tags,omitempty"` - EmitDbTags bool `protobuf:"varint,3,opt,name=emit_db_tags,json=emitDbTags,proto3" json:"emit_db_tags,omitempty"` - EmitPreparedQueries bool `protobuf:"varint,4,opt,name=emit_prepared_queries,json=emitPreparedQueries,proto3" json:"emit_prepared_queries,omitempty"` - EmitExactTableNames bool `protobuf:"varint,5,opt,name=emit_exact_table_names,json=emitExactTableNames,proto3" json:"emit_exact_table_names,omitempty"` - EmitEmptySlices bool `protobuf:"varint,6,opt,name=emit_empty_slices,json=emitEmptySlices,proto3" json:"emit_empty_slices,omitempty"` - EmitExportedQueries bool `protobuf:"varint,7,opt,name=emit_exported_queries,json=emitExportedQueries,proto3" json:"emit_exported_queries,omitempty"` - EmitResultStructPointers bool `protobuf:"varint,8,opt,name=emit_result_struct_pointers,json=emitResultStructPointers,proto3" json:"emit_result_struct_pointers,omitempty"` - EmitParamsStructPointers bool `protobuf:"varint,9,opt,name=emit_params_struct_pointers,json=emitParamsStructPointers,proto3" json:"emit_params_struct_pointers,omitempty"` - EmitMethodsWithDbArgument bool `protobuf:"varint,10,opt,name=emit_methods_with_db_argument,json=emitMethodsWithDbArgument,proto3" json:"emit_methods_with_db_argument,omitempty"` - JsonTagsCaseStyle string `protobuf:"bytes,11,opt,name=json_tags_case_style,json=jsonTagsCaseStyle,proto3" json:"json_tags_case_style,omitempty"` - Package string `protobuf:"bytes,12,opt,name=package,proto3" json:"package,omitempty"` - Out string `protobuf:"bytes,13,opt,name=out,proto3" json:"out,omitempty"` - SqlPackage string `protobuf:"bytes,14,opt,name=sql_package,json=sqlPackage,proto3" json:"sql_package,omitempty"` - SqlDriver string `protobuf:"bytes,25,opt,name=sql_driver,json=sqlDriver,proto3" json:"sql_driver,omitempty"` - OutputDbFileName string `protobuf:"bytes,15,opt,name=output_db_file_name,json=outputDbFileName,proto3" json:"output_db_file_name,omitempty"` - OutputModelsFileName string `protobuf:"bytes,16,opt,name=output_models_file_name,json=outputModelsFileName,proto3" json:"output_models_file_name,omitempty"` - OutputQuerierFileName string `protobuf:"bytes,17,opt,name=output_querier_file_name,json=outputQuerierFileName,proto3" json:"output_querier_file_name,omitempty"` - OutputCopyfromFileName string `protobuf:"bytes,28,opt,name=output_copyfrom_file_name,json=outputCopyfromFileName,proto3" json:"output_copyfrom_file_name,omitempty"` - OutputFilesSuffix string `protobuf:"bytes,18,opt,name=output_files_suffix,json=outputFilesSuffix,proto3" json:"output_files_suffix,omitempty"` - EmitEnumValidMethod bool `protobuf:"varint,19,opt,name=emit_enum_valid_method,json=emitEnumValidMethod,proto3" json:"emit_enum_valid_method,omitempty"` - EmitAllEnumValues bool `protobuf:"varint,20,opt,name=emit_all_enum_values,json=emitAllEnumValues,proto3" json:"emit_all_enum_values,omitempty"` - InflectionExcludeTableNames []string `protobuf:"bytes,21,rep,name=inflection_exclude_table_names,json=inflectionExcludeTableNames,proto3" json:"inflection_exclude_table_names,omitempty"` - EmitPointersForNullTypes bool `protobuf:"varint,22,opt,name=emit_pointers_for_null_types,json=emitPointersForNullTypes,proto3" json:"emit_pointers_for_null_types,omitempty"` - QueryParameterLimit *int32 `protobuf:"varint,23,opt,name=query_parameter_limit,json=queryParameterLimit,proto3,oneof" json:"query_parameter_limit,omitempty"` - OutputBatchFileName string `protobuf:"bytes,24,opt,name=output_batch_file_name,json=outputBatchFileName,proto3" json:"output_batch_file_name,omitempty"` - JsonTagsIdUppercase bool `protobuf:"varint,26,opt,name=json_tags_id_uppercase,json=jsonTagsIdUppercase,proto3" json:"json_tags_id_uppercase,omitempty"` - OmitUnusedStructs bool `protobuf:"varint,27,opt,name=omit_unused_structs,json=omitUnusedStructs,proto3" json:"omit_unused_structs,omitempty"` -} - -func (x *GoCode) Reset() { - *x = GoCode{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GoCode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GoCode) ProtoMessage() {} - -func (x *GoCode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[5] + mi := &file_plugin_codegen_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GoCode.ProtoReflect.Descriptor instead. -func (*GoCode) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{5} -} - -func (x *GoCode) GetEmitInterface() bool { - if x != nil { - return x.EmitInterface - } - return false -} - -func (x *GoCode) GetEmitJsonTags() bool { - if x != nil { - return x.EmitJsonTags - } - return false -} - -func (x *GoCode) GetEmitDbTags() bool { - if x != nil { - return x.EmitDbTags - } - return false -} - -func (x *GoCode) GetEmitPreparedQueries() bool { - if x != nil { - return x.EmitPreparedQueries - } - return false -} - -func (x *GoCode) GetEmitExactTableNames() bool { - if x != nil { - return x.EmitExactTableNames - } - return false -} - -func (x *GoCode) GetEmitEmptySlices() bool { - if x != nil { - return x.EmitEmptySlices - } - return false -} - -func (x *GoCode) GetEmitExportedQueries() bool { - if x != nil { - return x.EmitExportedQueries - } - return false -} - -func (x *GoCode) GetEmitResultStructPointers() bool { - if x != nil { - return x.EmitResultStructPointers - } - return false -} - -func (x *GoCode) GetEmitParamsStructPointers() bool { - if x != nil { - return x.EmitParamsStructPointers - } - return false -} - -func (x *GoCode) GetEmitMethodsWithDbArgument() bool { - if x != nil { - return x.EmitMethodsWithDbArgument - } - return false -} - -func (x *GoCode) GetJsonTagsCaseStyle() string { - if x != nil { - return x.JsonTagsCaseStyle - } - return "" -} - -func (x *GoCode) GetPackage() string { - if x != nil { - return x.Package - } - return "" -} - -func (x *GoCode) GetOut() string { - if x != nil { - return x.Out - } - return "" -} - -func (x *GoCode) GetSqlPackage() string { - if x != nil { - return x.SqlPackage - } - return "" -} - -func (x *GoCode) GetSqlDriver() string { - if x != nil { - return x.SqlDriver - } - return "" -} - -func (x *GoCode) GetOutputDbFileName() string { - if x != nil { - return x.OutputDbFileName - } - return "" -} - -func (x *GoCode) GetOutputModelsFileName() string { - if x != nil { - return x.OutputModelsFileName - } - return "" -} - -func (x *GoCode) GetOutputQuerierFileName() string { - if x != nil { - return x.OutputQuerierFileName - } - return "" -} - -func (x *GoCode) GetOutputCopyfromFileName() string { - if x != nil { - return x.OutputCopyfromFileName - } - return "" -} - -func (x *GoCode) GetOutputFilesSuffix() string { - if x != nil { - return x.OutputFilesSuffix - } - return "" -} - -func (x *GoCode) GetEmitEnumValidMethod() bool { - if x != nil { - return x.EmitEnumValidMethod + } + return ms } - return false + return mi.MessageOf(x) } -func (x *GoCode) GetEmitAllEnumValues() bool { - if x != nil { - return x.EmitAllEnumValues - } - return false +// Deprecated: Use Settings.ProtoReflect.Descriptor instead. +func (*Settings) Descriptor() ([]byte, []int) { + return file_plugin_codegen_proto_rawDescGZIP(), []int{1} } -func (x *GoCode) GetInflectionExcludeTableNames() []string { +func (x *Settings) GetVersion() string { if x != nil { - return x.InflectionExcludeTableNames + return x.Version } - return nil + return "" } -func (x *GoCode) GetEmitPointersForNullTypes() bool { +func (x *Settings) GetEngine() string { if x != nil { - return x.EmitPointersForNullTypes - } - return false -} - -func (x *GoCode) GetQueryParameterLimit() int32 { - if x != nil && x.QueryParameterLimit != nil { - return *x.QueryParameterLimit + return x.Engine } - return 0 + return "" } -func (x *GoCode) GetOutputBatchFileName() string { +func (x *Settings) GetSchema() []string { if x != nil { - return x.OutputBatchFileName + return x.Schema } - return "" + return nil } -func (x *GoCode) GetJsonTagsIdUppercase() bool { +func (x *Settings) GetQueries() []string { if x != nil { - return x.JsonTagsIdUppercase + return x.Queries } - return false + return nil } -func (x *GoCode) GetOmitUnusedStructs() bool { +func (x *Settings) GetCodegen() *Codegen { if x != nil { - return x.OmitUnusedStructs + return x.Codegen } - return false + return nil } -type JSONCode struct { +type Codegen struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Out string `protobuf:"bytes,1,opt,name=out,proto3" json:"out,omitempty"` - Indent string `protobuf:"bytes,2,opt,name=indent,proto3" json:"indent,omitempty"` - Filename string `protobuf:"bytes,3,opt,name=filename,proto3" json:"filename,omitempty"` + Out string `protobuf:"bytes,1,opt,name=out,proto3" json:"out,omitempty"` + Plugin string `protobuf:"bytes,2,opt,name=plugin,proto3" json:"plugin,omitempty"` + Options []byte `protobuf:"bytes,3,opt,name=options,proto3" json:"options,omitempty"` + Env []string `protobuf:"bytes,4,rep,name=env,proto3" json:"env,omitempty"` + Process *Codegen_Process `protobuf:"bytes,5,opt,name=process,proto3" json:"process,omitempty"` + Wasm *Codegen_WASM `protobuf:"bytes,6,opt,name=wasm,proto3" json:"wasm,omitempty"` } -func (x *JSONCode) Reset() { - *x = JSONCode{} +func (x *Codegen) Reset() { + *x = Codegen{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[6] + mi := &file_plugin_codegen_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *JSONCode) String() string { +func (x *Codegen) String() string { return protoimpl.X.MessageStringOf(x) } -func (*JSONCode) ProtoMessage() {} +func (*Codegen) ProtoMessage() {} -func (x *JSONCode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[6] +func (x *Codegen) ProtoReflect() protoreflect.Message { + mi := &file_plugin_codegen_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -737,30 +194,51 @@ func (x *JSONCode) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use JSONCode.ProtoReflect.Descriptor instead. -func (*JSONCode) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{6} +// Deprecated: Use Codegen.ProtoReflect.Descriptor instead. +func (*Codegen) Descriptor() ([]byte, []int) { + return file_plugin_codegen_proto_rawDescGZIP(), []int{2} } -func (x *JSONCode) GetOut() string { +func (x *Codegen) GetOut() string { if x != nil { return x.Out } return "" } -func (x *JSONCode) GetIndent() string { +func (x *Codegen) GetPlugin() string { if x != nil { - return x.Indent + return x.Plugin } return "" } -func (x *JSONCode) GetFilename() string { +func (x *Codegen) GetOptions() []byte { if x != nil { - return x.Filename + return x.Options } - return "" + return nil +} + +func (x *Codegen) GetEnv() []string { + if x != nil { + return x.Env + } + return nil +} + +func (x *Codegen) GetProcess() *Codegen_Process { + if x != nil { + return x.Process + } + return nil +} + +func (x *Codegen) GetWasm() *Codegen_WASM { + if x != nil { + return x.Wasm + } + return nil } type Catalog struct { @@ -777,7 +255,7 @@ type Catalog struct { func (x *Catalog) Reset() { *x = Catalog{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[7] + mi := &file_plugin_codegen_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -790,7 +268,7 @@ func (x *Catalog) String() string { func (*Catalog) ProtoMessage() {} func (x *Catalog) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[7] + mi := &file_plugin_codegen_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -803,7 +281,7 @@ func (x *Catalog) ProtoReflect() protoreflect.Message { // Deprecated: Use Catalog.ProtoReflect.Descriptor instead. func (*Catalog) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{7} + return file_plugin_codegen_proto_rawDescGZIP(), []int{3} } func (x *Catalog) GetComment() string { @@ -849,7 +327,7 @@ type Schema struct { func (x *Schema) Reset() { *x = Schema{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[8] + mi := &file_plugin_codegen_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -862,7 +340,7 @@ func (x *Schema) String() string { func (*Schema) ProtoMessage() {} func (x *Schema) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[8] + mi := &file_plugin_codegen_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -875,7 +353,7 @@ func (x *Schema) ProtoReflect() protoreflect.Message { // Deprecated: Use Schema.ProtoReflect.Descriptor instead. func (*Schema) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{8} + return file_plugin_codegen_proto_rawDescGZIP(), []int{4} } func (x *Schema) GetComment() string { @@ -925,7 +403,7 @@ type CompositeType struct { func (x *CompositeType) Reset() { *x = CompositeType{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[9] + mi := &file_plugin_codegen_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -938,7 +416,7 @@ func (x *CompositeType) String() string { func (*CompositeType) ProtoMessage() {} func (x *CompositeType) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[9] + mi := &file_plugin_codegen_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -951,7 +429,7 @@ func (x *CompositeType) ProtoReflect() protoreflect.Message { // Deprecated: Use CompositeType.ProtoReflect.Descriptor instead. func (*CompositeType) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{9} + return file_plugin_codegen_proto_rawDescGZIP(), []int{5} } func (x *CompositeType) GetName() string { @@ -981,7 +459,7 @@ type Enum struct { func (x *Enum) Reset() { *x = Enum{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[10] + mi := &file_plugin_codegen_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -994,7 +472,7 @@ func (x *Enum) String() string { func (*Enum) ProtoMessage() {} func (x *Enum) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[10] + mi := &file_plugin_codegen_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1007,7 +485,7 @@ func (x *Enum) ProtoReflect() protoreflect.Message { // Deprecated: Use Enum.ProtoReflect.Descriptor instead. func (*Enum) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{10} + return file_plugin_codegen_proto_rawDescGZIP(), []int{6} } func (x *Enum) GetName() string { @@ -1044,7 +522,7 @@ type Table struct { func (x *Table) Reset() { *x = Table{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[11] + mi := &file_plugin_codegen_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1057,7 +535,7 @@ func (x *Table) String() string { func (*Table) ProtoMessage() {} func (x *Table) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[11] + mi := &file_plugin_codegen_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1070,7 +548,7 @@ func (x *Table) ProtoReflect() protoreflect.Message { // Deprecated: Use Table.ProtoReflect.Descriptor instead. func (*Table) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{11} + return file_plugin_codegen_proto_rawDescGZIP(), []int{7} } func (x *Table) GetRel() *Identifier { @@ -1107,7 +585,7 @@ type Identifier struct { func (x *Identifier) Reset() { *x = Identifier{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[12] + mi := &file_plugin_codegen_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1120,7 +598,7 @@ func (x *Identifier) String() string { func (*Identifier) ProtoMessage() {} func (x *Identifier) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[12] + mi := &file_plugin_codegen_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1133,7 +611,7 @@ func (x *Identifier) ProtoReflect() protoreflect.Message { // Deprecated: Use Identifier.ProtoReflect.Descriptor instead. func (*Identifier) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{12} + return file_plugin_codegen_proto_rawDescGZIP(), []int{8} } func (x *Identifier) GetCatalog() string { @@ -1184,7 +662,7 @@ type Column struct { func (x *Column) Reset() { *x = Column{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[13] + mi := &file_plugin_codegen_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1197,7 +675,7 @@ func (x *Column) String() string { func (*Column) ProtoMessage() {} func (x *Column) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[13] + mi := &file_plugin_codegen_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1210,7 +688,7 @@ func (x *Column) ProtoReflect() protoreflect.Message { // Deprecated: Use Column.ProtoReflect.Descriptor instead. func (*Column) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{13} + return file_plugin_codegen_proto_rawDescGZIP(), []int{9} } func (x *Column) GetName() string { @@ -1343,7 +821,7 @@ type Query struct { func (x *Query) Reset() { *x = Query{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[14] + mi := &file_plugin_codegen_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1356,7 +834,7 @@ func (x *Query) String() string { func (*Query) ProtoMessage() {} func (x *Query) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[14] + mi := &file_plugin_codegen_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1369,7 +847,7 @@ func (x *Query) ProtoReflect() protoreflect.Message { // Deprecated: Use Query.ProtoReflect.Descriptor instead. func (*Query) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{14} + return file_plugin_codegen_proto_rawDescGZIP(), []int{10} } func (x *Query) GetText() string { @@ -1440,7 +918,7 @@ type Parameter struct { func (x *Parameter) Reset() { *x = Parameter{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[15] + mi := &file_plugin_codegen_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1453,7 +931,7 @@ func (x *Parameter) String() string { func (*Parameter) ProtoMessage() {} func (x *Parameter) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[15] + mi := &file_plugin_codegen_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1466,7 +944,7 @@ func (x *Parameter) ProtoReflect() protoreflect.Message { // Deprecated: Use Parameter.ProtoReflect.Descriptor instead. func (*Parameter) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{15} + return file_plugin_codegen_proto_rawDescGZIP(), []int{11} } func (x *Parameter) GetNumber() int32 { @@ -1483,7 +961,7 @@ func (x *Parameter) GetColumn() *Column { return nil } -type CodeGenRequest struct { +type GenerateRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -1493,25 +971,26 @@ type CodeGenRequest struct { Queries []*Query `protobuf:"bytes,3,rep,name=queries,proto3" json:"queries,omitempty"` SqlcVersion string `protobuf:"bytes,4,opt,name=sqlc_version,proto3" json:"sqlc_version,omitempty"` PluginOptions []byte `protobuf:"bytes,5,opt,name=plugin_options,proto3" json:"plugin_options,omitempty"` + GlobalOptions []byte `protobuf:"bytes,6,opt,name=global_options,proto3" json:"global_options,omitempty"` } -func (x *CodeGenRequest) Reset() { - *x = CodeGenRequest{} +func (x *GenerateRequest) Reset() { + *x = GenerateRequest{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[16] + mi := &file_plugin_codegen_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *CodeGenRequest) String() string { +func (x *GenerateRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*CodeGenRequest) ProtoMessage() {} +func (*GenerateRequest) ProtoMessage() {} -func (x *CodeGenRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[16] +func (x *GenerateRequest) ProtoReflect() protoreflect.Message { + mi := &file_plugin_codegen_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1522,47 +1001,54 @@ func (x *CodeGenRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CodeGenRequest.ProtoReflect.Descriptor instead. -func (*CodeGenRequest) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{16} +// Deprecated: Use GenerateRequest.ProtoReflect.Descriptor instead. +func (*GenerateRequest) Descriptor() ([]byte, []int) { + return file_plugin_codegen_proto_rawDescGZIP(), []int{12} } -func (x *CodeGenRequest) GetSettings() *Settings { +func (x *GenerateRequest) GetSettings() *Settings { if x != nil { return x.Settings } return nil } -func (x *CodeGenRequest) GetCatalog() *Catalog { +func (x *GenerateRequest) GetCatalog() *Catalog { if x != nil { return x.Catalog } return nil } -func (x *CodeGenRequest) GetQueries() []*Query { +func (x *GenerateRequest) GetQueries() []*Query { if x != nil { return x.Queries } return nil } -func (x *CodeGenRequest) GetSqlcVersion() string { +func (x *GenerateRequest) GetSqlcVersion() string { if x != nil { return x.SqlcVersion } return "" } -func (x *CodeGenRequest) GetPluginOptions() []byte { +func (x *GenerateRequest) GetPluginOptions() []byte { if x != nil { return x.PluginOptions } return nil } -type CodeGenResponse struct { +func (x *GenerateRequest) GetGlobalOptions() []byte { + if x != nil { + return x.GlobalOptions + } + return nil +} + +type GenerateResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -1570,23 +1056,23 @@ type CodeGenResponse struct { Files []*File `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"` } -func (x *CodeGenResponse) Reset() { - *x = CodeGenResponse{} +func (x *GenerateResponse) Reset() { + *x = GenerateResponse{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[17] + mi := &file_plugin_codegen_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *CodeGenResponse) String() string { +func (x *GenerateResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*CodeGenResponse) ProtoMessage() {} +func (*GenerateResponse) ProtoMessage() {} -func (x *CodeGenResponse) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[17] +func (x *GenerateResponse) ProtoReflect() protoreflect.Message { + mi := &file_plugin_codegen_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1597,18 +1083,120 @@ func (x *CodeGenResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CodeGenResponse.ProtoReflect.Descriptor instead. -func (*CodeGenResponse) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{17} +// Deprecated: Use GenerateResponse.ProtoReflect.Descriptor instead. +func (*GenerateResponse) Descriptor() ([]byte, []int) { + return file_plugin_codegen_proto_rawDescGZIP(), []int{13} } -func (x *CodeGenResponse) GetFiles() []*File { +func (x *GenerateResponse) GetFiles() []*File { if x != nil { return x.Files } return nil } +type Codegen_Process struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Cmd string `protobuf:"bytes,1,opt,name=cmd,proto3" json:"cmd,omitempty"` +} + +func (x *Codegen_Process) Reset() { + *x = Codegen_Process{} + if protoimpl.UnsafeEnabled { + mi := &file_plugin_codegen_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Codegen_Process) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Codegen_Process) ProtoMessage() {} + +func (x *Codegen_Process) ProtoReflect() protoreflect.Message { + mi := &file_plugin_codegen_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Codegen_Process.ProtoReflect.Descriptor instead. +func (*Codegen_Process) Descriptor() ([]byte, []int) { + return file_plugin_codegen_proto_rawDescGZIP(), []int{2, 0} +} + +func (x *Codegen_Process) GetCmd() string { + if x != nil { + return x.Cmd + } + return "" +} + +type Codegen_WASM struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` + Sha256 string `protobuf:"bytes,2,opt,name=sha256,proto3" json:"sha256,omitempty"` +} + +func (x *Codegen_WASM) Reset() { + *x = Codegen_WASM{} + if protoimpl.UnsafeEnabled { + mi := &file_plugin_codegen_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Codegen_WASM) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Codegen_WASM) ProtoMessage() {} + +func (x *Codegen_WASM) ProtoReflect() protoreflect.Message { + mi := &file_plugin_codegen_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Codegen_WASM.ProtoReflect.Descriptor instead. +func (*Codegen_WASM) Descriptor() ([]byte, []int) { + return file_plugin_codegen_proto_rawDescGZIP(), []int{2, 1} +} + +func (x *Codegen_WASM) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *Codegen_WASM) GetSha256() string { + if x != nil { + return x.Sha256 + } + return "" +} + var File_plugin_codegen_proto protoreflect.FileDescriptor var file_plugin_codegen_proto_rawDesc = []byte{ @@ -1617,287 +1205,166 @@ var file_plugin_codegen_proto_rawDesc = []byte{ 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x93, 0x02, 0x0a, 0x08, 0x4f, 0x76, 0x65, 0x72, 0x72, - 0x69, 0x64, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x74, 0x79, 0x70, - 0x65, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x62, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x64, 0x62, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6e, - 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6e, - 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, - 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x12, - 0x28, 0x0a, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, + 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xb7, 0x01, 0x0a, 0x08, 0x53, 0x65, 0x74, 0x74, 0x69, + 0x6e, 0x67, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, + 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x65, + 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x18, 0x0a, + 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, + 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x12, 0x29, 0x0a, 0x07, 0x63, 0x6f, 0x64, 0x65, 0x67, + 0x65, 0x6e, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x64, 0x65, 0x67, + 0x65, 0x6e, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09, 0x4a, 0x04, + 0x08, 0x09, 0x10, 0x0a, 0x4a, 0x04, 0x08, 0x0a, 0x10, 0x0b, 0x4a, 0x04, 0x08, 0x0b, 0x10, 0x0c, + 0x22, 0x8b, 0x02, 0x0a, 0x07, 0x43, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x12, 0x10, 0x0a, 0x03, + 0x6f, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6f, 0x75, 0x74, 0x12, 0x16, + 0x0a, 0x06, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x76, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x65, + 0x6e, 0x76, 0x12, 0x31, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x64, + 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x52, 0x07, 0x70, 0x72, + 0x6f, 0x63, 0x65, 0x73, 0x73, 0x12, 0x28, 0x0a, 0x04, 0x77, 0x61, 0x73, 0x6d, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x64, + 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x57, 0x41, 0x53, 0x4d, 0x52, 0x04, 0x77, 0x61, 0x73, 0x6d, 0x1a, + 0x1b, 0x0a, 0x07, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x6d, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x6d, 0x64, 0x1a, 0x30, 0x0a, 0x04, + 0x57, 0x41, 0x53, 0x4d, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x22, 0x88, + 0x01, 0x0a, 0x07, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, + 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, + 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, + 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x64, 0x65, + 0x66, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x28, 0x0a, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, + 0x52, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x22, 0xc1, 0x01, 0x0a, 0x06, 0x53, 0x63, + 0x68, 0x65, 0x6d, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x25, 0x0a, 0x06, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x54, 0x61, 0x62, 0x6c, + 0x65, 0x52, 0x06, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x05, 0x65, 0x6e, 0x75, + 0x6d, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x05, 0x65, 0x6e, 0x75, 0x6d, 0x73, 0x12, 0x3e, 0x0a, + 0x0f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, + 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0e, 0x63, + 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x73, 0x22, 0x3d, 0x0a, + 0x0d, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x48, 0x0a, 0x04, + 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x76, 0x61, 0x6c, 0x73, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x76, 0x61, 0x6c, 0x73, 0x12, 0x18, 0x0a, 0x07, + 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, + 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x71, 0x0a, 0x05, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, + 0x24, 0x0a, 0x03, 0x72, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, + 0x52, 0x03, 0x72, 0x65, 0x6c, 0x12, 0x28, 0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, + 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, + 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x52, 0x0a, 0x0a, 0x49, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, + 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, + 0x67, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x8e, 0x04, + 0x0a, 0x06, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, + 0x6e, 0x6f, 0x74, 0x5f, 0x6e, 0x75, 0x6c, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, + 0x6e, 0x6f, 0x74, 0x4e, 0x75, 0x6c, 0x6c, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x61, 0x72, + 0x72, 0x61, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x41, 0x72, 0x72, + 0x61, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, + 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6c, 0x65, + 0x6e, 0x67, 0x74, 0x68, 0x12, 0x24, 0x0a, 0x0e, 0x69, 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x64, + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x69, 0x73, + 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x20, 0x0a, 0x0c, 0x69, 0x73, + 0x5f, 0x66, 0x75, 0x6e, 0x63, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x0a, 0x69, 0x73, 0x46, 0x75, 0x6e, 0x63, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x14, 0x0a, 0x05, + 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x6f, + 0x70, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1f, 0x0a, 0x0b, + 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x26, 0x0a, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, + 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x69, 0x73, 0x5f, 0x73, 0x71, 0x6c, 0x63, + 0x5f, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, + 0x53, 0x71, 0x6c, 0x63, 0x53, 0x6c, 0x69, 0x63, 0x65, 0x12, 0x33, 0x0a, 0x0b, 0x65, 0x6d, 0x62, + 0x65, 0x64, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, - 0x65, 0x72, 0x52, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6f, 0x6c, - 0x75, 0x6d, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, - 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2d, 0x0a, 0x07, 0x67, - 0x6f, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, - 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x64, 0x47, 0x6f, 0x54, 0x79, - 0x70, 0x65, 0x52, 0x06, 0x67, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x6e, - 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x75, 0x6e, - 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4a, 0x04, 0x08, 0x09, 0x10, 0x0a, 0x22, 0x8b, 0x02, 0x0a, - 0x0c, 0x50, 0x61, 0x72, 0x73, 0x65, 0x64, 0x47, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, - 0x0b, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0a, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x61, 0x74, 0x68, 0x12, 0x18, - 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x79, 0x70, 0x65, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x79, 0x70, - 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x61, 0x73, 0x69, 0x63, 0x5f, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x62, 0x61, 0x73, 0x69, 0x63, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x45, 0x0a, 0x0b, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x5f, 0x74, - 0x61, 0x67, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x70, 0x6c, 0x75, 0x67, - 0x69, 0x6e, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x64, 0x47, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x2e, - 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x54, 0x61, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, - 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x3d, 0x0a, 0x0f, 0x53, - 0x74, 0x72, 0x75, 0x63, 0x74, 0x54, 0x61, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, - 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, - 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x8c, 0x03, 0x0a, 0x08, 0x53, - 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, - 0x65, 0x6d, 0x61, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, - 0x61, 0x12, 0x18, 0x0a, 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, - 0x28, 0x09, 0x52, 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x12, 0x34, 0x0a, 0x06, 0x72, - 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x6c, - 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x52, 0x65, - 0x6e, 0x61, 0x6d, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x72, 0x65, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x2e, 0x0a, 0x09, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x73, 0x18, 0x06, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x4f, 0x76, - 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x52, 0x09, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, - 0x73, 0x12, 0x29, 0x0a, 0x07, 0x63, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x18, 0x0c, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x64, 0x65, - 0x67, 0x65, 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x12, 0x1e, 0x0a, 0x02, - 0x67, 0x6f, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, - 0x6e, 0x2e, 0x47, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x02, 0x67, 0x6f, 0x12, 0x24, 0x0a, 0x04, - 0x6a, 0x73, 0x6f, 0x6e, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x6c, 0x75, - 0x67, 0x69, 0x6e, 0x2e, 0x4a, 0x53, 0x4f, 0x4e, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6a, 0x73, - 0x6f, 0x6e, 0x1a, 0x39, 0x0a, 0x0b, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x4a, 0x04, 0x08, - 0x08, 0x10, 0x09, 0x4a, 0x04, 0x08, 0x09, 0x10, 0x0a, 0x22, 0x4d, 0x0a, 0x07, 0x43, 0x6f, 0x64, - 0x65, 0x67, 0x65, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6f, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x03, 0x6f, 0x75, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, 0x18, - 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xff, 0x0a, 0x0a, 0x06, 0x47, 0x6f, 0x43, - 0x6f, 0x64, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x66, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x65, 0x6d, 0x69, - 0x74, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x65, 0x6d, - 0x69, 0x74, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x0c, 0x65, 0x6d, 0x69, 0x74, 0x4a, 0x73, 0x6f, 0x6e, 0x54, 0x61, 0x67, 0x73, - 0x12, 0x20, 0x0a, 0x0c, 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x64, 0x62, 0x5f, 0x74, 0x61, 0x67, 0x73, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x65, 0x6d, 0x69, 0x74, 0x44, 0x62, 0x54, 0x61, - 0x67, 0x73, 0x12, 0x32, 0x0a, 0x15, 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x70, 0x72, 0x65, 0x70, 0x61, - 0x72, 0x65, 0x64, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x13, 0x65, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x64, 0x51, - 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x12, 0x33, 0x0a, 0x16, 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x65, - 0x78, 0x61, 0x63, 0x74, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x65, 0x6d, 0x69, 0x74, 0x45, 0x78, 0x61, 0x63, - 0x74, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x65, - 0x6d, 0x69, 0x74, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x5f, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x73, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x65, 0x6d, 0x69, 0x74, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x53, 0x6c, 0x69, 0x63, 0x65, 0x73, 0x12, 0x32, 0x0a, 0x15, 0x65, 0x6d, 0x69, 0x74, 0x5f, - 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x65, 0x6d, 0x69, 0x74, 0x45, 0x78, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x64, 0x51, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x12, 0x3d, 0x0a, 0x1b, 0x65, - 0x6d, 0x69, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x75, 0x63, - 0x74, 0x5f, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x18, 0x65, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x53, 0x74, 0x72, 0x75, - 0x63, 0x74, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x12, 0x3d, 0x0a, 0x1b, 0x65, 0x6d, - 0x69, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, - 0x5f, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x18, 0x65, 0x6d, 0x69, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x53, 0x74, 0x72, 0x75, 0x63, - 0x74, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x12, 0x40, 0x0a, 0x1d, 0x65, 0x6d, 0x69, - 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x64, - 0x62, 0x5f, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x19, 0x65, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x57, 0x69, 0x74, - 0x68, 0x44, 0x62, 0x41, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x2f, 0x0a, 0x14, 0x6a, - 0x73, 0x6f, 0x6e, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x5f, 0x63, 0x61, 0x73, 0x65, 0x5f, 0x73, 0x74, - 0x79, 0x6c, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x6a, 0x73, 0x6f, 0x6e, 0x54, - 0x61, 0x67, 0x73, 0x43, 0x61, 0x73, 0x65, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, - 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, - 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6f, 0x75, 0x74, 0x18, 0x0d, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x6f, 0x75, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x71, 0x6c, 0x5f, - 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, - 0x71, 0x6c, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x71, 0x6c, - 0x5f, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x18, 0x19, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, - 0x71, 0x6c, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x12, 0x2d, 0x0a, 0x13, 0x6f, 0x75, 0x74, 0x70, - 0x75, 0x74, 0x5f, 0x64, 0x62, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x44, 0x62, 0x46, - 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x17, 0x6f, 0x75, 0x74, 0x70, 0x75, - 0x74, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, - 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x46, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x37, - 0x0a, 0x18, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x72, - 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x15, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x51, 0x75, 0x65, 0x72, 0x69, 0x65, 0x72, 0x46, - 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x39, 0x0a, 0x19, 0x6f, 0x75, 0x74, 0x70, 0x75, - 0x74, 0x5f, 0x63, 0x6f, 0x70, 0x79, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x1c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x16, 0x6f, 0x75, 0x74, 0x70, - 0x75, 0x74, 0x43, 0x6f, 0x70, 0x79, 0x66, 0x72, 0x6f, 0x6d, 0x46, 0x69, 0x6c, 0x65, 0x4e, 0x61, - 0x6d, 0x65, 0x12, 0x2e, 0x0a, 0x13, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x66, 0x69, 0x6c, - 0x65, 0x73, 0x5f, 0x73, 0x75, 0x66, 0x66, 0x69, 0x78, 0x18, 0x12, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x11, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x53, 0x75, 0x66, 0x66, - 0x69, 0x78, 0x12, 0x33, 0x0a, 0x16, 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x5f, - 0x76, 0x61, 0x6c, 0x69, 0x64, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x13, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x13, 0x65, 0x6d, 0x69, 0x74, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x69, - 0x64, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x2f, 0x0a, 0x14, 0x65, 0x6d, 0x69, 0x74, 0x5f, - 0x61, 0x6c, 0x6c, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, - 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x65, 0x6d, 0x69, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, - 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x43, 0x0a, 0x1e, 0x69, 0x6e, 0x66, 0x6c, - 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x74, - 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x15, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x1b, 0x69, 0x6e, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x63, 0x6c, - 0x75, 0x64, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x3e, 0x0a, - 0x1c, 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x5f, 0x66, - 0x6f, 0x72, 0x5f, 0x6e, 0x75, 0x6c, 0x6c, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x18, 0x16, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x18, 0x65, 0x6d, 0x69, 0x74, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x65, 0x72, - 0x73, 0x46, 0x6f, 0x72, 0x4e, 0x75, 0x6c, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x73, 0x12, 0x37, 0x0a, - 0x15, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, - 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x17, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x13, - 0x71, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x4c, 0x69, - 0x6d, 0x69, 0x74, 0x88, 0x01, 0x01, 0x12, 0x33, 0x0a, 0x16, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, - 0x5f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x18, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x42, 0x61, - 0x74, 0x63, 0x68, 0x46, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x33, 0x0a, 0x16, 0x6a, - 0x73, 0x6f, 0x6e, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x5f, 0x69, 0x64, 0x5f, 0x75, 0x70, 0x70, 0x65, - 0x72, 0x63, 0x61, 0x73, 0x65, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x6a, 0x73, 0x6f, - 0x6e, 0x54, 0x61, 0x67, 0x73, 0x49, 0x64, 0x55, 0x70, 0x70, 0x65, 0x72, 0x63, 0x61, 0x73, 0x65, - 0x12, 0x2e, 0x0a, 0x13, 0x6f, 0x6d, 0x69, 0x74, 0x5f, 0x75, 0x6e, 0x75, 0x73, 0x65, 0x64, 0x5f, - 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x73, 0x18, 0x1b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x6f, - 0x6d, 0x69, 0x74, 0x55, 0x6e, 0x75, 0x73, 0x65, 0x64, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x73, - 0x42, 0x18, 0x0a, 0x16, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, - 0x65, 0x74, 0x65, 0x72, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x50, 0x0a, 0x08, 0x4a, 0x53, - 0x4f, 0x4e, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6f, 0x75, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x6f, 0x75, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x6e, 0x64, 0x65, - 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x69, 0x6e, 0x64, 0x65, 0x6e, 0x74, - 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x88, 0x01, 0x0a, - 0x07, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, - 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x73, 0x63, - 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x64, 0x65, 0x66, 0x61, - 0x75, 0x6c, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, - 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, - 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x07, - 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x22, 0xc1, 0x01, 0x0a, 0x06, 0x53, 0x63, 0x68, 0x65, - 0x6d, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, + 0x65, 0x72, 0x52, 0x0a, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x23, + 0x0a, 0x0d, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x18, + 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x12, + 0x1d, 0x0a, 0x0a, 0x61, 0x72, 0x72, 0x61, 0x79, 0x5f, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x11, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x09, 0x61, 0x72, 0x72, 0x61, 0x79, 0x44, 0x69, 0x6d, 0x73, 0x22, 0x94, + 0x02, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x25, 0x0a, 0x06, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x0d, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, - 0x06, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x05, 0x65, 0x6e, 0x75, 0x6d, 0x73, - 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, - 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x05, 0x65, 0x6e, 0x75, 0x6d, 0x73, 0x12, 0x3e, 0x0a, 0x0f, 0x63, - 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x18, 0x05, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, - 0x6d, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0e, 0x63, 0x6f, 0x6d, - 0x70, 0x6f, 0x73, 0x69, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x73, 0x22, 0x3d, 0x0a, 0x0d, 0x43, - 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x48, 0x0a, 0x04, 0x45, 0x6e, - 0x75, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x76, 0x61, 0x6c, 0x73, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x76, 0x61, 0x6c, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, - 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, - 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x71, 0x0a, 0x05, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x24, 0x0a, - 0x03, 0x72, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, 0x75, - 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x03, - 0x72, 0x65, 0x6c, 0x12, 0x28, 0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, - 0x6c, 0x75, 0x6d, 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, 0x18, 0x0a, - 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x52, 0x0a, 0x0a, 0x49, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, - 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x8e, 0x04, 0x0a, 0x06, - 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x6f, - 0x74, 0x5f, 0x6e, 0x75, 0x6c, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x6e, 0x6f, - 0x74, 0x4e, 0x75, 0x6c, 0x6c, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x61, 0x72, 0x72, 0x61, - 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x41, 0x72, 0x72, 0x61, 0x79, - 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x12, 0x24, 0x0a, 0x0e, 0x69, 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x64, 0x5f, 0x70, - 0x61, 0x72, 0x61, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x69, 0x73, 0x4e, 0x61, - 0x6d, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x20, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x66, - 0x75, 0x6e, 0x63, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, - 0x69, 0x73, 0x46, 0x75, 0x6e, 0x63, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, - 0x6f, 0x70, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, - 0x12, 0x28, 0x0a, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x12, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, - 0x69, 0x65, 0x72, 0x52, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x61, - 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0a, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x26, 0x0a, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, 0x75, 0x67, - 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x69, 0x73, 0x5f, 0x73, 0x71, 0x6c, 0x63, 0x5f, 0x73, - 0x6c, 0x69, 0x63, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, 0x53, 0x71, - 0x6c, 0x63, 0x53, 0x6c, 0x69, 0x63, 0x65, 0x12, 0x33, 0x0a, 0x0b, 0x65, 0x6d, 0x62, 0x65, 0x64, - 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, - 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, - 0x52, 0x0a, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x23, 0x0a, 0x0d, - 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0f, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x4e, 0x61, 0x6d, - 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x18, 0x10, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x08, 0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x12, 0x1d, 0x0a, - 0x0a, 0x61, 0x72, 0x72, 0x61, 0x79, 0x5f, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x09, 0x61, 0x72, 0x72, 0x61, 0x79, 0x44, 0x69, 0x6d, 0x73, 0x22, 0x94, 0x02, 0x0a, - 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, - 0x0a, 0x03, 0x63, 0x6d, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x6d, 0x64, - 0x12, 0x28, 0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, - 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, 0x2d, 0x0a, 0x06, 0x70, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x6c, 0x75, - 0x67, 0x69, 0x6e, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x0a, 0x70, - 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6d, - 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6d, - 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x40, 0x0a, 0x11, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x5f, 0x69, 0x6e, 0x74, 0x6f, - 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, - 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, - 0x52, 0x11, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x5f, 0x69, 0x6e, 0x74, 0x6f, 0x5f, 0x74, 0x61, - 0x62, 0x6c, 0x65, 0x22, 0x4b, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, - 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x26, 0x0a, 0x06, 0x63, 0x6f, 0x6c, 0x75, - 0x6d, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, - 0x6e, 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x52, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, - 0x22, 0xde, 0x01, 0x0a, 0x0e, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x53, - 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, - 0x73, 0x12, 0x29, 0x0a, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x61, 0x74, 0x61, - 0x6c, 0x6f, 0x67, 0x52, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x27, 0x0a, 0x07, - 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, - 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x07, 0x71, 0x75, - 0x65, 0x72, 0x69, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x71, 0x6c, 0x63, 0x5f, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x71, 0x6c, - 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0e, 0x70, 0x6c, 0x75, - 0x67, 0x69, 0x6e, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x0e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x22, 0x35, 0x0a, 0x0f, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x46, 0x69, 0x6c, - 0x65, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x42, 0x7c, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, - 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x42, 0x0c, 0x43, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x73, 0x71, 0x6c, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x73, 0x71, 0x6c, 0x63, - 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, - 0xa2, 0x02, 0x03, 0x50, 0x58, 0x58, 0xaa, 0x02, 0x06, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0xca, - 0x02, 0x06, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0xe2, 0x02, 0x12, 0x50, 0x6c, 0x75, 0x67, 0x69, - 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x06, - 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x12, 0x10, 0x0a, 0x03, 0x63, 0x6d, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, + 0x6d, 0x64, 0x12, 0x28, 0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x04, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x6c, + 0x75, 0x6d, 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, 0x2d, 0x0a, 0x06, + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, + 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, + 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, + 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x40, 0x0a, 0x11, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x5f, 0x69, 0x6e, + 0x74, 0x6f, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, + 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, + 0x65, 0x72, 0x52, 0x11, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x5f, 0x69, 0x6e, 0x74, 0x6f, 0x5f, + 0x74, 0x61, 0x62, 0x6c, 0x65, 0x22, 0x4b, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, + 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x26, 0x0a, 0x06, 0x63, 0x6f, + 0x6c, 0x75, 0x6d, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x52, 0x06, 0x63, 0x6f, 0x6c, 0x75, + 0x6d, 0x6e, 0x22, 0x87, 0x02, 0x0a, 0x0f, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, + 0x67, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x08, 0x73, 0x65, 0x74, 0x74, + 0x69, 0x6e, 0x67, 0x73, 0x12, 0x29, 0x0a, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, + 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, + 0x27, 0x0a, 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x0d, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, + 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x71, 0x6c, 0x63, + 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, + 0x73, 0x71, 0x6c, 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0e, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x26, 0x0a, 0x0e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x5f, 0x6f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x67, 0x6c, + 0x6f, 0x62, 0x61, 0x6c, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x36, 0x0a, 0x10, + 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x22, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x0c, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x05, 0x66, + 0x69, 0x6c, 0x65, 0x73, 0x32, 0x4f, 0x0a, 0x0e, 0x43, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3d, 0x0a, 0x08, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, + 0x74, 0x65, 0x12, 0x17, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x47, 0x65, 0x6e, 0x65, + 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x6c, + 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x7c, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x42, 0x0c, 0x43, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x73, 0x71, 0x6c, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x73, 0x71, 0x6c, 0x63, 0x2f, 0x69, 0x6e, + 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0xa2, 0x02, 0x03, + 0x50, 0x58, 0x58, 0xaa, 0x02, 0x06, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0xca, 0x02, 0x06, 0x50, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0xe2, 0x02, 0x12, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x06, 0x50, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1912,60 +1379,53 @@ func file_plugin_codegen_proto_rawDescGZIP() []byte { return file_plugin_codegen_proto_rawDescData } -var file_plugin_codegen_proto_msgTypes = make([]protoimpl.MessageInfo, 20) +var file_plugin_codegen_proto_msgTypes = make([]protoimpl.MessageInfo, 16) var file_plugin_codegen_proto_goTypes = []interface{}{ - (*File)(nil), // 0: plugin.File - (*Override)(nil), // 1: plugin.Override - (*ParsedGoType)(nil), // 2: plugin.ParsedGoType - (*Settings)(nil), // 3: plugin.Settings - (*Codegen)(nil), // 4: plugin.Codegen - (*GoCode)(nil), // 5: plugin.GoCode - (*JSONCode)(nil), // 6: plugin.JSONCode - (*Catalog)(nil), // 7: plugin.Catalog - (*Schema)(nil), // 8: plugin.Schema - (*CompositeType)(nil), // 9: plugin.CompositeType - (*Enum)(nil), // 10: plugin.Enum - (*Table)(nil), // 11: plugin.Table - (*Identifier)(nil), // 12: plugin.Identifier - (*Column)(nil), // 13: plugin.Column - (*Query)(nil), // 14: plugin.Query - (*Parameter)(nil), // 15: plugin.Parameter - (*CodeGenRequest)(nil), // 16: plugin.CodeGenRequest - (*CodeGenResponse)(nil), // 17: plugin.CodeGenResponse - nil, // 18: plugin.ParsedGoType.StructTagsEntry - nil, // 19: plugin.Settings.RenameEntry + (*File)(nil), // 0: plugin.File + (*Settings)(nil), // 1: plugin.Settings + (*Codegen)(nil), // 2: plugin.Codegen + (*Catalog)(nil), // 3: plugin.Catalog + (*Schema)(nil), // 4: plugin.Schema + (*CompositeType)(nil), // 5: plugin.CompositeType + (*Enum)(nil), // 6: plugin.Enum + (*Table)(nil), // 7: plugin.Table + (*Identifier)(nil), // 8: plugin.Identifier + (*Column)(nil), // 9: plugin.Column + (*Query)(nil), // 10: plugin.Query + (*Parameter)(nil), // 11: plugin.Parameter + (*GenerateRequest)(nil), // 12: plugin.GenerateRequest + (*GenerateResponse)(nil), // 13: plugin.GenerateResponse + (*Codegen_Process)(nil), // 14: plugin.Codegen.Process + (*Codegen_WASM)(nil), // 15: plugin.Codegen.WASM } var file_plugin_codegen_proto_depIdxs = []int32{ - 12, // 0: plugin.Override.table:type_name -> plugin.Identifier - 2, // 1: plugin.Override.go_type:type_name -> plugin.ParsedGoType - 18, // 2: plugin.ParsedGoType.struct_tags:type_name -> plugin.ParsedGoType.StructTagsEntry - 19, // 3: plugin.Settings.rename:type_name -> plugin.Settings.RenameEntry - 1, // 4: plugin.Settings.overrides:type_name -> plugin.Override - 4, // 5: plugin.Settings.codegen:type_name -> plugin.Codegen - 5, // 6: plugin.Settings.go:type_name -> plugin.GoCode - 6, // 7: plugin.Settings.json:type_name -> plugin.JSONCode - 8, // 8: plugin.Catalog.schemas:type_name -> plugin.Schema - 11, // 9: plugin.Schema.tables:type_name -> plugin.Table - 10, // 10: plugin.Schema.enums:type_name -> plugin.Enum - 9, // 11: plugin.Schema.composite_types:type_name -> plugin.CompositeType - 12, // 12: plugin.Table.rel:type_name -> plugin.Identifier - 13, // 13: plugin.Table.columns:type_name -> plugin.Column - 12, // 14: plugin.Column.table:type_name -> plugin.Identifier - 12, // 15: plugin.Column.type:type_name -> plugin.Identifier - 12, // 16: plugin.Column.embed_table:type_name -> plugin.Identifier - 13, // 17: plugin.Query.columns:type_name -> plugin.Column - 15, // 18: plugin.Query.params:type_name -> plugin.Parameter - 12, // 19: plugin.Query.insert_into_table:type_name -> plugin.Identifier - 13, // 20: plugin.Parameter.column:type_name -> plugin.Column - 3, // 21: plugin.CodeGenRequest.settings:type_name -> plugin.Settings - 7, // 22: plugin.CodeGenRequest.catalog:type_name -> plugin.Catalog - 14, // 23: plugin.CodeGenRequest.queries:type_name -> plugin.Query - 0, // 24: plugin.CodeGenResponse.files:type_name -> plugin.File - 25, // [25:25] is the sub-list for method output_type - 25, // [25:25] is the sub-list for method input_type - 25, // [25:25] is the sub-list for extension type_name - 25, // [25:25] is the sub-list for extension extendee - 0, // [0:25] is the sub-list for field type_name + 2, // 0: plugin.Settings.codegen:type_name -> plugin.Codegen + 14, // 1: plugin.Codegen.process:type_name -> plugin.Codegen.Process + 15, // 2: plugin.Codegen.wasm:type_name -> plugin.Codegen.WASM + 4, // 3: plugin.Catalog.schemas:type_name -> plugin.Schema + 7, // 4: plugin.Schema.tables:type_name -> plugin.Table + 6, // 5: plugin.Schema.enums:type_name -> plugin.Enum + 5, // 6: plugin.Schema.composite_types:type_name -> plugin.CompositeType + 8, // 7: plugin.Table.rel:type_name -> plugin.Identifier + 9, // 8: plugin.Table.columns:type_name -> plugin.Column + 8, // 9: plugin.Column.table:type_name -> plugin.Identifier + 8, // 10: plugin.Column.type:type_name -> plugin.Identifier + 8, // 11: plugin.Column.embed_table:type_name -> plugin.Identifier + 9, // 12: plugin.Query.columns:type_name -> plugin.Column + 11, // 13: plugin.Query.params:type_name -> plugin.Parameter + 8, // 14: plugin.Query.insert_into_table:type_name -> plugin.Identifier + 9, // 15: plugin.Parameter.column:type_name -> plugin.Column + 1, // 16: plugin.GenerateRequest.settings:type_name -> plugin.Settings + 3, // 17: plugin.GenerateRequest.catalog:type_name -> plugin.Catalog + 10, // 18: plugin.GenerateRequest.queries:type_name -> plugin.Query + 0, // 19: plugin.GenerateResponse.files:type_name -> plugin.File + 12, // 20: plugin.CodegenService.Generate:input_type -> plugin.GenerateRequest + 13, // 21: plugin.CodegenService.Generate:output_type -> plugin.GenerateResponse + 21, // [21:22] is the sub-list for method output_type + 20, // [20:21] is the sub-list for method input_type + 20, // [20:20] is the sub-list for extension type_name + 20, // [20:20] is the sub-list for extension extendee + 0, // [0:20] is the sub-list for field type_name } func init() { file_plugin_codegen_proto_init() } @@ -1987,7 +1447,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Override); i { + switch v := v.(*Settings); i { case 0: return &v.state case 1: @@ -1999,7 +1459,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ParsedGoType); i { + switch v := v.(*Codegen); i { case 0: return &v.state case 1: @@ -2011,7 +1471,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Settings); i { + switch v := v.(*Catalog); i { case 0: return &v.state case 1: @@ -2023,7 +1483,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Codegen); i { + switch v := v.(*Schema); i { case 0: return &v.state case 1: @@ -2035,7 +1495,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GoCode); i { + switch v := v.(*CompositeType); i { case 0: return &v.state case 1: @@ -2047,7 +1507,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*JSONCode); i { + switch v := v.(*Enum); i { case 0: return &v.state case 1: @@ -2059,7 +1519,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Catalog); i { + switch v := v.(*Table); i { case 0: return &v.state case 1: @@ -2071,7 +1531,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Schema); i { + switch v := v.(*Identifier); i { case 0: return &v.state case 1: @@ -2083,7 +1543,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CompositeType); i { + switch v := v.(*Column); i { case 0: return &v.state case 1: @@ -2095,7 +1555,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Enum); i { + switch v := v.(*Query); i { case 0: return &v.state case 1: @@ -2107,7 +1567,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Table); i { + switch v := v.(*Parameter); i { case 0: return &v.state case 1: @@ -2119,7 +1579,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Identifier); i { + switch v := v.(*GenerateRequest); i { case 0: return &v.state case 1: @@ -2131,7 +1591,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Column); i { + switch v := v.(*GenerateResponse); i { case 0: return &v.state case 1: @@ -2143,7 +1603,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Query); i { + switch v := v.(*Codegen_Process); i { case 0: return &v.state case 1: @@ -2155,31 +1615,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Parameter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_codegen_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CodeGenRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_codegen_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CodeGenResponse); i { + switch v := v.(*Codegen_WASM); i { case 0: return &v.state case 1: @@ -2191,16 +1627,15 @@ func file_plugin_codegen_proto_init() { } } } - file_plugin_codegen_proto_msgTypes[5].OneofWrappers = []interface{}{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_plugin_codegen_proto_rawDesc, NumEnums: 0, - NumMessages: 20, + NumMessages: 16, NumExtensions: 0, - NumServices: 0, + NumServices: 1, }, GoTypes: file_plugin_codegen_proto_goTypes, DependencyIndexes: file_plugin_codegen_proto_depIdxs, diff --git a/internal/plugin/codegen_grpc.pb.go b/internal/plugin/codegen_grpc.pb.go new file mode 100644 index 0000000000..30287ac457 --- /dev/null +++ b/internal/plugin/codegen_grpc.pb.go @@ -0,0 +1,109 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: plugin/codegen.proto + +package plugin + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + CodegenService_Generate_FullMethodName = "/plugin.CodegenService/Generate" +) + +// CodegenServiceClient is the client API for CodegenService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type CodegenServiceClient interface { + Generate(ctx context.Context, in *GenerateRequest, opts ...grpc.CallOption) (*GenerateResponse, error) +} + +type codegenServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewCodegenServiceClient(cc grpc.ClientConnInterface) CodegenServiceClient { + return &codegenServiceClient{cc} +} + +func (c *codegenServiceClient) Generate(ctx context.Context, in *GenerateRequest, opts ...grpc.CallOption) (*GenerateResponse, error) { + out := new(GenerateResponse) + err := c.cc.Invoke(ctx, CodegenService_Generate_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// CodegenServiceServer is the server API for CodegenService service. +// All implementations must embed UnimplementedCodegenServiceServer +// for forward compatibility +type CodegenServiceServer interface { + Generate(context.Context, *GenerateRequest) (*GenerateResponse, error) + mustEmbedUnimplementedCodegenServiceServer() +} + +// UnimplementedCodegenServiceServer must be embedded to have forward compatible implementations. +type UnimplementedCodegenServiceServer struct { +} + +func (UnimplementedCodegenServiceServer) Generate(context.Context, *GenerateRequest) (*GenerateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Generate not implemented") +} +func (UnimplementedCodegenServiceServer) mustEmbedUnimplementedCodegenServiceServer() {} + +// UnsafeCodegenServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to CodegenServiceServer will +// result in compilation errors. +type UnsafeCodegenServiceServer interface { + mustEmbedUnimplementedCodegenServiceServer() +} + +func RegisterCodegenServiceServer(s grpc.ServiceRegistrar, srv CodegenServiceServer) { + s.RegisterService(&CodegenService_ServiceDesc, srv) +} + +func _CodegenService_Generate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GenerateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CodegenServiceServer).Generate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: CodegenService_Generate_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CodegenServiceServer).Generate(ctx, req.(*GenerateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// CodegenService_ServiceDesc is the grpc.ServiceDesc for CodegenService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var CodegenService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "plugin.CodegenService", + HandlerType: (*CodegenServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Generate", + Handler: _CodegenService_Generate_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "plugin/codegen.proto", +} diff --git a/internal/plugin/codegen_vtproto.pb.go b/internal/plugin/codegen_vtproto.pb.go deleted file mode 100644 index 3af9b35d15..0000000000 --- a/internal/plugin/codegen_vtproto.pb.go +++ /dev/null @@ -1,9610 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.4.0 -// source: plugin/codegen.proto - -package plugin - -import ( - fmt "fmt" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - io "io" - bits "math/bits" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -func (m *File) CloneVT() *File { - if m == nil { - return (*File)(nil) - } - r := &File{ - Name: m.Name, - } - if rhs := m.Contents; rhs != nil { - tmpBytes := make([]byte, len(rhs)) - copy(tmpBytes, rhs) - r.Contents = tmpBytes - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *File) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Override) CloneVT() *Override { - if m == nil { - return (*Override)(nil) - } - r := &Override{ - CodeType: m.CodeType, - DbType: m.DbType, - Nullable: m.Nullable, - Column: m.Column, - Table: m.Table.CloneVT(), - ColumnName: m.ColumnName, - GoType: m.GoType.CloneVT(), - Unsigned: m.Unsigned, - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Override) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *ParsedGoType) CloneVT() *ParsedGoType { - if m == nil { - return (*ParsedGoType)(nil) - } - r := &ParsedGoType{ - ImportPath: m.ImportPath, - Package: m.Package, - TypeName: m.TypeName, - BasicType: m.BasicType, - } - if rhs := m.StructTags; rhs != nil { - tmpContainer := make(map[string]string, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v - } - r.StructTags = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *ParsedGoType) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Settings) CloneVT() *Settings { - if m == nil { - return (*Settings)(nil) - } - r := &Settings{ - Version: m.Version, - Engine: m.Engine, - Codegen: m.Codegen.CloneVT(), - Go: m.Go.CloneVT(), - Json: m.Json.CloneVT(), - } - if rhs := m.Schema; rhs != nil { - tmpContainer := make([]string, len(rhs)) - copy(tmpContainer, rhs) - r.Schema = tmpContainer - } - if rhs := m.Queries; rhs != nil { - tmpContainer := make([]string, len(rhs)) - copy(tmpContainer, rhs) - r.Queries = tmpContainer - } - if rhs := m.Rename; rhs != nil { - tmpContainer := make(map[string]string, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v - } - r.Rename = tmpContainer - } - if rhs := m.Overrides; rhs != nil { - tmpContainer := make([]*Override, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Overrides = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Settings) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Codegen) CloneVT() *Codegen { - if m == nil { - return (*Codegen)(nil) - } - r := &Codegen{ - Out: m.Out, - Plugin: m.Plugin, - } - if rhs := m.Options; rhs != nil { - tmpBytes := make([]byte, len(rhs)) - copy(tmpBytes, rhs) - r.Options = tmpBytes - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Codegen) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *GoCode) CloneVT() *GoCode { - if m == nil { - return (*GoCode)(nil) - } - r := &GoCode{ - EmitInterface: m.EmitInterface, - EmitJsonTags: m.EmitJsonTags, - EmitDbTags: m.EmitDbTags, - EmitPreparedQueries: m.EmitPreparedQueries, - EmitExactTableNames: m.EmitExactTableNames, - EmitEmptySlices: m.EmitEmptySlices, - EmitExportedQueries: m.EmitExportedQueries, - EmitResultStructPointers: m.EmitResultStructPointers, - EmitParamsStructPointers: m.EmitParamsStructPointers, - EmitMethodsWithDbArgument: m.EmitMethodsWithDbArgument, - JsonTagsCaseStyle: m.JsonTagsCaseStyle, - Package: m.Package, - Out: m.Out, - SqlPackage: m.SqlPackage, - SqlDriver: m.SqlDriver, - OutputDbFileName: m.OutputDbFileName, - OutputModelsFileName: m.OutputModelsFileName, - OutputQuerierFileName: m.OutputQuerierFileName, - OutputCopyfromFileName: m.OutputCopyfromFileName, - OutputFilesSuffix: m.OutputFilesSuffix, - EmitEnumValidMethod: m.EmitEnumValidMethod, - EmitAllEnumValues: m.EmitAllEnumValues, - EmitPointersForNullTypes: m.EmitPointersForNullTypes, - OutputBatchFileName: m.OutputBatchFileName, - JsonTagsIdUppercase: m.JsonTagsIdUppercase, - OmitUnusedStructs: m.OmitUnusedStructs, - } - if rhs := m.InflectionExcludeTableNames; rhs != nil { - tmpContainer := make([]string, len(rhs)) - copy(tmpContainer, rhs) - r.InflectionExcludeTableNames = tmpContainer - } - if rhs := m.QueryParameterLimit; rhs != nil { - tmpVal := *rhs - r.QueryParameterLimit = &tmpVal - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *GoCode) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *JSONCode) CloneVT() *JSONCode { - if m == nil { - return (*JSONCode)(nil) - } - r := &JSONCode{ - Out: m.Out, - Indent: m.Indent, - Filename: m.Filename, - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *JSONCode) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Catalog) CloneVT() *Catalog { - if m == nil { - return (*Catalog)(nil) - } - r := &Catalog{ - Comment: m.Comment, - DefaultSchema: m.DefaultSchema, - Name: m.Name, - } - if rhs := m.Schemas; rhs != nil { - tmpContainer := make([]*Schema, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Schemas = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Catalog) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Schema) CloneVT() *Schema { - if m == nil { - return (*Schema)(nil) - } - r := &Schema{ - Comment: m.Comment, - Name: m.Name, - } - if rhs := m.Tables; rhs != nil { - tmpContainer := make([]*Table, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Tables = tmpContainer - } - if rhs := m.Enums; rhs != nil { - tmpContainer := make([]*Enum, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Enums = tmpContainer - } - if rhs := m.CompositeTypes; rhs != nil { - tmpContainer := make([]*CompositeType, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.CompositeTypes = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Schema) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *CompositeType) CloneVT() *CompositeType { - if m == nil { - return (*CompositeType)(nil) - } - r := &CompositeType{ - Name: m.Name, - Comment: m.Comment, - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *CompositeType) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Enum) CloneVT() *Enum { - if m == nil { - return (*Enum)(nil) - } - r := &Enum{ - Name: m.Name, - Comment: m.Comment, - } - if rhs := m.Vals; rhs != nil { - tmpContainer := make([]string, len(rhs)) - copy(tmpContainer, rhs) - r.Vals = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Enum) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Table) CloneVT() *Table { - if m == nil { - return (*Table)(nil) - } - r := &Table{ - Rel: m.Rel.CloneVT(), - Comment: m.Comment, - } - if rhs := m.Columns; rhs != nil { - tmpContainer := make([]*Column, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Columns = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Table) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Identifier) CloneVT() *Identifier { - if m == nil { - return (*Identifier)(nil) - } - r := &Identifier{ - Catalog: m.Catalog, - Schema: m.Schema, - Name: m.Name, - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Identifier) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Column) CloneVT() *Column { - if m == nil { - return (*Column)(nil) - } - r := &Column{ - Name: m.Name, - NotNull: m.NotNull, - IsArray: m.IsArray, - Comment: m.Comment, - Length: m.Length, - IsNamedParam: m.IsNamedParam, - IsFuncCall: m.IsFuncCall, - Scope: m.Scope, - Table: m.Table.CloneVT(), - TableAlias: m.TableAlias, - Type: m.Type.CloneVT(), - IsSqlcSlice: m.IsSqlcSlice, - EmbedTable: m.EmbedTable.CloneVT(), - OriginalName: m.OriginalName, - Unsigned: m.Unsigned, - ArrayDims: m.ArrayDims, - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Column) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Query) CloneVT() *Query { - if m == nil { - return (*Query)(nil) - } - r := &Query{ - Text: m.Text, - Name: m.Name, - Cmd: m.Cmd, - Filename: m.Filename, - InsertIntoTable: m.InsertIntoTable.CloneVT(), - } - if rhs := m.Columns; rhs != nil { - tmpContainer := make([]*Column, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Columns = tmpContainer - } - if rhs := m.Params; rhs != nil { - tmpContainer := make([]*Parameter, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Params = tmpContainer - } - if rhs := m.Comments; rhs != nil { - tmpContainer := make([]string, len(rhs)) - copy(tmpContainer, rhs) - r.Comments = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Query) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Parameter) CloneVT() *Parameter { - if m == nil { - return (*Parameter)(nil) - } - r := &Parameter{ - Number: m.Number, - Column: m.Column.CloneVT(), - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Parameter) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *CodeGenRequest) CloneVT() *CodeGenRequest { - if m == nil { - return (*CodeGenRequest)(nil) - } - r := &CodeGenRequest{ - Settings: m.Settings.CloneVT(), - Catalog: m.Catalog.CloneVT(), - SqlcVersion: m.SqlcVersion, - } - if rhs := m.Queries; rhs != nil { - tmpContainer := make([]*Query, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Queries = tmpContainer - } - if rhs := m.PluginOptions; rhs != nil { - tmpBytes := make([]byte, len(rhs)) - copy(tmpBytes, rhs) - r.PluginOptions = tmpBytes - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *CodeGenRequest) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *CodeGenResponse) CloneVT() *CodeGenResponse { - if m == nil { - return (*CodeGenResponse)(nil) - } - r := &CodeGenResponse{} - if rhs := m.Files; rhs != nil { - tmpContainer := make([]*File, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Files = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *CodeGenResponse) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *File) EqualVT(that *File) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Name != that.Name { - return false - } - if string(this.Contents) != string(that.Contents) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *File) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*File) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Override) EqualVT(that *Override) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.CodeType != that.CodeType { - return false - } - if this.DbType != that.DbType { - return false - } - if this.Nullable != that.Nullable { - return false - } - if this.Column != that.Column { - return false - } - if !this.Table.EqualVT(that.Table) { - return false - } - if this.ColumnName != that.ColumnName { - return false - } - if !this.GoType.EqualVT(that.GoType) { - return false - } - if this.Unsigned != that.Unsigned { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Override) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Override) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *ParsedGoType) EqualVT(that *ParsedGoType) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.ImportPath != that.ImportPath { - return false - } - if this.Package != that.Package { - return false - } - if this.TypeName != that.TypeName { - return false - } - if this.BasicType != that.BasicType { - return false - } - if len(this.StructTags) != len(that.StructTags) { - return false - } - for i, vx := range this.StructTags { - vy, ok := that.StructTags[i] - if !ok { - return false - } - if vx != vy { - return false - } - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *ParsedGoType) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*ParsedGoType) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Settings) EqualVT(that *Settings) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Version != that.Version { - return false - } - if this.Engine != that.Engine { - return false - } - if len(this.Schema) != len(that.Schema) { - return false - } - for i, vx := range this.Schema { - vy := that.Schema[i] - if vx != vy { - return false - } - } - if len(this.Queries) != len(that.Queries) { - return false - } - for i, vx := range this.Queries { - vy := that.Queries[i] - if vx != vy { - return false - } - } - if len(this.Rename) != len(that.Rename) { - return false - } - for i, vx := range this.Rename { - vy, ok := that.Rename[i] - if !ok { - return false - } - if vx != vy { - return false - } - } - if len(this.Overrides) != len(that.Overrides) { - return false - } - for i, vx := range this.Overrides { - vy := that.Overrides[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Override{} - } - if q == nil { - q = &Override{} - } - if !p.EqualVT(q) { - return false - } - } - } - if !this.Go.EqualVT(that.Go) { - return false - } - if !this.Json.EqualVT(that.Json) { - return false - } - if !this.Codegen.EqualVT(that.Codegen) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Settings) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Settings) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Codegen) EqualVT(that *Codegen) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Out != that.Out { - return false - } - if this.Plugin != that.Plugin { - return false - } - if string(this.Options) != string(that.Options) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Codegen) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Codegen) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *GoCode) EqualVT(that *GoCode) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.EmitInterface != that.EmitInterface { - return false - } - if this.EmitJsonTags != that.EmitJsonTags { - return false - } - if this.EmitDbTags != that.EmitDbTags { - return false - } - if this.EmitPreparedQueries != that.EmitPreparedQueries { - return false - } - if this.EmitExactTableNames != that.EmitExactTableNames { - return false - } - if this.EmitEmptySlices != that.EmitEmptySlices { - return false - } - if this.EmitExportedQueries != that.EmitExportedQueries { - return false - } - if this.EmitResultStructPointers != that.EmitResultStructPointers { - return false - } - if this.EmitParamsStructPointers != that.EmitParamsStructPointers { - return false - } - if this.EmitMethodsWithDbArgument != that.EmitMethodsWithDbArgument { - return false - } - if this.JsonTagsCaseStyle != that.JsonTagsCaseStyle { - return false - } - if this.Package != that.Package { - return false - } - if this.Out != that.Out { - return false - } - if this.SqlPackage != that.SqlPackage { - return false - } - if this.OutputDbFileName != that.OutputDbFileName { - return false - } - if this.OutputModelsFileName != that.OutputModelsFileName { - return false - } - if this.OutputQuerierFileName != that.OutputQuerierFileName { - return false - } - if this.OutputFilesSuffix != that.OutputFilesSuffix { - return false - } - if this.EmitEnumValidMethod != that.EmitEnumValidMethod { - return false - } - if this.EmitAllEnumValues != that.EmitAllEnumValues { - return false - } - if len(this.InflectionExcludeTableNames) != len(that.InflectionExcludeTableNames) { - return false - } - for i, vx := range this.InflectionExcludeTableNames { - vy := that.InflectionExcludeTableNames[i] - if vx != vy { - return false - } - } - if this.EmitPointersForNullTypes != that.EmitPointersForNullTypes { - return false - } - if p, q := this.QueryParameterLimit, that.QueryParameterLimit; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { - return false - } - if this.OutputBatchFileName != that.OutputBatchFileName { - return false - } - if this.SqlDriver != that.SqlDriver { - return false - } - if this.JsonTagsIdUppercase != that.JsonTagsIdUppercase { - return false - } - if this.OmitUnusedStructs != that.OmitUnusedStructs { - return false - } - if this.OutputCopyfromFileName != that.OutputCopyfromFileName { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *GoCode) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*GoCode) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *JSONCode) EqualVT(that *JSONCode) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Out != that.Out { - return false - } - if this.Indent != that.Indent { - return false - } - if this.Filename != that.Filename { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *JSONCode) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*JSONCode) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Catalog) EqualVT(that *Catalog) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Comment != that.Comment { - return false - } - if this.DefaultSchema != that.DefaultSchema { - return false - } - if this.Name != that.Name { - return false - } - if len(this.Schemas) != len(that.Schemas) { - return false - } - for i, vx := range this.Schemas { - vy := that.Schemas[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Schema{} - } - if q == nil { - q = &Schema{} - } - if !p.EqualVT(q) { - return false - } - } - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Catalog) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Catalog) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Schema) EqualVT(that *Schema) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Comment != that.Comment { - return false - } - if this.Name != that.Name { - return false - } - if len(this.Tables) != len(that.Tables) { - return false - } - for i, vx := range this.Tables { - vy := that.Tables[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Table{} - } - if q == nil { - q = &Table{} - } - if !p.EqualVT(q) { - return false - } - } - } - if len(this.Enums) != len(that.Enums) { - return false - } - for i, vx := range this.Enums { - vy := that.Enums[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Enum{} - } - if q == nil { - q = &Enum{} - } - if !p.EqualVT(q) { - return false - } - } - } - if len(this.CompositeTypes) != len(that.CompositeTypes) { - return false - } - for i, vx := range this.CompositeTypes { - vy := that.CompositeTypes[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &CompositeType{} - } - if q == nil { - q = &CompositeType{} - } - if !p.EqualVT(q) { - return false - } - } - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Schema) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Schema) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *CompositeType) EqualVT(that *CompositeType) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Name != that.Name { - return false - } - if this.Comment != that.Comment { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *CompositeType) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*CompositeType) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Enum) EqualVT(that *Enum) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Name != that.Name { - return false - } - if len(this.Vals) != len(that.Vals) { - return false - } - for i, vx := range this.Vals { - vy := that.Vals[i] - if vx != vy { - return false - } - } - if this.Comment != that.Comment { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Enum) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Enum) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Table) EqualVT(that *Table) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if !this.Rel.EqualVT(that.Rel) { - return false - } - if len(this.Columns) != len(that.Columns) { - return false - } - for i, vx := range this.Columns { - vy := that.Columns[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Column{} - } - if q == nil { - q = &Column{} - } - if !p.EqualVT(q) { - return false - } - } - } - if this.Comment != that.Comment { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Table) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Table) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Identifier) EqualVT(that *Identifier) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Catalog != that.Catalog { - return false - } - if this.Schema != that.Schema { - return false - } - if this.Name != that.Name { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Identifier) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Identifier) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Column) EqualVT(that *Column) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Name != that.Name { - return false - } - if this.NotNull != that.NotNull { - return false - } - if this.IsArray != that.IsArray { - return false - } - if this.Comment != that.Comment { - return false - } - if this.Length != that.Length { - return false - } - if this.IsNamedParam != that.IsNamedParam { - return false - } - if this.IsFuncCall != that.IsFuncCall { - return false - } - if this.Scope != that.Scope { - return false - } - if !this.Table.EqualVT(that.Table) { - return false - } - if this.TableAlias != that.TableAlias { - return false - } - if !this.Type.EqualVT(that.Type) { - return false - } - if this.IsSqlcSlice != that.IsSqlcSlice { - return false - } - if !this.EmbedTable.EqualVT(that.EmbedTable) { - return false - } - if this.OriginalName != that.OriginalName { - return false - } - if this.Unsigned != that.Unsigned { - return false - } - if this.ArrayDims != that.ArrayDims { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Column) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Column) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Query) EqualVT(that *Query) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Text != that.Text { - return false - } - if this.Name != that.Name { - return false - } - if this.Cmd != that.Cmd { - return false - } - if len(this.Columns) != len(that.Columns) { - return false - } - for i, vx := range this.Columns { - vy := that.Columns[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Column{} - } - if q == nil { - q = &Column{} - } - if !p.EqualVT(q) { - return false - } - } - } - if len(this.Params) != len(that.Params) { - return false - } - for i, vx := range this.Params { - vy := that.Params[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Parameter{} - } - if q == nil { - q = &Parameter{} - } - if !p.EqualVT(q) { - return false - } - } - } - if len(this.Comments) != len(that.Comments) { - return false - } - for i, vx := range this.Comments { - vy := that.Comments[i] - if vx != vy { - return false - } - } - if this.Filename != that.Filename { - return false - } - if !this.InsertIntoTable.EqualVT(that.InsertIntoTable) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Query) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Query) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Parameter) EqualVT(that *Parameter) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Number != that.Number { - return false - } - if !this.Column.EqualVT(that.Column) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Parameter) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Parameter) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *CodeGenRequest) EqualVT(that *CodeGenRequest) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if !this.Settings.EqualVT(that.Settings) { - return false - } - if !this.Catalog.EqualVT(that.Catalog) { - return false - } - if len(this.Queries) != len(that.Queries) { - return false - } - for i, vx := range this.Queries { - vy := that.Queries[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Query{} - } - if q == nil { - q = &Query{} - } - if !p.EqualVT(q) { - return false - } - } - } - if this.SqlcVersion != that.SqlcVersion { - return false - } - if string(this.PluginOptions) != string(that.PluginOptions) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *CodeGenRequest) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*CodeGenRequest) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *CodeGenResponse) EqualVT(that *CodeGenResponse) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if len(this.Files) != len(that.Files) { - return false - } - for i, vx := range this.Files { - vy := that.Files[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &File{} - } - if q == nil { - q = &File{} - } - if !p.EqualVT(q) { - return false - } - } - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *CodeGenResponse) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*CodeGenResponse) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *File) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *File) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *File) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Contents) > 0 { - i -= len(m.Contents) - copy(dAtA[i:], m.Contents) - i = encodeVarint(dAtA, i, uint64(len(m.Contents))) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Override) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Override) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Override) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Unsigned { - i-- - if m.Unsigned { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x58 - } - if m.GoType != nil { - size, err := m.GoType.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x52 - } - if len(m.ColumnName) > 0 { - i -= len(m.ColumnName) - copy(dAtA[i:], m.ColumnName) - i = encodeVarint(dAtA, i, uint64(len(m.ColumnName))) - i-- - dAtA[i] = 0x42 - } - if m.Table != nil { - size, err := m.Table.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x3a - } - if len(m.Column) > 0 { - i -= len(m.Column) - copy(dAtA[i:], m.Column) - i = encodeVarint(dAtA, i, uint64(len(m.Column))) - i-- - dAtA[i] = 0x32 - } - if m.Nullable { - i-- - if m.Nullable { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x28 - } - if len(m.DbType) > 0 { - i -= len(m.DbType) - copy(dAtA[i:], m.DbType) - i = encodeVarint(dAtA, i, uint64(len(m.DbType))) - i-- - dAtA[i] = 0x1a - } - if len(m.CodeType) > 0 { - i -= len(m.CodeType) - copy(dAtA[i:], m.CodeType) - i = encodeVarint(dAtA, i, uint64(len(m.CodeType))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ParsedGoType) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ParsedGoType) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *ParsedGoType) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.StructTags) > 0 { - for k := range m.StructTags { - v := m.StructTags[k] - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarint(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarint(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarint(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x2a - } - } - if m.BasicType { - i-- - if m.BasicType { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if len(m.TypeName) > 0 { - i -= len(m.TypeName) - copy(dAtA[i:], m.TypeName) - i = encodeVarint(dAtA, i, uint64(len(m.TypeName))) - i-- - dAtA[i] = 0x1a - } - if len(m.Package) > 0 { - i -= len(m.Package) - copy(dAtA[i:], m.Package) - i = encodeVarint(dAtA, i, uint64(len(m.Package))) - i-- - dAtA[i] = 0x12 - } - if len(m.ImportPath) > 0 { - i -= len(m.ImportPath) - copy(dAtA[i:], m.ImportPath) - i = encodeVarint(dAtA, i, uint64(len(m.ImportPath))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Settings) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Settings) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Settings) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Codegen != nil { - size, err := m.Codegen.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x62 - } - if m.Json != nil { - size, err := m.Json.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x5a - } - if m.Go != nil { - size, err := m.Go.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x52 - } - if len(m.Overrides) > 0 { - for iNdEx := len(m.Overrides) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Overrides[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x32 - } - } - if len(m.Rename) > 0 { - for k := range m.Rename { - v := m.Rename[k] - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarint(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarint(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarint(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x2a - } - } - if len(m.Queries) > 0 { - for iNdEx := len(m.Queries) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Queries[iNdEx]) - copy(dAtA[i:], m.Queries[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.Queries[iNdEx]))) - i-- - dAtA[i] = 0x22 - } - } - if len(m.Schema) > 0 { - for iNdEx := len(m.Schema) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Schema[iNdEx]) - copy(dAtA[i:], m.Schema[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.Schema[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if len(m.Engine) > 0 { - i -= len(m.Engine) - copy(dAtA[i:], m.Engine) - i = encodeVarint(dAtA, i, uint64(len(m.Engine))) - i-- - dAtA[i] = 0x12 - } - if len(m.Version) > 0 { - i -= len(m.Version) - copy(dAtA[i:], m.Version) - i = encodeVarint(dAtA, i, uint64(len(m.Version))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Codegen) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Codegen) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Codegen) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Options) > 0 { - i -= len(m.Options) - copy(dAtA[i:], m.Options) - i = encodeVarint(dAtA, i, uint64(len(m.Options))) - i-- - dAtA[i] = 0x1a - } - if len(m.Plugin) > 0 { - i -= len(m.Plugin) - copy(dAtA[i:], m.Plugin) - i = encodeVarint(dAtA, i, uint64(len(m.Plugin))) - i-- - dAtA[i] = 0x12 - } - if len(m.Out) > 0 { - i -= len(m.Out) - copy(dAtA[i:], m.Out) - i = encodeVarint(dAtA, i, uint64(len(m.Out))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *GoCode) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GoCode) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *GoCode) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.OutputCopyfromFileName) > 0 { - i -= len(m.OutputCopyfromFileName) - copy(dAtA[i:], m.OutputCopyfromFileName) - i = encodeVarint(dAtA, i, uint64(len(m.OutputCopyfromFileName))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xe2 - } - if m.OmitUnusedStructs { - i-- - if m.OmitUnusedStructs { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xd8 - } - if m.JsonTagsIdUppercase { - i-- - if m.JsonTagsIdUppercase { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xd0 - } - if len(m.SqlDriver) > 0 { - i -= len(m.SqlDriver) - copy(dAtA[i:], m.SqlDriver) - i = encodeVarint(dAtA, i, uint64(len(m.SqlDriver))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xca - } - if len(m.OutputBatchFileName) > 0 { - i -= len(m.OutputBatchFileName) - copy(dAtA[i:], m.OutputBatchFileName) - i = encodeVarint(dAtA, i, uint64(len(m.OutputBatchFileName))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xc2 - } - if m.QueryParameterLimit != nil { - i = encodeVarint(dAtA, i, uint64(*m.QueryParameterLimit)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xb8 - } - if m.EmitPointersForNullTypes { - i-- - if m.EmitPointersForNullTypes { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xb0 - } - if len(m.InflectionExcludeTableNames) > 0 { - for iNdEx := len(m.InflectionExcludeTableNames) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.InflectionExcludeTableNames[iNdEx]) - copy(dAtA[i:], m.InflectionExcludeTableNames[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.InflectionExcludeTableNames[iNdEx]))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xaa - } - } - if m.EmitAllEnumValues { - i-- - if m.EmitAllEnumValues { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xa0 - } - if m.EmitEnumValidMethod { - i-- - if m.EmitEnumValidMethod { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x98 - } - if len(m.OutputFilesSuffix) > 0 { - i -= len(m.OutputFilesSuffix) - copy(dAtA[i:], m.OutputFilesSuffix) - i = encodeVarint(dAtA, i, uint64(len(m.OutputFilesSuffix))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x92 - } - if len(m.OutputQuerierFileName) > 0 { - i -= len(m.OutputQuerierFileName) - copy(dAtA[i:], m.OutputQuerierFileName) - i = encodeVarint(dAtA, i, uint64(len(m.OutputQuerierFileName))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x8a - } - if len(m.OutputModelsFileName) > 0 { - i -= len(m.OutputModelsFileName) - copy(dAtA[i:], m.OutputModelsFileName) - i = encodeVarint(dAtA, i, uint64(len(m.OutputModelsFileName))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x82 - } - if len(m.OutputDbFileName) > 0 { - i -= len(m.OutputDbFileName) - copy(dAtA[i:], m.OutputDbFileName) - i = encodeVarint(dAtA, i, uint64(len(m.OutputDbFileName))) - i-- - dAtA[i] = 0x7a - } - if len(m.SqlPackage) > 0 { - i -= len(m.SqlPackage) - copy(dAtA[i:], m.SqlPackage) - i = encodeVarint(dAtA, i, uint64(len(m.SqlPackage))) - i-- - dAtA[i] = 0x72 - } - if len(m.Out) > 0 { - i -= len(m.Out) - copy(dAtA[i:], m.Out) - i = encodeVarint(dAtA, i, uint64(len(m.Out))) - i-- - dAtA[i] = 0x6a - } - if len(m.Package) > 0 { - i -= len(m.Package) - copy(dAtA[i:], m.Package) - i = encodeVarint(dAtA, i, uint64(len(m.Package))) - i-- - dAtA[i] = 0x62 - } - if len(m.JsonTagsCaseStyle) > 0 { - i -= len(m.JsonTagsCaseStyle) - copy(dAtA[i:], m.JsonTagsCaseStyle) - i = encodeVarint(dAtA, i, uint64(len(m.JsonTagsCaseStyle))) - i-- - dAtA[i] = 0x5a - } - if m.EmitMethodsWithDbArgument { - i-- - if m.EmitMethodsWithDbArgument { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x50 - } - if m.EmitParamsStructPointers { - i-- - if m.EmitParamsStructPointers { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x48 - } - if m.EmitResultStructPointers { - i-- - if m.EmitResultStructPointers { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x40 - } - if m.EmitExportedQueries { - i-- - if m.EmitExportedQueries { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x38 - } - if m.EmitEmptySlices { - i-- - if m.EmitEmptySlices { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x30 - } - if m.EmitExactTableNames { - i-- - if m.EmitExactTableNames { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x28 - } - if m.EmitPreparedQueries { - i-- - if m.EmitPreparedQueries { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if m.EmitDbTags { - i-- - if m.EmitDbTags { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if m.EmitJsonTags { - i-- - if m.EmitJsonTags { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if m.EmitInterface { - i-- - if m.EmitInterface { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *JSONCode) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *JSONCode) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *JSONCode) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Filename) > 0 { - i -= len(m.Filename) - copy(dAtA[i:], m.Filename) - i = encodeVarint(dAtA, i, uint64(len(m.Filename))) - i-- - dAtA[i] = 0x1a - } - if len(m.Indent) > 0 { - i -= len(m.Indent) - copy(dAtA[i:], m.Indent) - i = encodeVarint(dAtA, i, uint64(len(m.Indent))) - i-- - dAtA[i] = 0x12 - } - if len(m.Out) > 0 { - i -= len(m.Out) - copy(dAtA[i:], m.Out) - i = encodeVarint(dAtA, i, uint64(len(m.Out))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Catalog) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Catalog) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Catalog) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Schemas) > 0 { - for iNdEx := len(m.Schemas) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Schemas[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x1a - } - if len(m.DefaultSchema) > 0 { - i -= len(m.DefaultSchema) - copy(dAtA[i:], m.DefaultSchema) - i = encodeVarint(dAtA, i, uint64(len(m.DefaultSchema))) - i-- - dAtA[i] = 0x12 - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Schema) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Schema) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Schema) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.CompositeTypes) > 0 { - for iNdEx := len(m.CompositeTypes) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.CompositeTypes[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x2a - } - } - if len(m.Enums) > 0 { - for iNdEx := len(m.Enums) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Enums[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - } - if len(m.Tables) > 0 { - for iNdEx := len(m.Tables) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Tables[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CompositeType) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CompositeType) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *CompositeType) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Enum) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Enum) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Enum) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0x1a - } - if len(m.Vals) > 0 { - for iNdEx := len(m.Vals) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Vals[iNdEx]) - copy(dAtA[i:], m.Vals[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.Vals[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Table) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Table) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Table) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0x1a - } - if len(m.Columns) > 0 { - for iNdEx := len(m.Columns) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Columns[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - } - if m.Rel != nil { - size, err := m.Rel.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Identifier) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Identifier) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Identifier) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x1a - } - if len(m.Schema) > 0 { - i -= len(m.Schema) - copy(dAtA[i:], m.Schema) - i = encodeVarint(dAtA, i, uint64(len(m.Schema))) - i-- - dAtA[i] = 0x12 - } - if len(m.Catalog) > 0 { - i -= len(m.Catalog) - copy(dAtA[i:], m.Catalog) - i = encodeVarint(dAtA, i, uint64(len(m.Catalog))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Column) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Column) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Column) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.ArrayDims != 0 { - i = encodeVarint(dAtA, i, uint64(m.ArrayDims)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x88 - } - if m.Unsigned { - i-- - if m.Unsigned { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x80 - } - if len(m.OriginalName) > 0 { - i -= len(m.OriginalName) - copy(dAtA[i:], m.OriginalName) - i = encodeVarint(dAtA, i, uint64(len(m.OriginalName))) - i-- - dAtA[i] = 0x7a - } - if m.EmbedTable != nil { - size, err := m.EmbedTable.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x72 - } - if m.IsSqlcSlice { - i-- - if m.IsSqlcSlice { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x68 - } - if m.Type != nil { - size, err := m.Type.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x62 - } - if len(m.TableAlias) > 0 { - i -= len(m.TableAlias) - copy(dAtA[i:], m.TableAlias) - i = encodeVarint(dAtA, i, uint64(len(m.TableAlias))) - i-- - dAtA[i] = 0x5a - } - if m.Table != nil { - size, err := m.Table.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x52 - } - if len(m.Scope) > 0 { - i -= len(m.Scope) - copy(dAtA[i:], m.Scope) - i = encodeVarint(dAtA, i, uint64(len(m.Scope))) - i-- - dAtA[i] = 0x4a - } - if m.IsFuncCall { - i-- - if m.IsFuncCall { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x40 - } - if m.IsNamedParam { - i-- - if m.IsNamedParam { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x38 - } - if m.Length != 0 { - i = encodeVarint(dAtA, i, uint64(m.Length)) - i-- - dAtA[i] = 0x30 - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0x2a - } - if m.IsArray { - i-- - if m.IsArray { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if m.NotNull { - i-- - if m.NotNull { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Query) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Query) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Query) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.InsertIntoTable != nil { - size, err := m.InsertIntoTable.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x42 - } - if len(m.Filename) > 0 { - i -= len(m.Filename) - copy(dAtA[i:], m.Filename) - i = encodeVarint(dAtA, i, uint64(len(m.Filename))) - i-- - dAtA[i] = 0x3a - } - if len(m.Comments) > 0 { - for iNdEx := len(m.Comments) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Comments[iNdEx]) - copy(dAtA[i:], m.Comments[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.Comments[iNdEx]))) - i-- - dAtA[i] = 0x32 - } - } - if len(m.Params) > 0 { - for iNdEx := len(m.Params) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Params[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x2a - } - } - if len(m.Columns) > 0 { - for iNdEx := len(m.Columns) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Columns[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - } - if len(m.Cmd) > 0 { - i -= len(m.Cmd) - copy(dAtA[i:], m.Cmd) - i = encodeVarint(dAtA, i, uint64(len(m.Cmd))) - i-- - dAtA[i] = 0x1a - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - } - if len(m.Text) > 0 { - i -= len(m.Text) - copy(dAtA[i:], m.Text) - i = encodeVarint(dAtA, i, uint64(len(m.Text))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Parameter) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Parameter) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Parameter) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Column != nil { - size, err := m.Column.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - if m.Number != 0 { - i = encodeVarint(dAtA, i, uint64(m.Number)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *CodeGenRequest) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CodeGenRequest) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *CodeGenRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.PluginOptions) > 0 { - i -= len(m.PluginOptions) - copy(dAtA[i:], m.PluginOptions) - i = encodeVarint(dAtA, i, uint64(len(m.PluginOptions))) - i-- - dAtA[i] = 0x2a - } - if len(m.SqlcVersion) > 0 { - i -= len(m.SqlcVersion) - copy(dAtA[i:], m.SqlcVersion) - i = encodeVarint(dAtA, i, uint64(len(m.SqlcVersion))) - i-- - dAtA[i] = 0x22 - } - if len(m.Queries) > 0 { - for iNdEx := len(m.Queries) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Queries[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - } - if m.Catalog != nil { - size, err := m.Catalog.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - if m.Settings != nil { - size, err := m.Settings.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CodeGenResponse) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CodeGenResponse) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *CodeGenResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Files) > 0 { - for iNdEx := len(m.Files) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Files[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func encodeVarint(dAtA []byte, offset int, v uint64) int { - offset -= sov(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *File) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *File) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *File) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Contents) > 0 { - i -= len(m.Contents) - copy(dAtA[i:], m.Contents) - i = encodeVarint(dAtA, i, uint64(len(m.Contents))) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Override) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Override) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Override) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Unsigned { - i-- - if m.Unsigned { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x58 - } - if m.GoType != nil { - size, err := m.GoType.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x52 - } - if len(m.ColumnName) > 0 { - i -= len(m.ColumnName) - copy(dAtA[i:], m.ColumnName) - i = encodeVarint(dAtA, i, uint64(len(m.ColumnName))) - i-- - dAtA[i] = 0x42 - } - if m.Table != nil { - size, err := m.Table.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x3a - } - if len(m.Column) > 0 { - i -= len(m.Column) - copy(dAtA[i:], m.Column) - i = encodeVarint(dAtA, i, uint64(len(m.Column))) - i-- - dAtA[i] = 0x32 - } - if m.Nullable { - i-- - if m.Nullable { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x28 - } - if len(m.DbType) > 0 { - i -= len(m.DbType) - copy(dAtA[i:], m.DbType) - i = encodeVarint(dAtA, i, uint64(len(m.DbType))) - i-- - dAtA[i] = 0x1a - } - if len(m.CodeType) > 0 { - i -= len(m.CodeType) - copy(dAtA[i:], m.CodeType) - i = encodeVarint(dAtA, i, uint64(len(m.CodeType))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ParsedGoType) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ParsedGoType) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ParsedGoType) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.StructTags) > 0 { - for k := range m.StructTags { - v := m.StructTags[k] - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarint(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarint(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarint(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x2a - } - } - if m.BasicType { - i-- - if m.BasicType { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if len(m.TypeName) > 0 { - i -= len(m.TypeName) - copy(dAtA[i:], m.TypeName) - i = encodeVarint(dAtA, i, uint64(len(m.TypeName))) - i-- - dAtA[i] = 0x1a - } - if len(m.Package) > 0 { - i -= len(m.Package) - copy(dAtA[i:], m.Package) - i = encodeVarint(dAtA, i, uint64(len(m.Package))) - i-- - dAtA[i] = 0x12 - } - if len(m.ImportPath) > 0 { - i -= len(m.ImportPath) - copy(dAtA[i:], m.ImportPath) - i = encodeVarint(dAtA, i, uint64(len(m.ImportPath))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Settings) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Settings) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Settings) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Codegen != nil { - size, err := m.Codegen.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x62 - } - if m.Json != nil { - size, err := m.Json.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x5a - } - if m.Go != nil { - size, err := m.Go.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x52 - } - if len(m.Overrides) > 0 { - for iNdEx := len(m.Overrides) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Overrides[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x32 - } - } - if len(m.Rename) > 0 { - for k := range m.Rename { - v := m.Rename[k] - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarint(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarint(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarint(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x2a - } - } - if len(m.Queries) > 0 { - for iNdEx := len(m.Queries) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Queries[iNdEx]) - copy(dAtA[i:], m.Queries[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.Queries[iNdEx]))) - i-- - dAtA[i] = 0x22 - } - } - if len(m.Schema) > 0 { - for iNdEx := len(m.Schema) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Schema[iNdEx]) - copy(dAtA[i:], m.Schema[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.Schema[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if len(m.Engine) > 0 { - i -= len(m.Engine) - copy(dAtA[i:], m.Engine) - i = encodeVarint(dAtA, i, uint64(len(m.Engine))) - i-- - dAtA[i] = 0x12 - } - if len(m.Version) > 0 { - i -= len(m.Version) - copy(dAtA[i:], m.Version) - i = encodeVarint(dAtA, i, uint64(len(m.Version))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Codegen) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Codegen) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Codegen) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Options) > 0 { - i -= len(m.Options) - copy(dAtA[i:], m.Options) - i = encodeVarint(dAtA, i, uint64(len(m.Options))) - i-- - dAtA[i] = 0x1a - } - if len(m.Plugin) > 0 { - i -= len(m.Plugin) - copy(dAtA[i:], m.Plugin) - i = encodeVarint(dAtA, i, uint64(len(m.Plugin))) - i-- - dAtA[i] = 0x12 - } - if len(m.Out) > 0 { - i -= len(m.Out) - copy(dAtA[i:], m.Out) - i = encodeVarint(dAtA, i, uint64(len(m.Out))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *GoCode) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GoCode) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *GoCode) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.OutputCopyfromFileName) > 0 { - i -= len(m.OutputCopyfromFileName) - copy(dAtA[i:], m.OutputCopyfromFileName) - i = encodeVarint(dAtA, i, uint64(len(m.OutputCopyfromFileName))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xe2 - } - if m.OmitUnusedStructs { - i-- - if m.OmitUnusedStructs { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xd8 - } - if m.JsonTagsIdUppercase { - i-- - if m.JsonTagsIdUppercase { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xd0 - } - if len(m.SqlDriver) > 0 { - i -= len(m.SqlDriver) - copy(dAtA[i:], m.SqlDriver) - i = encodeVarint(dAtA, i, uint64(len(m.SqlDriver))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xca - } - if len(m.OutputBatchFileName) > 0 { - i -= len(m.OutputBatchFileName) - copy(dAtA[i:], m.OutputBatchFileName) - i = encodeVarint(dAtA, i, uint64(len(m.OutputBatchFileName))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xc2 - } - if m.QueryParameterLimit != nil { - i = encodeVarint(dAtA, i, uint64(*m.QueryParameterLimit)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xb8 - } - if m.EmitPointersForNullTypes { - i-- - if m.EmitPointersForNullTypes { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xb0 - } - if len(m.InflectionExcludeTableNames) > 0 { - for iNdEx := len(m.InflectionExcludeTableNames) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.InflectionExcludeTableNames[iNdEx]) - copy(dAtA[i:], m.InflectionExcludeTableNames[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.InflectionExcludeTableNames[iNdEx]))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xaa - } - } - if m.EmitAllEnumValues { - i-- - if m.EmitAllEnumValues { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xa0 - } - if m.EmitEnumValidMethod { - i-- - if m.EmitEnumValidMethod { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x98 - } - if len(m.OutputFilesSuffix) > 0 { - i -= len(m.OutputFilesSuffix) - copy(dAtA[i:], m.OutputFilesSuffix) - i = encodeVarint(dAtA, i, uint64(len(m.OutputFilesSuffix))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x92 - } - if len(m.OutputQuerierFileName) > 0 { - i -= len(m.OutputQuerierFileName) - copy(dAtA[i:], m.OutputQuerierFileName) - i = encodeVarint(dAtA, i, uint64(len(m.OutputQuerierFileName))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x8a - } - if len(m.OutputModelsFileName) > 0 { - i -= len(m.OutputModelsFileName) - copy(dAtA[i:], m.OutputModelsFileName) - i = encodeVarint(dAtA, i, uint64(len(m.OutputModelsFileName))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x82 - } - if len(m.OutputDbFileName) > 0 { - i -= len(m.OutputDbFileName) - copy(dAtA[i:], m.OutputDbFileName) - i = encodeVarint(dAtA, i, uint64(len(m.OutputDbFileName))) - i-- - dAtA[i] = 0x7a - } - if len(m.SqlPackage) > 0 { - i -= len(m.SqlPackage) - copy(dAtA[i:], m.SqlPackage) - i = encodeVarint(dAtA, i, uint64(len(m.SqlPackage))) - i-- - dAtA[i] = 0x72 - } - if len(m.Out) > 0 { - i -= len(m.Out) - copy(dAtA[i:], m.Out) - i = encodeVarint(dAtA, i, uint64(len(m.Out))) - i-- - dAtA[i] = 0x6a - } - if len(m.Package) > 0 { - i -= len(m.Package) - copy(dAtA[i:], m.Package) - i = encodeVarint(dAtA, i, uint64(len(m.Package))) - i-- - dAtA[i] = 0x62 - } - if len(m.JsonTagsCaseStyle) > 0 { - i -= len(m.JsonTagsCaseStyle) - copy(dAtA[i:], m.JsonTagsCaseStyle) - i = encodeVarint(dAtA, i, uint64(len(m.JsonTagsCaseStyle))) - i-- - dAtA[i] = 0x5a - } - if m.EmitMethodsWithDbArgument { - i-- - if m.EmitMethodsWithDbArgument { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x50 - } - if m.EmitParamsStructPointers { - i-- - if m.EmitParamsStructPointers { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x48 - } - if m.EmitResultStructPointers { - i-- - if m.EmitResultStructPointers { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x40 - } - if m.EmitExportedQueries { - i-- - if m.EmitExportedQueries { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x38 - } - if m.EmitEmptySlices { - i-- - if m.EmitEmptySlices { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x30 - } - if m.EmitExactTableNames { - i-- - if m.EmitExactTableNames { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x28 - } - if m.EmitPreparedQueries { - i-- - if m.EmitPreparedQueries { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if m.EmitDbTags { - i-- - if m.EmitDbTags { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if m.EmitJsonTags { - i-- - if m.EmitJsonTags { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if m.EmitInterface { - i-- - if m.EmitInterface { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *JSONCode) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *JSONCode) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *JSONCode) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Filename) > 0 { - i -= len(m.Filename) - copy(dAtA[i:], m.Filename) - i = encodeVarint(dAtA, i, uint64(len(m.Filename))) - i-- - dAtA[i] = 0x1a - } - if len(m.Indent) > 0 { - i -= len(m.Indent) - copy(dAtA[i:], m.Indent) - i = encodeVarint(dAtA, i, uint64(len(m.Indent))) - i-- - dAtA[i] = 0x12 - } - if len(m.Out) > 0 { - i -= len(m.Out) - copy(dAtA[i:], m.Out) - i = encodeVarint(dAtA, i, uint64(len(m.Out))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Catalog) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Catalog) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Catalog) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Schemas) > 0 { - for iNdEx := len(m.Schemas) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Schemas[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x1a - } - if len(m.DefaultSchema) > 0 { - i -= len(m.DefaultSchema) - copy(dAtA[i:], m.DefaultSchema) - i = encodeVarint(dAtA, i, uint64(len(m.DefaultSchema))) - i-- - dAtA[i] = 0x12 - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Schema) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Schema) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Schema) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.CompositeTypes) > 0 { - for iNdEx := len(m.CompositeTypes) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.CompositeTypes[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x2a - } - } - if len(m.Enums) > 0 { - for iNdEx := len(m.Enums) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Enums[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - } - if len(m.Tables) > 0 { - for iNdEx := len(m.Tables) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Tables[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CompositeType) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CompositeType) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *CompositeType) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Enum) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Enum) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Enum) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0x1a - } - if len(m.Vals) > 0 { - for iNdEx := len(m.Vals) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Vals[iNdEx]) - copy(dAtA[i:], m.Vals[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.Vals[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Table) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Table) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Table) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0x1a - } - if len(m.Columns) > 0 { - for iNdEx := len(m.Columns) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Columns[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - } - if m.Rel != nil { - size, err := m.Rel.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Identifier) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Identifier) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Identifier) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x1a - } - if len(m.Schema) > 0 { - i -= len(m.Schema) - copy(dAtA[i:], m.Schema) - i = encodeVarint(dAtA, i, uint64(len(m.Schema))) - i-- - dAtA[i] = 0x12 - } - if len(m.Catalog) > 0 { - i -= len(m.Catalog) - copy(dAtA[i:], m.Catalog) - i = encodeVarint(dAtA, i, uint64(len(m.Catalog))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Column) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Column) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Column) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.ArrayDims != 0 { - i = encodeVarint(dAtA, i, uint64(m.ArrayDims)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x88 - } - if m.Unsigned { - i-- - if m.Unsigned { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x80 - } - if len(m.OriginalName) > 0 { - i -= len(m.OriginalName) - copy(dAtA[i:], m.OriginalName) - i = encodeVarint(dAtA, i, uint64(len(m.OriginalName))) - i-- - dAtA[i] = 0x7a - } - if m.EmbedTable != nil { - size, err := m.EmbedTable.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x72 - } - if m.IsSqlcSlice { - i-- - if m.IsSqlcSlice { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x68 - } - if m.Type != nil { - size, err := m.Type.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x62 - } - if len(m.TableAlias) > 0 { - i -= len(m.TableAlias) - copy(dAtA[i:], m.TableAlias) - i = encodeVarint(dAtA, i, uint64(len(m.TableAlias))) - i-- - dAtA[i] = 0x5a - } - if m.Table != nil { - size, err := m.Table.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x52 - } - if len(m.Scope) > 0 { - i -= len(m.Scope) - copy(dAtA[i:], m.Scope) - i = encodeVarint(dAtA, i, uint64(len(m.Scope))) - i-- - dAtA[i] = 0x4a - } - if m.IsFuncCall { - i-- - if m.IsFuncCall { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x40 - } - if m.IsNamedParam { - i-- - if m.IsNamedParam { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x38 - } - if m.Length != 0 { - i = encodeVarint(dAtA, i, uint64(m.Length)) - i-- - dAtA[i] = 0x30 - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0x2a - } - if m.IsArray { - i-- - if m.IsArray { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if m.NotNull { - i-- - if m.NotNull { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Query) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Query) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Query) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.InsertIntoTable != nil { - size, err := m.InsertIntoTable.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x42 - } - if len(m.Filename) > 0 { - i -= len(m.Filename) - copy(dAtA[i:], m.Filename) - i = encodeVarint(dAtA, i, uint64(len(m.Filename))) - i-- - dAtA[i] = 0x3a - } - if len(m.Comments) > 0 { - for iNdEx := len(m.Comments) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Comments[iNdEx]) - copy(dAtA[i:], m.Comments[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.Comments[iNdEx]))) - i-- - dAtA[i] = 0x32 - } - } - if len(m.Params) > 0 { - for iNdEx := len(m.Params) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Params[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x2a - } - } - if len(m.Columns) > 0 { - for iNdEx := len(m.Columns) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Columns[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - } - if len(m.Cmd) > 0 { - i -= len(m.Cmd) - copy(dAtA[i:], m.Cmd) - i = encodeVarint(dAtA, i, uint64(len(m.Cmd))) - i-- - dAtA[i] = 0x1a - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - } - if len(m.Text) > 0 { - i -= len(m.Text) - copy(dAtA[i:], m.Text) - i = encodeVarint(dAtA, i, uint64(len(m.Text))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Parameter) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Parameter) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Parameter) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Column != nil { - size, err := m.Column.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - if m.Number != 0 { - i = encodeVarint(dAtA, i, uint64(m.Number)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *CodeGenRequest) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CodeGenRequest) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *CodeGenRequest) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.PluginOptions) > 0 { - i -= len(m.PluginOptions) - copy(dAtA[i:], m.PluginOptions) - i = encodeVarint(dAtA, i, uint64(len(m.PluginOptions))) - i-- - dAtA[i] = 0x2a - } - if len(m.SqlcVersion) > 0 { - i -= len(m.SqlcVersion) - copy(dAtA[i:], m.SqlcVersion) - i = encodeVarint(dAtA, i, uint64(len(m.SqlcVersion))) - i-- - dAtA[i] = 0x22 - } - if len(m.Queries) > 0 { - for iNdEx := len(m.Queries) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Queries[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - } - if m.Catalog != nil { - size, err := m.Catalog.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - if m.Settings != nil { - size, err := m.Settings.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CodeGenResponse) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CodeGenResponse) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *CodeGenResponse) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Files) > 0 { - for iNdEx := len(m.Files) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Files[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *File) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Contents) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Override) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.CodeType) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.DbType) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if m.Nullable { - n += 2 - } - l = len(m.Column) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if m.Table != nil { - l = m.Table.SizeVT() - n += 1 + l + sov(uint64(l)) - } - l = len(m.ColumnName) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if m.GoType != nil { - l = m.GoType.SizeVT() - n += 1 + l + sov(uint64(l)) - } - if m.Unsigned { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *ParsedGoType) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ImportPath) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Package) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.TypeName) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if m.BasicType { - n += 2 - } - if len(m.StructTags) > 0 { - for k, v := range m.StructTags { - _ = k - _ = v - mapEntrySize := 1 + len(k) + sov(uint64(len(k))) + 1 + len(v) + sov(uint64(len(v))) - n += mapEntrySize + 1 + sov(uint64(mapEntrySize)) - } - } - n += len(m.unknownFields) - return n -} - -func (m *Settings) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Version) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Engine) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if len(m.Schema) > 0 { - for _, s := range m.Schema { - l = len(s) - n += 1 + l + sov(uint64(l)) - } - } - if len(m.Queries) > 0 { - for _, s := range m.Queries { - l = len(s) - n += 1 + l + sov(uint64(l)) - } - } - if len(m.Rename) > 0 { - for k, v := range m.Rename { - _ = k - _ = v - mapEntrySize := 1 + len(k) + sov(uint64(len(k))) + 1 + len(v) + sov(uint64(len(v))) - n += mapEntrySize + 1 + sov(uint64(mapEntrySize)) - } - } - if len(m.Overrides) > 0 { - for _, e := range m.Overrides { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } - if m.Go != nil { - l = m.Go.SizeVT() - n += 1 + l + sov(uint64(l)) - } - if m.Json != nil { - l = m.Json.SizeVT() - n += 1 + l + sov(uint64(l)) - } - if m.Codegen != nil { - l = m.Codegen.SizeVT() - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Codegen) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Out) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Plugin) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Options) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *GoCode) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.EmitInterface { - n += 2 - } - if m.EmitJsonTags { - n += 2 - } - if m.EmitDbTags { - n += 2 - } - if m.EmitPreparedQueries { - n += 2 - } - if m.EmitExactTableNames { - n += 2 - } - if m.EmitEmptySlices { - n += 2 - } - if m.EmitExportedQueries { - n += 2 - } - if m.EmitResultStructPointers { - n += 2 - } - if m.EmitParamsStructPointers { - n += 2 - } - if m.EmitMethodsWithDbArgument { - n += 2 - } - l = len(m.JsonTagsCaseStyle) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Package) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Out) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.SqlPackage) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.OutputDbFileName) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.OutputModelsFileName) - if l > 0 { - n += 2 + l + sov(uint64(l)) - } - l = len(m.OutputQuerierFileName) - if l > 0 { - n += 2 + l + sov(uint64(l)) - } - l = len(m.OutputFilesSuffix) - if l > 0 { - n += 2 + l + sov(uint64(l)) - } - if m.EmitEnumValidMethod { - n += 3 - } - if m.EmitAllEnumValues { - n += 3 - } - if len(m.InflectionExcludeTableNames) > 0 { - for _, s := range m.InflectionExcludeTableNames { - l = len(s) - n += 2 + l + sov(uint64(l)) - } - } - if m.EmitPointersForNullTypes { - n += 3 - } - if m.QueryParameterLimit != nil { - n += 2 + sov(uint64(*m.QueryParameterLimit)) - } - l = len(m.OutputBatchFileName) - if l > 0 { - n += 2 + l + sov(uint64(l)) - } - l = len(m.SqlDriver) - if l > 0 { - n += 2 + l + sov(uint64(l)) - } - if m.JsonTagsIdUppercase { - n += 3 - } - if m.OmitUnusedStructs { - n += 3 - } - l = len(m.OutputCopyfromFileName) - if l > 0 { - n += 2 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *JSONCode) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Out) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Indent) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Filename) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Catalog) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Comment) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.DefaultSchema) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if len(m.Schemas) > 0 { - for _, e := range m.Schemas { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } - n += len(m.unknownFields) - return n -} - -func (m *Schema) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Comment) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if len(m.Tables) > 0 { - for _, e := range m.Tables { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } - if len(m.Enums) > 0 { - for _, e := range m.Enums { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } - if len(m.CompositeTypes) > 0 { - for _, e := range m.CompositeTypes { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } - n += len(m.unknownFields) - return n -} - -func (m *CompositeType) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Comment) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Enum) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if len(m.Vals) > 0 { - for _, s := range m.Vals { - l = len(s) - n += 1 + l + sov(uint64(l)) - } - } - l = len(m.Comment) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Table) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Rel != nil { - l = m.Rel.SizeVT() - n += 1 + l + sov(uint64(l)) - } - if len(m.Columns) > 0 { - for _, e := range m.Columns { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } - l = len(m.Comment) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Identifier) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Catalog) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Schema) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Column) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if m.NotNull { - n += 2 - } - if m.IsArray { - n += 2 - } - l = len(m.Comment) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if m.Length != 0 { - n += 1 + sov(uint64(m.Length)) - } - if m.IsNamedParam { - n += 2 - } - if m.IsFuncCall { - n += 2 - } - l = len(m.Scope) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if m.Table != nil { - l = m.Table.SizeVT() - n += 1 + l + sov(uint64(l)) - } - l = len(m.TableAlias) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if m.Type != nil { - l = m.Type.SizeVT() - n += 1 + l + sov(uint64(l)) - } - if m.IsSqlcSlice { - n += 2 - } - if m.EmbedTable != nil { - l = m.EmbedTable.SizeVT() - n += 1 + l + sov(uint64(l)) - } - l = len(m.OriginalName) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if m.Unsigned { - n += 3 - } - if m.ArrayDims != 0 { - n += 2 + sov(uint64(m.ArrayDims)) - } - n += len(m.unknownFields) - return n -} - -func (m *Query) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Text) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Cmd) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if len(m.Columns) > 0 { - for _, e := range m.Columns { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } - if len(m.Params) > 0 { - for _, e := range m.Params { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } - if len(m.Comments) > 0 { - for _, s := range m.Comments { - l = len(s) - n += 1 + l + sov(uint64(l)) - } - } - l = len(m.Filename) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if m.InsertIntoTable != nil { - l = m.InsertIntoTable.SizeVT() - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Parameter) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Number != 0 { - n += 1 + sov(uint64(m.Number)) - } - if m.Column != nil { - l = m.Column.SizeVT() - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *CodeGenRequest) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Settings != nil { - l = m.Settings.SizeVT() - n += 1 + l + sov(uint64(l)) - } - if m.Catalog != nil { - l = m.Catalog.SizeVT() - n += 1 + l + sov(uint64(l)) - } - if len(m.Queries) > 0 { - for _, e := range m.Queries { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } - l = len(m.SqlcVersion) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.PluginOptions) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *CodeGenResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Files) > 0 { - for _, e := range m.Files { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } - n += len(m.unknownFields) - return n -} - -func sov(x uint64) (n int) { - return (bits.Len64(x|1) + 6) / 7 -} -func soz(x uint64) (n int) { - return sov(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *File) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: File: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: File: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Contents", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Contents = append(m.Contents[:0], dAtA[iNdEx:postIndex]...) - if m.Contents == nil { - m.Contents = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Override) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Override: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Override: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CodeType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CodeType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DbType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DbType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Nullable", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Nullable = bool(v != 0) - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Column", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Column = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Table", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Table == nil { - m.Table = &Identifier{} - } - if err := m.Table.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ColumnName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ColumnName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GoType", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.GoType == nil { - m.GoType = &ParsedGoType{} - } - if err := m.GoType.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 11: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Unsigned", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Unsigned = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ParsedGoType) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ParsedGoType: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ParsedGoType: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ImportPath", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ImportPath = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Package", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Package = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TypeName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TypeName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BasicType", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.BasicType = bool(v != 0) - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StructTags", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.StructTags == nil { - m.StructTags = make(map[string]string) - } - var mapkey string - var mapvalue string - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLength - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLength - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var stringLenmapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapvalue |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { - return ErrInvalidLength - } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue < 0 { - return ErrInvalidLength - } - if postStringIndexmapvalue > l { - return io.ErrUnexpectedEOF - } - mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - } else { - iNdEx = entryPreIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.StructTags[mapkey] = mapvalue - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Settings) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Settings: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Settings: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Version = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Engine", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Engine = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Schema", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Schema = append(m.Schema, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Queries", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Queries = append(m.Queries, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Rename", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Rename == nil { - m.Rename = make(map[string]string) - } - var mapkey string - var mapvalue string - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLength - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLength - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var stringLenmapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapvalue |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { - return ErrInvalidLength - } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue < 0 { - return ErrInvalidLength - } - if postStringIndexmapvalue > l { - return io.ErrUnexpectedEOF - } - mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - } else { - iNdEx = entryPreIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.Rename[mapkey] = mapvalue - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Overrides", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Overrides = append(m.Overrides, &Override{}) - if err := m.Overrides[len(m.Overrides)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Go", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Go == nil { - m.Go = &GoCode{} - } - if err := m.Go.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Json", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Json == nil { - m.Json = &JSONCode{} - } - if err := m.Json.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Codegen", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Codegen == nil { - m.Codegen = &Codegen{} - } - if err := m.Codegen.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Codegen) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Codegen: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Codegen: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Out", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Out = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Plugin", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Plugin = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Options = append(m.Options[:0], dAtA[iNdEx:postIndex]...) - if m.Options == nil { - m.Options = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GoCode) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GoCode: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GoCode: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EmitInterface", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.EmitInterface = bool(v != 0) - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EmitJsonTags", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.EmitJsonTags = bool(v != 0) - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EmitDbTags", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.EmitDbTags = bool(v != 0) - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EmitPreparedQueries", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.EmitPreparedQueries = bool(v != 0) - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EmitExactTableNames", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.EmitExactTableNames = bool(v != 0) - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EmitEmptySlices", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.EmitEmptySlices = bool(v != 0) - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EmitExportedQueries", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.EmitExportedQueries = bool(v != 0) - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EmitResultStructPointers", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.EmitResultStructPointers = bool(v != 0) - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EmitParamsStructPointers", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.EmitParamsStructPointers = bool(v != 0) - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EmitMethodsWithDbArgument", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.EmitMethodsWithDbArgument = bool(v != 0) - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field JsonTagsCaseStyle", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.JsonTagsCaseStyle = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Package", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Package = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 13: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Out", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Out = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 14: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SqlPackage", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SqlPackage = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 15: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OutputDbFileName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OutputDbFileName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 16: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OutputModelsFileName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OutputModelsFileName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 17: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OutputQuerierFileName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OutputQuerierFileName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 18: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OutputFilesSuffix", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OutputFilesSuffix = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 19: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EmitEnumValidMethod", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.EmitEnumValidMethod = bool(v != 0) - case 20: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EmitAllEnumValues", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.EmitAllEnumValues = bool(v != 0) - case 21: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InflectionExcludeTableNames", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.InflectionExcludeTableNames = append(m.InflectionExcludeTableNames, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 22: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EmitPointersForNullTypes", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.EmitPointersForNullTypes = bool(v != 0) - case 23: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field QueryParameterLimit", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.QueryParameterLimit = &v - case 24: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OutputBatchFileName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OutputBatchFileName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 25: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SqlDriver", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SqlDriver = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 26: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field JsonTagsIdUppercase", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.JsonTagsIdUppercase = bool(v != 0) - case 27: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field OmitUnusedStructs", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.OmitUnusedStructs = bool(v != 0) - case 28: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OutputCopyfromFileName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OutputCopyfromFileName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *JSONCode) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: JSONCode: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: JSONCode: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Out", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Out = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Indent", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Indent = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Filename", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Filename = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Catalog) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Catalog: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Catalog: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Comment", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Comment = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DefaultSchema", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DefaultSchema = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Schemas", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Schemas = append(m.Schemas, &Schema{}) - if err := m.Schemas[len(m.Schemas)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Schema) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Schema: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Schema: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Comment", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Comment = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tables", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Tables = append(m.Tables, &Table{}) - if err := m.Tables[len(m.Tables)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Enums", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Enums = append(m.Enums, &Enum{}) - if err := m.Enums[len(m.Enums)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CompositeTypes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CompositeTypes = append(m.CompositeTypes, &CompositeType{}) - if err := m.CompositeTypes[len(m.CompositeTypes)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CompositeType) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CompositeType: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CompositeType: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Comment", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Comment = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Enum) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Enum: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Enum: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Vals", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Vals = append(m.Vals, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Comment", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Comment = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Table) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Table: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Table: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Rel", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Rel == nil { - m.Rel = &Identifier{} - } - if err := m.Rel.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Columns", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Columns = append(m.Columns, &Column{}) - if err := m.Columns[len(m.Columns)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Comment", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Comment = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Identifier) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Identifier: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Identifier: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Catalog", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Catalog = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Schema", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Schema = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Column) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Column: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Column: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NotNull", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.NotNull = bool(v != 0) - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsArray", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.IsArray = bool(v != 0) - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Comment", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Comment = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Length", wireType) - } - m.Length = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Length |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsNamedParam", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.IsNamedParam = bool(v != 0) - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsFuncCall", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.IsFuncCall = bool(v != 0) - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Scope", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Scope = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Table", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Table == nil { - m.Table = &Identifier{} - } - if err := m.Table.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TableAlias", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TableAlias = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Type == nil { - m.Type = &Identifier{} - } - if err := m.Type.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 13: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsSqlcSlice", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.IsSqlcSlice = bool(v != 0) - case 14: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EmbedTable", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.EmbedTable == nil { - m.EmbedTable = &Identifier{} - } - if err := m.EmbedTable.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 15: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OriginalName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OriginalName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 16: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Unsigned", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Unsigned = bool(v != 0) - case 17: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ArrayDims", wireType) - } - m.ArrayDims = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ArrayDims |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Query) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Query: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Query: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Text", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Text = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Cmd", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Cmd = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Columns", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Columns = append(m.Columns, &Column{}) - if err := m.Columns[len(m.Columns)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Params = append(m.Params, &Parameter{}) - if err := m.Params[len(m.Params)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Comments", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Comments = append(m.Comments, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Filename", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Filename = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InsertIntoTable", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.InsertIntoTable == nil { - m.InsertIntoTable = &Identifier{} - } - if err := m.InsertIntoTable.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Parameter) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Parameter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Parameter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Number", wireType) - } - m.Number = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Number |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Column", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Column == nil { - m.Column = &Column{} - } - if err := m.Column.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CodeGenRequest) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CodeGenRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CodeGenRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Settings", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Settings == nil { - m.Settings = &Settings{} - } - if err := m.Settings.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Catalog", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Catalog == nil { - m.Catalog = &Catalog{} - } - if err := m.Catalog.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Queries", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Queries = append(m.Queries, &Query{}) - if err := m.Queries[len(m.Queries)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SqlcVersion", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SqlcVersion = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PluginOptions", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PluginOptions = append(m.PluginOptions[:0], dAtA[iNdEx:postIndex]...) - if m.PluginOptions == nil { - m.PluginOptions = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CodeGenResponse) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CodeGenResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CodeGenResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Files", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Files = append(m.Files, &File{}) - if err := m.Files[len(m.Files)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} - -func skip(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLength - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroup - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLength - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLength = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflow = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") -) diff --git a/internal/quickdb/mysql.go b/internal/quickdb/mysql.go new file mode 100644 index 0000000000..628b08c6bb --- /dev/null +++ b/internal/quickdb/mysql.go @@ -0,0 +1,16 @@ +package quickdb + +import ( + "fmt" + "net/url" +) + +// The database URI returned by the QuickDB service isn't understood by the +// go-mysql-driver +func MySQLReformatURI(original string) (string, error) { + u, err := url.Parse(original) + if err != nil { + return "", err + } + return fmt.Sprintf("%s@tcp(%s)%s?multiStatements=true&parseTime=true&tls=true", u.User, u.Host, u.Path), nil +} diff --git a/internal/quickdb/region.go b/internal/quickdb/region.go deleted file mode 100644 index 1900e33a14..0000000000 --- a/internal/quickdb/region.go +++ /dev/null @@ -1,19 +0,0 @@ -package quickdb - -import ( - "net/http" - "sync" -) - -var region string -var once sync.Once - -func GetClosestRegion() string { - once.Do(func() { - resp, err := http.Get("https://find-closest-db-region.sqlc.dev") - if err == nil { - region = resp.Header.Get("Region") - } - }) - return region -} diff --git a/internal/quickdb/rpc.go b/internal/quickdb/rpc.go index c1f9ffd4c2..9d9649d3dc 100644 --- a/internal/quickdb/rpc.go +++ b/internal/quickdb/rpc.go @@ -2,7 +2,6 @@ package quickdb import ( "crypto/tls" - "os" "github.com/riza-io/grpc-go/credentials/basic" "google.golang.org/grpc" @@ -10,14 +9,14 @@ import ( "github.com/sqlc-dev/sqlc/internal/config" pb "github.com/sqlc-dev/sqlc/internal/quickdb/v1" + "github.com/sqlc-dev/sqlc/internal/rpc" ) const defaultHostname = "grpc.sqlc.dev" func NewClientFromConfig(cloudConfig config.Cloud) (pb.QuickClient, error) { projectID := cloudConfig.Project - authToken := os.Getenv("SQLC_AUTH_TOKEN") - return NewClient(projectID, authToken, WithHost(cloudConfig.Hostname)) + return NewClient(projectID, cloudConfig.AuthToken, WithHost(cloudConfig.Hostname)) } type options struct { @@ -41,6 +40,7 @@ func NewClient(project, token string, opts ...Option) (pb.QuickClient, error) { dialOpts := []grpc.DialOption{ grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})), grpc.WithPerRPCCredentials(basic.NewPerRPCCredentials(project, token)), + grpc.WithUnaryInterceptor(rpc.UnaryInterceptor), } hostname := o.hostname diff --git a/internal/quickdb/v1/quickdb.pb.go b/internal/quickdb/v1/quickdb.pb.go index 34f4e1739c..690dfc16f1 100755 --- a/internal/quickdb/v1/quickdb.pb.go +++ b/internal/quickdb/v1/quickdb.pb.go @@ -1,16 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.30.0 -// protoc v3.21.7 -// source: proto/quickdb/v1/quickdb.proto +// protoc (unknown) +// source: v1/quickdb.proto -package v1 +package quickdbv1 import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -38,7 +34,7 @@ type CreateEphemeralDatabaseRequest struct { func (x *CreateEphemeralDatabaseRequest) Reset() { *x = CreateEphemeralDatabaseRequest{} if protoimpl.UnsafeEnabled { - mi := &file_proto_quickdb_v1_quickdb_proto_msgTypes[0] + mi := &file_v1_quickdb_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -51,7 +47,7 @@ func (x *CreateEphemeralDatabaseRequest) String() string { func (*CreateEphemeralDatabaseRequest) ProtoMessage() {} func (x *CreateEphemeralDatabaseRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_quickdb_v1_quickdb_proto_msgTypes[0] + mi := &file_v1_quickdb_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -64,7 +60,7 @@ func (x *CreateEphemeralDatabaseRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateEphemeralDatabaseRequest.ProtoReflect.Descriptor instead. func (*CreateEphemeralDatabaseRequest) Descriptor() ([]byte, []int) { - return file_proto_quickdb_v1_quickdb_proto_rawDescGZIP(), []int{0} + return file_v1_quickdb_proto_rawDescGZIP(), []int{0} } func (x *CreateEphemeralDatabaseRequest) GetRegion() string { @@ -107,7 +103,7 @@ type CreateEphemeralDatabaseResponse struct { func (x *CreateEphemeralDatabaseResponse) Reset() { *x = CreateEphemeralDatabaseResponse{} if protoimpl.UnsafeEnabled { - mi := &file_proto_quickdb_v1_quickdb_proto_msgTypes[1] + mi := &file_v1_quickdb_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120,7 +116,7 @@ func (x *CreateEphemeralDatabaseResponse) String() string { func (*CreateEphemeralDatabaseResponse) ProtoMessage() {} func (x *CreateEphemeralDatabaseResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_quickdb_v1_quickdb_proto_msgTypes[1] + mi := &file_v1_quickdb_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -133,7 +129,7 @@ func (x *CreateEphemeralDatabaseResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateEphemeralDatabaseResponse.ProtoReflect.Descriptor instead. func (*CreateEphemeralDatabaseResponse) Descriptor() ([]byte, []int) { - return file_proto_quickdb_v1_quickdb_proto_rawDescGZIP(), []int{1} + return file_v1_quickdb_proto_rawDescGZIP(), []int{1} } func (x *CreateEphemeralDatabaseResponse) GetDatabaseId() string { @@ -161,7 +157,7 @@ type DropEphemeralDatabaseRequest struct { func (x *DropEphemeralDatabaseRequest) Reset() { *x = DropEphemeralDatabaseRequest{} if protoimpl.UnsafeEnabled { - mi := &file_proto_quickdb_v1_quickdb_proto_msgTypes[2] + mi := &file_v1_quickdb_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -174,7 +170,7 @@ func (x *DropEphemeralDatabaseRequest) String() string { func (*DropEphemeralDatabaseRequest) ProtoMessage() {} func (x *DropEphemeralDatabaseRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_quickdb_v1_quickdb_proto_msgTypes[2] + mi := &file_v1_quickdb_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -187,7 +183,7 @@ func (x *DropEphemeralDatabaseRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DropEphemeralDatabaseRequest.ProtoReflect.Descriptor instead. func (*DropEphemeralDatabaseRequest) Descriptor() ([]byte, []int) { - return file_proto_quickdb_v1_quickdb_proto_rawDescGZIP(), []int{2} + return file_v1_quickdb_proto_rawDescGZIP(), []int{2} } func (x *DropEphemeralDatabaseRequest) GetDatabaseId() string { @@ -206,7 +202,7 @@ type DropEphemeralDatabaseResponse struct { func (x *DropEphemeralDatabaseResponse) Reset() { *x = DropEphemeralDatabaseResponse{} if protoimpl.UnsafeEnabled { - mi := &file_proto_quickdb_v1_quickdb_proto_msgTypes[3] + mi := &file_v1_quickdb_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -219,7 +215,7 @@ func (x *DropEphemeralDatabaseResponse) String() string { func (*DropEphemeralDatabaseResponse) ProtoMessage() {} func (x *DropEphemeralDatabaseResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_quickdb_v1_quickdb_proto_msgTypes[3] + mi := &file_v1_quickdb_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -232,7 +228,7 @@ func (x *DropEphemeralDatabaseResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use DropEphemeralDatabaseResponse.ProtoReflect.Descriptor instead. func (*DropEphemeralDatabaseResponse) Descriptor() ([]byte, []int) { - return file_proto_quickdb_v1_quickdb_proto_rawDescGZIP(), []int{3} + return file_v1_quickdb_proto_rawDescGZIP(), []int{3} } type File struct { @@ -247,7 +243,7 @@ type File struct { func (x *File) Reset() { *x = File{} if protoimpl.UnsafeEnabled { - mi := &file_proto_quickdb_v1_quickdb_proto_msgTypes[4] + mi := &file_v1_quickdb_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -260,7 +256,7 @@ func (x *File) String() string { func (*File) ProtoMessage() {} func (x *File) ProtoReflect() protoreflect.Message { - mi := &file_proto_quickdb_v1_quickdb_proto_msgTypes[4] + mi := &file_v1_quickdb_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -273,7 +269,7 @@ func (x *File) ProtoReflect() protoreflect.Message { // Deprecated: Use File.ProtoReflect.Descriptor instead. func (*File) Descriptor() ([]byte, []int) { - return file_proto_quickdb_v1_quickdb_proto_rawDescGZIP(), []int{4} + return file_v1_quickdb_proto_rawDescGZIP(), []int{4} } func (x *File) GetName() string { @@ -290,20 +286,95 @@ func (x *File) GetContents() []byte { return nil } +type QuerySet struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Schema []*File `protobuf:"bytes,2,rep,name=schema,proto3" json:"schema,omitempty"` + Queries []*File `protobuf:"bytes,3,rep,name=queries,proto3" json:"queries,omitempty"` + CodegenRequest *File `protobuf:"bytes,4,opt,name=codegen_request,json=codegenRequest,proto3" json:"codegen_request,omitempty"` +} + +func (x *QuerySet) Reset() { + *x = QuerySet{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_quickdb_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QuerySet) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QuerySet) ProtoMessage() {} + +func (x *QuerySet) ProtoReflect() protoreflect.Message { + mi := &file_v1_quickdb_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QuerySet.ProtoReflect.Descriptor instead. +func (*QuerySet) Descriptor() ([]byte, []int) { + return file_v1_quickdb_proto_rawDescGZIP(), []int{5} +} + +func (x *QuerySet) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *QuerySet) GetSchema() []*File { + if x != nil { + return x.Schema + } + return nil +} + +func (x *QuerySet) GetQueries() []*File { + if x != nil { + return x.Queries + } + return nil +} + +func (x *QuerySet) GetCodegenRequest() *File { + if x != nil { + return x.CodegenRequest + } + return nil +} + type UploadArchiveRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - SqlcVersion string `protobuf:"bytes,1,opt,name=sqlc_version,json=sqlcVersion,proto3" json:"sqlc_version,omitempty"` - Inputs []*File `protobuf:"bytes,2,rep,name=inputs,proto3" json:"inputs,omitempty"` - Outputs []*File `protobuf:"bytes,3,rep,name=outputs,proto3" json:"outputs,omitempty"` + SqlcVersion string `protobuf:"bytes,1,opt,name=sqlc_version,json=sqlcVersion,proto3" json:"sqlc_version,omitempty"` + Inputs []*File `protobuf:"bytes,2,rep,name=inputs,proto3" json:"inputs,omitempty"` // deprecated + Outputs []*File `protobuf:"bytes,3,rep,name=outputs,proto3" json:"outputs,omitempty"` // deprecated + Annotations map[string]string `protobuf:"bytes,4,rep,name=annotations,proto3" json:"annotations,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + QuerySets []*QuerySet `protobuf:"bytes,5,rep,name=query_sets,json=querySets,proto3" json:"query_sets,omitempty"` + Config *File `protobuf:"bytes,6,opt,name=config,proto3" json:"config,omitempty"` + Tags []string `protobuf:"bytes,7,rep,name=tags,proto3" json:"tags,omitempty"` } func (x *UploadArchiveRequest) Reset() { *x = UploadArchiveRequest{} if protoimpl.UnsafeEnabled { - mi := &file_proto_quickdb_v1_quickdb_proto_msgTypes[5] + mi := &file_v1_quickdb_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -316,7 +387,7 @@ func (x *UploadArchiveRequest) String() string { func (*UploadArchiveRequest) ProtoMessage() {} func (x *UploadArchiveRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_quickdb_v1_quickdb_proto_msgTypes[5] + mi := &file_v1_quickdb_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -329,7 +400,7 @@ func (x *UploadArchiveRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UploadArchiveRequest.ProtoReflect.Descriptor instead. func (*UploadArchiveRequest) Descriptor() ([]byte, []int) { - return file_proto_quickdb_v1_quickdb_proto_rawDescGZIP(), []int{5} + return file_v1_quickdb_proto_rawDescGZIP(), []int{6} } func (x *UploadArchiveRequest) GetSqlcVersion() string { @@ -353,6 +424,34 @@ func (x *UploadArchiveRequest) GetOutputs() []*File { return nil } +func (x *UploadArchiveRequest) GetAnnotations() map[string]string { + if x != nil { + return x.Annotations + } + return nil +} + +func (x *UploadArchiveRequest) GetQuerySets() []*QuerySet { + if x != nil { + return x.QuerySets + } + return nil +} + +func (x *UploadArchiveRequest) GetConfig() *File { + if x != nil { + return x.Config + } + return nil +} + +func (x *UploadArchiveRequest) GetTags() []string { + if x != nil { + return x.Tags + } + return nil +} + type UploadArchiveResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -364,7 +463,7 @@ type UploadArchiveResponse struct { func (x *UploadArchiveResponse) Reset() { *x = UploadArchiveResponse{} if protoimpl.UnsafeEnabled { - mi := &file_proto_quickdb_v1_quickdb_proto_msgTypes[6] + mi := &file_v1_quickdb_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -377,7 +476,7 @@ func (x *UploadArchiveResponse) String() string { func (*UploadArchiveResponse) ProtoMessage() {} func (x *UploadArchiveResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_quickdb_v1_quickdb_proto_msgTypes[6] + mi := &file_v1_quickdb_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -390,7 +489,7 @@ func (x *UploadArchiveResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use UploadArchiveResponse.ProtoReflect.Descriptor instead. func (*UploadArchiveResponse) Descriptor() ([]byte, []int) { - return file_proto_quickdb_v1_quickdb_proto_rawDescGZIP(), []int{6} + return file_v1_quickdb_proto_rawDescGZIP(), []int{7} } func (x *UploadArchiveResponse) GetChecksum() []byte { @@ -400,125 +499,484 @@ func (x *UploadArchiveResponse) GetChecksum() []byte { return nil } -var File_proto_quickdb_v1_quickdb_proto protoreflect.FileDescriptor - -var file_proto_quickdb_v1_quickdb_proto_rawDesc = []byte{ - 0x0a, 0x1e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2f, - 0x76, 0x31, 0x2f, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x1a, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, - 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x22, 0x8d, 0x01, 0x0a, - 0x1e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c, - 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x16, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x12, - 0x1b, 0x0a, 0x09, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, - 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x0a, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x54, 0x0a, 0x1f, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x44, - 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x1f, 0x0a, 0x0b, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x49, 0x64, - 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x69, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, - 0x72, 0x69, 0x22, 0x3f, 0x0a, 0x1c, 0x44, 0x72, 0x6f, 0x70, 0x45, 0x70, 0x68, 0x65, 0x6d, 0x65, - 0x72, 0x61, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, - 0x65, 0x49, 0x64, 0x22, 0x1f, 0x0a, 0x1d, 0x44, 0x72, 0x6f, 0x70, 0x45, 0x70, 0x68, 0x65, 0x6d, - 0x65, 0x72, 0x61, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x36, 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xaf, 0x01, 0x0a, - 0x14, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x71, 0x6c, 0x63, 0x5f, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x71, 0x6c, - 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x38, 0x0a, 0x06, 0x69, 0x6e, 0x70, 0x75, - 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, - 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, - 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x06, 0x69, 0x6e, 0x70, 0x75, - 0x74, 0x73, 0x12, 0x3a, 0x0a, 0x07, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, - 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, - 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x07, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x73, 0x22, 0x33, - 0x0a, 0x15, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68, 0x65, 0x63, 0x6b, - 0x73, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x63, 0x68, 0x65, 0x63, 0x6b, - 0x73, 0x75, 0x6d, 0x32, 0xa1, 0x03, 0x0a, 0x05, 0x51, 0x75, 0x69, 0x63, 0x6b, 0x12, 0x92, 0x01, - 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, - 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x12, 0x3a, 0x2e, 0x72, 0x65, 0x6d, 0x6f, - 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, - 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x70, 0x68, +type VerifyQuerySetsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SqlcVersion string `protobuf:"bytes,1,opt,name=sqlc_version,json=sqlcVersion,proto3" json:"sqlc_version,omitempty"` + QuerySets []*QuerySet `protobuf:"bytes,2,rep,name=query_sets,json=querySets,proto3" json:"query_sets,omitempty"` + Config *File `protobuf:"bytes,3,opt,name=config,proto3" json:"config,omitempty"` + Annotations map[string]string `protobuf:"bytes,4,rep,name=annotations,proto3" json:"annotations,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Against string `protobuf:"bytes,5,opt,name=against,proto3" json:"against,omitempty"` +} + +func (x *VerifyQuerySetsRequest) Reset() { + *x = VerifyQuerySetsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_quickdb_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VerifyQuerySetsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VerifyQuerySetsRequest) ProtoMessage() {} + +func (x *VerifyQuerySetsRequest) ProtoReflect() protoreflect.Message { + mi := &file_v1_quickdb_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VerifyQuerySetsRequest.ProtoReflect.Descriptor instead. +func (*VerifyQuerySetsRequest) Descriptor() ([]byte, []int) { + return file_v1_quickdb_proto_rawDescGZIP(), []int{8} +} + +func (x *VerifyQuerySetsRequest) GetSqlcVersion() string { + if x != nil { + return x.SqlcVersion + } + return "" +} + +func (x *VerifyQuerySetsRequest) GetQuerySets() []*QuerySet { + if x != nil { + return x.QuerySets + } + return nil +} + +func (x *VerifyQuerySetsRequest) GetConfig() *File { + if x != nil { + return x.Config + } + return nil +} + +func (x *VerifyQuerySetsRequest) GetAnnotations() map[string]string { + if x != nil { + return x.Annotations + } + return nil +} + +func (x *VerifyQuerySetsRequest) GetAgainst() string { + if x != nil { + return x.Against + } + return "" +} + +type VerifyQuerySetsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Errored bool `protobuf:"varint,1,opt,name=errored,proto3" json:"errored,omitempty"` + Output string `protobuf:"bytes,2,opt,name=output,proto3" json:"output,omitempty"` + Summary string `protobuf:"bytes,3,opt,name=summary,proto3" json:"summary,omitempty"` +} + +func (x *VerifyQuerySetsResponse) Reset() { + *x = VerifyQuerySetsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_quickdb_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VerifyQuerySetsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VerifyQuerySetsResponse) ProtoMessage() {} + +func (x *VerifyQuerySetsResponse) ProtoReflect() protoreflect.Message { + mi := &file_v1_quickdb_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VerifyQuerySetsResponse.ProtoReflect.Descriptor instead. +func (*VerifyQuerySetsResponse) Descriptor() ([]byte, []int) { + return file_v1_quickdb_proto_rawDescGZIP(), []int{9} +} + +func (x *VerifyQuerySetsResponse) GetErrored() bool { + if x != nil { + return x.Errored + } + return false +} + +func (x *VerifyQuerySetsResponse) GetOutput() string { + if x != nil { + return x.Output + } + return "" +} + +func (x *VerifyQuerySetsResponse) GetSummary() string { + if x != nil { + return x.Summary + } + return "" +} + +type GetQuerySetsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"` +} + +func (x *GetQuerySetsRequest) Reset() { + *x = GetQuerySetsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_quickdb_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetQuerySetsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetQuerySetsRequest) ProtoMessage() {} + +func (x *GetQuerySetsRequest) ProtoReflect() protoreflect.Message { + mi := &file_v1_quickdb_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetQuerySetsRequest.ProtoReflect.Descriptor instead. +func (*GetQuerySetsRequest) Descriptor() ([]byte, []int) { + return file_v1_quickdb_proto_rawDescGZIP(), []int{10} +} + +func (x *GetQuerySetsRequest) GetTag() string { + if x != nil { + return x.Tag + } + return "" +} + +type GetQuerySetsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + QuerySets []*QuerySet `protobuf:"bytes,1,rep,name=query_sets,json=querySets,proto3" json:"query_sets,omitempty"` +} + +func (x *GetQuerySetsResponse) Reset() { + *x = GetQuerySetsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_quickdb_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetQuerySetsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetQuerySetsResponse) ProtoMessage() {} + +func (x *GetQuerySetsResponse) ProtoReflect() protoreflect.Message { + mi := &file_v1_quickdb_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetQuerySetsResponse.ProtoReflect.Descriptor instead. +func (*GetQuerySetsResponse) Descriptor() ([]byte, []int) { + return file_v1_quickdb_proto_rawDescGZIP(), []int{11} +} + +func (x *GetQuerySetsResponse) GetQuerySets() []*QuerySet { + if x != nil { + return x.QuerySets + } + return nil +} + +var File_v1_quickdb_proto protoreflect.FileDescriptor + +var file_v1_quickdb_proto_rawDesc = []byte{ + 0x0a, 0x10, 0x76, 0x31, 0x2f, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x1a, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, + 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x22, 0x8d, + 0x01, 0x0a, 0x1e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, + 0x61, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x67, + 0x69, 0x6e, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, + 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1e, + 0x0a, 0x0a, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x54, + 0x0a, 0x1f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, + 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, + 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x69, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x75, 0x72, 0x69, 0x22, 0x3f, 0x0a, 0x1c, 0x44, 0x72, 0x6f, 0x70, 0x45, 0x70, 0x68, 0x65, + 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x61, 0x74, 0x61, 0x62, + 0x61, 0x73, 0x65, 0x49, 0x64, 0x22, 0x1f, 0x0a, 0x1d, 0x44, 0x72, 0x6f, 0x70, 0x45, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3b, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, - 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, - 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, - 0x61, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x8c, 0x01, 0x0a, 0x15, 0x44, 0x72, 0x6f, 0x70, 0x45, 0x70, 0x68, 0x65, 0x6d, - 0x65, 0x72, 0x61, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x12, 0x38, 0x2e, 0x72, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x36, 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xdf, + 0x01, 0x0a, 0x08, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x38, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x20, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, + 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, + 0x65, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x3a, 0x0a, 0x07, 0x71, 0x75, 0x65, + 0x72, 0x69, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x72, 0x65, 0x6d, + 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, + 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x07, 0x71, 0x75, + 0x65, 0x72, 0x69, 0x65, 0x73, 0x12, 0x49, 0x0a, 0x0f, 0x63, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, + 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, + 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, + 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, + 0x52, 0x0e, 0x63, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x22, 0xe7, 0x03, 0x0a, 0x14, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x72, 0x63, 0x68, 0x69, + 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x71, 0x6c, + 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x73, 0x71, 0x6c, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x38, 0x0a, 0x06, + 0x69, 0x6e, 0x70, 0x75, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, - 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x72, 0x6f, 0x70, 0x45, 0x70, - 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x39, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, - 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, - 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x72, 0x6f, 0x70, 0x45, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, - 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x74, 0x0a, 0x0d, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x72, 0x63, 0x68, 0x69, - 0x76, 0x65, 0x12, 0x30, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, + 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x06, + 0x69, 0x6e, 0x70, 0x75, 0x74, 0x73, 0x12, 0x3a, 0x0a, 0x07, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, + 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, + 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x07, 0x6f, 0x75, 0x74, 0x70, 0x75, + 0x74, 0x73, 0x12, 0x63, 0x0a, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x41, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, + 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, + 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x72, 0x63, 0x68, 0x69, + 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, + 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x43, 0x0a, 0x0a, 0x71, 0x75, 0x65, 0x72, 0x79, + 0x5f, 0x73, 0x65, 0x74, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x72, 0x65, + 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, + 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, + 0x74, 0x52, 0x09, 0x71, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x74, 0x73, 0x12, 0x38, 0x0a, 0x06, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x72, + 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, + 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x06, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x1a, 0x3e, 0x0a, 0x10, 0x41, 0x6e, + 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x33, 0x0a, 0x15, 0x55, 0x70, + 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x22, + 0xfb, 0x02, 0x0a, 0x16, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, + 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x71, + 0x6c, 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0b, 0x73, 0x71, 0x6c, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x43, 0x0a, + 0x0a, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x73, 0x65, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x24, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, + 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x74, 0x52, 0x09, 0x71, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, + 0x74, 0x73, 0x12, 0x38, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, - 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, - 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, - 0x31, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x46, 0x69, 0x6c, 0x65, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x65, 0x0a, 0x0b, + 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x43, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, + 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x56, + 0x65, 0x72, 0x69, 0x66, 0x79, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x67, 0x61, 0x69, 0x6e, 0x73, 0x74, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x67, 0x61, 0x69, 0x6e, 0x73, 0x74, 0x1a, 0x3e, 0x0a, + 0x10, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x65, 0x0a, + 0x17, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x74, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x72, 0x72, 0x6f, + 0x72, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, + 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x6d, + 0x6d, 0x61, 0x72, 0x79, 0x22, 0x27, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x74, + 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x74, 0x61, 0x67, 0x22, 0x5b, 0x0a, + 0x14, 0x47, 0x65, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x0a, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x73, + 0x65, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x72, 0x65, 0x6d, 0x6f, + 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, + 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x74, 0x52, + 0x09, 0x71, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x74, 0x73, 0x32, 0x90, 0x05, 0x0a, 0x05, 0x51, + 0x75, 0x69, 0x63, 0x6b, 0x12, 0x92, 0x01, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, + 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, + 0x12, 0x3a, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, + 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x45, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x44, 0x61, 0x74, + 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3b, 0x2e, 0x72, + 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, + 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x45, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x8c, 0x01, 0x0a, 0x15, 0x44, 0x72, + 0x6f, 0x70, 0x45, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, + 0x61, 0x73, 0x65, 0x12, 0x38, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, + 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, + 0x2e, 0x44, 0x72, 0x6f, 0x70, 0x45, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x44, 0x61, + 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x39, 0x2e, + 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, + 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x72, 0x6f, 0x70, 0x45, + 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x74, 0x0a, 0x0d, 0x55, 0x70, 0x6c, 0x6f, + 0x61, 0x64, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x12, 0x30, 0x2e, 0x72, 0x65, 0x6d, 0x6f, + 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, + 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x72, 0x63, + 0x68, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x72, 0x65, + 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, + 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x41, + 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7a, + 0x0a, 0x0f, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x74, + 0x73, 0x12, 0x32, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, + 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x56, + 0x65, 0x72, 0x69, 0x66, 0x79, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, + 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, + 0x76, 0x31, 0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, + 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x71, 0x0a, 0x0c, 0x47, 0x65, + 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x74, 0x73, 0x12, 0x2f, 0x2e, 0x72, 0x65, 0x6d, + 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, + 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x72, 0x65, + 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, + 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xeb, 0x01, + 0x0a, 0x1e, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, + 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, + 0x42, 0x0c, 0x51, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x71, 0x6c, + 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x73, 0x71, 0x6c, 0x63, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, + 0x6e, 0x61, 0x6c, 0x2f, 0x76, 0x31, 0x3b, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x76, 0x31, + 0xa2, 0x02, 0x04, 0x52, 0x53, 0x44, 0x51, 0xaa, 0x02, 0x1a, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, + 0x2e, 0x53, 0x71, 0x6c, 0x63, 0x2e, 0x44, 0x65, 0x76, 0x2e, 0x51, 0x75, 0x69, 0x63, 0x6b, 0x64, + 0x62, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x1a, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5c, 0x53, 0x71, + 0x6c, 0x63, 0x5c, 0x44, 0x65, 0x76, 0x5c, 0x51, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x5c, 0x56, + 0x31, 0xe2, 0x02, 0x26, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5c, 0x53, 0x71, 0x6c, 0x63, 0x5c, + 0x44, 0x65, 0x76, 0x5c, 0x51, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x5c, 0x56, 0x31, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1e, 0x52, 0x65, 0x6d, + 0x6f, 0x74, 0x65, 0x3a, 0x3a, 0x53, 0x71, 0x6c, 0x63, 0x3a, 0x3a, 0x44, 0x65, 0x76, 0x3a, 0x3a, + 0x51, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( - file_proto_quickdb_v1_quickdb_proto_rawDescOnce sync.Once - file_proto_quickdb_v1_quickdb_proto_rawDescData = file_proto_quickdb_v1_quickdb_proto_rawDesc + file_v1_quickdb_proto_rawDescOnce sync.Once + file_v1_quickdb_proto_rawDescData = file_v1_quickdb_proto_rawDesc ) -func file_proto_quickdb_v1_quickdb_proto_rawDescGZIP() []byte { - file_proto_quickdb_v1_quickdb_proto_rawDescOnce.Do(func() { - file_proto_quickdb_v1_quickdb_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_quickdb_v1_quickdb_proto_rawDescData) +func file_v1_quickdb_proto_rawDescGZIP() []byte { + file_v1_quickdb_proto_rawDescOnce.Do(func() { + file_v1_quickdb_proto_rawDescData = protoimpl.X.CompressGZIP(file_v1_quickdb_proto_rawDescData) }) - return file_proto_quickdb_v1_quickdb_proto_rawDescData + return file_v1_quickdb_proto_rawDescData } -var file_proto_quickdb_v1_quickdb_proto_msgTypes = make([]protoimpl.MessageInfo, 7) -var file_proto_quickdb_v1_quickdb_proto_goTypes = []interface{}{ +var file_v1_quickdb_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_v1_quickdb_proto_goTypes = []interface{}{ (*CreateEphemeralDatabaseRequest)(nil), // 0: remote.sqlc.dev.quickdb.v1.CreateEphemeralDatabaseRequest (*CreateEphemeralDatabaseResponse)(nil), // 1: remote.sqlc.dev.quickdb.v1.CreateEphemeralDatabaseResponse (*DropEphemeralDatabaseRequest)(nil), // 2: remote.sqlc.dev.quickdb.v1.DropEphemeralDatabaseRequest (*DropEphemeralDatabaseResponse)(nil), // 3: remote.sqlc.dev.quickdb.v1.DropEphemeralDatabaseResponse (*File)(nil), // 4: remote.sqlc.dev.quickdb.v1.File - (*UploadArchiveRequest)(nil), // 5: remote.sqlc.dev.quickdb.v1.UploadArchiveRequest - (*UploadArchiveResponse)(nil), // 6: remote.sqlc.dev.quickdb.v1.UploadArchiveResponse -} -var file_proto_quickdb_v1_quickdb_proto_depIdxs = []int32{ - 4, // 0: remote.sqlc.dev.quickdb.v1.UploadArchiveRequest.inputs:type_name -> remote.sqlc.dev.quickdb.v1.File - 4, // 1: remote.sqlc.dev.quickdb.v1.UploadArchiveRequest.outputs:type_name -> remote.sqlc.dev.quickdb.v1.File - 0, // 2: remote.sqlc.dev.quickdb.v1.Quick.CreateEphemeralDatabase:input_type -> remote.sqlc.dev.quickdb.v1.CreateEphemeralDatabaseRequest - 2, // 3: remote.sqlc.dev.quickdb.v1.Quick.DropEphemeralDatabase:input_type -> remote.sqlc.dev.quickdb.v1.DropEphemeralDatabaseRequest - 5, // 4: remote.sqlc.dev.quickdb.v1.Quick.UploadArchive:input_type -> remote.sqlc.dev.quickdb.v1.UploadArchiveRequest - 1, // 5: remote.sqlc.dev.quickdb.v1.Quick.CreateEphemeralDatabase:output_type -> remote.sqlc.dev.quickdb.v1.CreateEphemeralDatabaseResponse - 3, // 6: remote.sqlc.dev.quickdb.v1.Quick.DropEphemeralDatabase:output_type -> remote.sqlc.dev.quickdb.v1.DropEphemeralDatabaseResponse - 6, // 7: remote.sqlc.dev.quickdb.v1.Quick.UploadArchive:output_type -> remote.sqlc.dev.quickdb.v1.UploadArchiveResponse - 5, // [5:8] is the sub-list for method output_type - 2, // [2:5] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_proto_quickdb_v1_quickdb_proto_init() } -func file_proto_quickdb_v1_quickdb_proto_init() { - if File_proto_quickdb_v1_quickdb_proto != nil { + (*QuerySet)(nil), // 5: remote.sqlc.dev.quickdb.v1.QuerySet + (*UploadArchiveRequest)(nil), // 6: remote.sqlc.dev.quickdb.v1.UploadArchiveRequest + (*UploadArchiveResponse)(nil), // 7: remote.sqlc.dev.quickdb.v1.UploadArchiveResponse + (*VerifyQuerySetsRequest)(nil), // 8: remote.sqlc.dev.quickdb.v1.VerifyQuerySetsRequest + (*VerifyQuerySetsResponse)(nil), // 9: remote.sqlc.dev.quickdb.v1.VerifyQuerySetsResponse + (*GetQuerySetsRequest)(nil), // 10: remote.sqlc.dev.quickdb.v1.GetQuerySetsRequest + (*GetQuerySetsResponse)(nil), // 11: remote.sqlc.dev.quickdb.v1.GetQuerySetsResponse + nil, // 12: remote.sqlc.dev.quickdb.v1.UploadArchiveRequest.AnnotationsEntry + nil, // 13: remote.sqlc.dev.quickdb.v1.VerifyQuerySetsRequest.AnnotationsEntry +} +var file_v1_quickdb_proto_depIdxs = []int32{ + 4, // 0: remote.sqlc.dev.quickdb.v1.QuerySet.schema:type_name -> remote.sqlc.dev.quickdb.v1.File + 4, // 1: remote.sqlc.dev.quickdb.v1.QuerySet.queries:type_name -> remote.sqlc.dev.quickdb.v1.File + 4, // 2: remote.sqlc.dev.quickdb.v1.QuerySet.codegen_request:type_name -> remote.sqlc.dev.quickdb.v1.File + 4, // 3: remote.sqlc.dev.quickdb.v1.UploadArchiveRequest.inputs:type_name -> remote.sqlc.dev.quickdb.v1.File + 4, // 4: remote.sqlc.dev.quickdb.v1.UploadArchiveRequest.outputs:type_name -> remote.sqlc.dev.quickdb.v1.File + 12, // 5: remote.sqlc.dev.quickdb.v1.UploadArchiveRequest.annotations:type_name -> remote.sqlc.dev.quickdb.v1.UploadArchiveRequest.AnnotationsEntry + 5, // 6: remote.sqlc.dev.quickdb.v1.UploadArchiveRequest.query_sets:type_name -> remote.sqlc.dev.quickdb.v1.QuerySet + 4, // 7: remote.sqlc.dev.quickdb.v1.UploadArchiveRequest.config:type_name -> remote.sqlc.dev.quickdb.v1.File + 5, // 8: remote.sqlc.dev.quickdb.v1.VerifyQuerySetsRequest.query_sets:type_name -> remote.sqlc.dev.quickdb.v1.QuerySet + 4, // 9: remote.sqlc.dev.quickdb.v1.VerifyQuerySetsRequest.config:type_name -> remote.sqlc.dev.quickdb.v1.File + 13, // 10: remote.sqlc.dev.quickdb.v1.VerifyQuerySetsRequest.annotations:type_name -> remote.sqlc.dev.quickdb.v1.VerifyQuerySetsRequest.AnnotationsEntry + 5, // 11: remote.sqlc.dev.quickdb.v1.GetQuerySetsResponse.query_sets:type_name -> remote.sqlc.dev.quickdb.v1.QuerySet + 0, // 12: remote.sqlc.dev.quickdb.v1.Quick.CreateEphemeralDatabase:input_type -> remote.sqlc.dev.quickdb.v1.CreateEphemeralDatabaseRequest + 2, // 13: remote.sqlc.dev.quickdb.v1.Quick.DropEphemeralDatabase:input_type -> remote.sqlc.dev.quickdb.v1.DropEphemeralDatabaseRequest + 6, // 14: remote.sqlc.dev.quickdb.v1.Quick.UploadArchive:input_type -> remote.sqlc.dev.quickdb.v1.UploadArchiveRequest + 8, // 15: remote.sqlc.dev.quickdb.v1.Quick.VerifyQuerySets:input_type -> remote.sqlc.dev.quickdb.v1.VerifyQuerySetsRequest + 10, // 16: remote.sqlc.dev.quickdb.v1.Quick.GetQuerySets:input_type -> remote.sqlc.dev.quickdb.v1.GetQuerySetsRequest + 1, // 17: remote.sqlc.dev.quickdb.v1.Quick.CreateEphemeralDatabase:output_type -> remote.sqlc.dev.quickdb.v1.CreateEphemeralDatabaseResponse + 3, // 18: remote.sqlc.dev.quickdb.v1.Quick.DropEphemeralDatabase:output_type -> remote.sqlc.dev.quickdb.v1.DropEphemeralDatabaseResponse + 7, // 19: remote.sqlc.dev.quickdb.v1.Quick.UploadArchive:output_type -> remote.sqlc.dev.quickdb.v1.UploadArchiveResponse + 9, // 20: remote.sqlc.dev.quickdb.v1.Quick.VerifyQuerySets:output_type -> remote.sqlc.dev.quickdb.v1.VerifyQuerySetsResponse + 11, // 21: remote.sqlc.dev.quickdb.v1.Quick.GetQuerySets:output_type -> remote.sqlc.dev.quickdb.v1.GetQuerySetsResponse + 17, // [17:22] is the sub-list for method output_type + 12, // [12:17] is the sub-list for method input_type + 12, // [12:12] is the sub-list for extension type_name + 12, // [12:12] is the sub-list for extension extendee + 0, // [0:12] is the sub-list for field type_name +} + +func init() { file_v1_quickdb_proto_init() } +func file_v1_quickdb_proto_init() { + if File_v1_quickdb_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_proto_quickdb_v1_quickdb_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_v1_quickdb_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CreateEphemeralDatabaseRequest); i { case 0: return &v.state @@ -530,7 +988,7 @@ func file_proto_quickdb_v1_quickdb_proto_init() { return nil } } - file_proto_quickdb_v1_quickdb_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_v1_quickdb_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CreateEphemeralDatabaseResponse); i { case 0: return &v.state @@ -542,7 +1000,7 @@ func file_proto_quickdb_v1_quickdb_proto_init() { return nil } } - file_proto_quickdb_v1_quickdb_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_v1_quickdb_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DropEphemeralDatabaseRequest); i { case 0: return &v.state @@ -554,7 +1012,7 @@ func file_proto_quickdb_v1_quickdb_proto_init() { return nil } } - file_proto_quickdb_v1_quickdb_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_v1_quickdb_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DropEphemeralDatabaseResponse); i { case 0: return &v.state @@ -566,7 +1024,7 @@ func file_proto_quickdb_v1_quickdb_proto_init() { return nil } } - file_proto_quickdb_v1_quickdb_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_v1_quickdb_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*File); i { case 0: return &v.state @@ -578,7 +1036,19 @@ func file_proto_quickdb_v1_quickdb_proto_init() { return nil } } - file_proto_quickdb_v1_quickdb_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_v1_quickdb_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QuerySet); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v1_quickdb_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UploadArchiveRequest); i { case 0: return &v.state @@ -590,7 +1060,7 @@ func file_proto_quickdb_v1_quickdb_proto_init() { return nil } } - file_proto_quickdb_v1_quickdb_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_v1_quickdb_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UploadArchiveResponse); i { case 0: return &v.state @@ -602,175 +1072,71 @@ func file_proto_quickdb_v1_quickdb_proto_init() { return nil } } + file_v1_quickdb_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VerifyQuerySetsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v1_quickdb_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VerifyQuerySetsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v1_quickdb_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetQuerySetsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v1_quickdb_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetQuerySetsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_proto_quickdb_v1_quickdb_proto_rawDesc, + RawDescriptor: file_v1_quickdb_proto_rawDesc, NumEnums: 0, - NumMessages: 7, + NumMessages: 14, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_proto_quickdb_v1_quickdb_proto_goTypes, - DependencyIndexes: file_proto_quickdb_v1_quickdb_proto_depIdxs, - MessageInfos: file_proto_quickdb_v1_quickdb_proto_msgTypes, + GoTypes: file_v1_quickdb_proto_goTypes, + DependencyIndexes: file_v1_quickdb_proto_depIdxs, + MessageInfos: file_v1_quickdb_proto_msgTypes, }.Build() - File_proto_quickdb_v1_quickdb_proto = out.File - file_proto_quickdb_v1_quickdb_proto_rawDesc = nil - file_proto_quickdb_v1_quickdb_proto_goTypes = nil - file_proto_quickdb_v1_quickdb_proto_depIdxs = nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// QuickClient is the client API for Quick service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type QuickClient interface { - CreateEphemeralDatabase(ctx context.Context, in *CreateEphemeralDatabaseRequest, opts ...grpc.CallOption) (*CreateEphemeralDatabaseResponse, error) - DropEphemeralDatabase(ctx context.Context, in *DropEphemeralDatabaseRequest, opts ...grpc.CallOption) (*DropEphemeralDatabaseResponse, error) - UploadArchive(ctx context.Context, in *UploadArchiveRequest, opts ...grpc.CallOption) (*UploadArchiveResponse, error) -} - -type quickClient struct { - cc grpc.ClientConnInterface -} - -func NewQuickClient(cc grpc.ClientConnInterface) QuickClient { - return &quickClient{cc} -} - -func (c *quickClient) CreateEphemeralDatabase(ctx context.Context, in *CreateEphemeralDatabaseRequest, opts ...grpc.CallOption) (*CreateEphemeralDatabaseResponse, error) { - out := new(CreateEphemeralDatabaseResponse) - err := c.cc.Invoke(ctx, "/remote.sqlc.dev.quickdb.v1.Quick/CreateEphemeralDatabase", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *quickClient) DropEphemeralDatabase(ctx context.Context, in *DropEphemeralDatabaseRequest, opts ...grpc.CallOption) (*DropEphemeralDatabaseResponse, error) { - out := new(DropEphemeralDatabaseResponse) - err := c.cc.Invoke(ctx, "/remote.sqlc.dev.quickdb.v1.Quick/DropEphemeralDatabase", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *quickClient) UploadArchive(ctx context.Context, in *UploadArchiveRequest, opts ...grpc.CallOption) (*UploadArchiveResponse, error) { - out := new(UploadArchiveResponse) - err := c.cc.Invoke(ctx, "/remote.sqlc.dev.quickdb.v1.Quick/UploadArchive", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QuickServer is the server API for Quick service. -type QuickServer interface { - CreateEphemeralDatabase(context.Context, *CreateEphemeralDatabaseRequest) (*CreateEphemeralDatabaseResponse, error) - DropEphemeralDatabase(context.Context, *DropEphemeralDatabaseRequest) (*DropEphemeralDatabaseResponse, error) - UploadArchive(context.Context, *UploadArchiveRequest) (*UploadArchiveResponse, error) -} - -// UnimplementedQuickServer can be embedded to have forward compatible implementations. -type UnimplementedQuickServer struct { -} - -func (*UnimplementedQuickServer) CreateEphemeralDatabase(context.Context, *CreateEphemeralDatabaseRequest) (*CreateEphemeralDatabaseResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateEphemeralDatabase not implemented") -} -func (*UnimplementedQuickServer) DropEphemeralDatabase(context.Context, *DropEphemeralDatabaseRequest) (*DropEphemeralDatabaseResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DropEphemeralDatabase not implemented") -} -func (*UnimplementedQuickServer) UploadArchive(context.Context, *UploadArchiveRequest) (*UploadArchiveResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UploadArchive not implemented") -} - -func RegisterQuickServer(s *grpc.Server, srv QuickServer) { - s.RegisterService(&_Quick_serviceDesc, srv) -} - -func _Quick_CreateEphemeralDatabase_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateEphemeralDatabaseRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QuickServer).CreateEphemeralDatabase(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/remote.sqlc.dev.quickdb.v1.Quick/CreateEphemeralDatabase", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QuickServer).CreateEphemeralDatabase(ctx, req.(*CreateEphemeralDatabaseRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Quick_DropEphemeralDatabase_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DropEphemeralDatabaseRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QuickServer).DropEphemeralDatabase(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/remote.sqlc.dev.quickdb.v1.Quick/DropEphemeralDatabase", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QuickServer).DropEphemeralDatabase(ctx, req.(*DropEphemeralDatabaseRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Quick_UploadArchive_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UploadArchiveRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QuickServer).UploadArchive(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/remote.sqlc.dev.quickdb.v1.Quick/UploadArchive", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QuickServer).UploadArchive(ctx, req.(*UploadArchiveRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Quick_serviceDesc = grpc.ServiceDesc{ - ServiceName: "remote.sqlc.dev.quickdb.v1.Quick", - HandlerType: (*QuickServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "CreateEphemeralDatabase", - Handler: _Quick_CreateEphemeralDatabase_Handler, - }, - { - MethodName: "DropEphemeralDatabase", - Handler: _Quick_DropEphemeralDatabase_Handler, - }, - { - MethodName: "UploadArchive", - Handler: _Quick_UploadArchive_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "proto/quickdb/v1/quickdb.proto", + File_v1_quickdb_proto = out.File + file_v1_quickdb_proto_rawDesc = nil + file_v1_quickdb_proto_goTypes = nil + file_v1_quickdb_proto_depIdxs = nil } diff --git a/internal/quickdb/v1/quickdb_grpc.pb.go b/internal/quickdb/v1/quickdb_grpc.pb.go new file mode 100644 index 0000000000..f8f4a131fc --- /dev/null +++ b/internal/quickdb/v1/quickdb_grpc.pb.go @@ -0,0 +1,257 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: v1/quickdb.proto + +package quickdbv1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + Quick_CreateEphemeralDatabase_FullMethodName = "/remote.sqlc.dev.quickdb.v1.Quick/CreateEphemeralDatabase" + Quick_DropEphemeralDatabase_FullMethodName = "/remote.sqlc.dev.quickdb.v1.Quick/DropEphemeralDatabase" + Quick_UploadArchive_FullMethodName = "/remote.sqlc.dev.quickdb.v1.Quick/UploadArchive" + Quick_VerifyQuerySets_FullMethodName = "/remote.sqlc.dev.quickdb.v1.Quick/VerifyQuerySets" + Quick_GetQuerySets_FullMethodName = "/remote.sqlc.dev.quickdb.v1.Quick/GetQuerySets" +) + +// QuickClient is the client API for Quick service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type QuickClient interface { + CreateEphemeralDatabase(ctx context.Context, in *CreateEphemeralDatabaseRequest, opts ...grpc.CallOption) (*CreateEphemeralDatabaseResponse, error) + DropEphemeralDatabase(ctx context.Context, in *DropEphemeralDatabaseRequest, opts ...grpc.CallOption) (*DropEphemeralDatabaseResponse, error) + UploadArchive(ctx context.Context, in *UploadArchiveRequest, opts ...grpc.CallOption) (*UploadArchiveResponse, error) + VerifyQuerySets(ctx context.Context, in *VerifyQuerySetsRequest, opts ...grpc.CallOption) (*VerifyQuerySetsResponse, error) + GetQuerySets(ctx context.Context, in *GetQuerySetsRequest, opts ...grpc.CallOption) (*GetQuerySetsResponse, error) +} + +type quickClient struct { + cc grpc.ClientConnInterface +} + +func NewQuickClient(cc grpc.ClientConnInterface) QuickClient { + return &quickClient{cc} +} + +func (c *quickClient) CreateEphemeralDatabase(ctx context.Context, in *CreateEphemeralDatabaseRequest, opts ...grpc.CallOption) (*CreateEphemeralDatabaseResponse, error) { + out := new(CreateEphemeralDatabaseResponse) + err := c.cc.Invoke(ctx, Quick_CreateEphemeralDatabase_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *quickClient) DropEphemeralDatabase(ctx context.Context, in *DropEphemeralDatabaseRequest, opts ...grpc.CallOption) (*DropEphemeralDatabaseResponse, error) { + out := new(DropEphemeralDatabaseResponse) + err := c.cc.Invoke(ctx, Quick_DropEphemeralDatabase_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *quickClient) UploadArchive(ctx context.Context, in *UploadArchiveRequest, opts ...grpc.CallOption) (*UploadArchiveResponse, error) { + out := new(UploadArchiveResponse) + err := c.cc.Invoke(ctx, Quick_UploadArchive_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *quickClient) VerifyQuerySets(ctx context.Context, in *VerifyQuerySetsRequest, opts ...grpc.CallOption) (*VerifyQuerySetsResponse, error) { + out := new(VerifyQuerySetsResponse) + err := c.cc.Invoke(ctx, Quick_VerifyQuerySets_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *quickClient) GetQuerySets(ctx context.Context, in *GetQuerySetsRequest, opts ...grpc.CallOption) (*GetQuerySetsResponse, error) { + out := new(GetQuerySetsResponse) + err := c.cc.Invoke(ctx, Quick_GetQuerySets_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QuickServer is the server API for Quick service. +// All implementations must embed UnimplementedQuickServer +// for forward compatibility +type QuickServer interface { + CreateEphemeralDatabase(context.Context, *CreateEphemeralDatabaseRequest) (*CreateEphemeralDatabaseResponse, error) + DropEphemeralDatabase(context.Context, *DropEphemeralDatabaseRequest) (*DropEphemeralDatabaseResponse, error) + UploadArchive(context.Context, *UploadArchiveRequest) (*UploadArchiveResponse, error) + VerifyQuerySets(context.Context, *VerifyQuerySetsRequest) (*VerifyQuerySetsResponse, error) + GetQuerySets(context.Context, *GetQuerySetsRequest) (*GetQuerySetsResponse, error) + mustEmbedUnimplementedQuickServer() +} + +// UnimplementedQuickServer must be embedded to have forward compatible implementations. +type UnimplementedQuickServer struct { +} + +func (UnimplementedQuickServer) CreateEphemeralDatabase(context.Context, *CreateEphemeralDatabaseRequest) (*CreateEphemeralDatabaseResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateEphemeralDatabase not implemented") +} +func (UnimplementedQuickServer) DropEphemeralDatabase(context.Context, *DropEphemeralDatabaseRequest) (*DropEphemeralDatabaseResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DropEphemeralDatabase not implemented") +} +func (UnimplementedQuickServer) UploadArchive(context.Context, *UploadArchiveRequest) (*UploadArchiveResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UploadArchive not implemented") +} +func (UnimplementedQuickServer) VerifyQuerySets(context.Context, *VerifyQuerySetsRequest) (*VerifyQuerySetsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method VerifyQuerySets not implemented") +} +func (UnimplementedQuickServer) GetQuerySets(context.Context, *GetQuerySetsRequest) (*GetQuerySetsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetQuerySets not implemented") +} +func (UnimplementedQuickServer) mustEmbedUnimplementedQuickServer() {} + +// UnsafeQuickServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to QuickServer will +// result in compilation errors. +type UnsafeQuickServer interface { + mustEmbedUnimplementedQuickServer() +} + +func RegisterQuickServer(s grpc.ServiceRegistrar, srv QuickServer) { + s.RegisterService(&Quick_ServiceDesc, srv) +} + +func _Quick_CreateEphemeralDatabase_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateEphemeralDatabaseRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QuickServer).CreateEphemeralDatabase(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Quick_CreateEphemeralDatabase_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QuickServer).CreateEphemeralDatabase(ctx, req.(*CreateEphemeralDatabaseRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Quick_DropEphemeralDatabase_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DropEphemeralDatabaseRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QuickServer).DropEphemeralDatabase(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Quick_DropEphemeralDatabase_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QuickServer).DropEphemeralDatabase(ctx, req.(*DropEphemeralDatabaseRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Quick_UploadArchive_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UploadArchiveRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QuickServer).UploadArchive(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Quick_UploadArchive_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QuickServer).UploadArchive(ctx, req.(*UploadArchiveRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Quick_VerifyQuerySets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(VerifyQuerySetsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QuickServer).VerifyQuerySets(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Quick_VerifyQuerySets_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QuickServer).VerifyQuerySets(ctx, req.(*VerifyQuerySetsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Quick_GetQuerySets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetQuerySetsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QuickServer).GetQuerySets(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Quick_GetQuerySets_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QuickServer).GetQuerySets(ctx, req.(*GetQuerySetsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Quick_ServiceDesc is the grpc.ServiceDesc for Quick service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Quick_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "remote.sqlc.dev.quickdb.v1.Quick", + HandlerType: (*QuickServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateEphemeralDatabase", + Handler: _Quick_CreateEphemeralDatabase_Handler, + }, + { + MethodName: "DropEphemeralDatabase", + Handler: _Quick_DropEphemeralDatabase_Handler, + }, + { + MethodName: "UploadArchive", + Handler: _Quick_UploadArchive_Handler, + }, + { + MethodName: "VerifyQuerySets", + Handler: _Quick_VerifyQuerySets_Handler, + }, + { + MethodName: "GetQuerySets", + Handler: _Quick_GetQuerySets_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "v1/quickdb.proto", +} diff --git a/internal/remote/rpc.go b/internal/remote/rpc.go index d7b8556454..4adc9f8681 100644 --- a/internal/remote/rpc.go +++ b/internal/remote/rpc.go @@ -2,23 +2,23 @@ package remote import ( "crypto/tls" - "os" "github.com/riza-io/grpc-go/credentials/basic" "google.golang.org/grpc" "google.golang.org/grpc/credentials" "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/rpc" ) const defaultHostname = "remote.sqlc.dev" func NewClient(cloudConfig config.Cloud) (GenClient, error) { authID := cloudConfig.Organization + "/" + cloudConfig.Project - authToken := os.Getenv("SQLC_AUTH_TOKEN") opts := []grpc.DialOption{ grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})), - grpc.WithPerRPCCredentials(basic.NewPerRPCCredentials(authID, authToken)), + grpc.WithPerRPCCredentials(basic.NewPerRPCCredentials(authID, cloudConfig.AuthToken)), + grpc.WithUnaryInterceptor(rpc.UnaryInterceptor), } hostname := cloudConfig.Hostname diff --git a/internal/rpc/errors.go b/internal/rpc/errors.go new file mode 100644 index 0000000000..80953343f8 --- /dev/null +++ b/internal/rpc/errors.go @@ -0,0 +1,13 @@ +package rpc + +import ( + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +const errMessageUnauthenticated = `rpc authentication failed + +You may be using a sqlc auth token that was created for a different project, +or your auth token may have expired.` + +var ErrUnauthenticated = status.New(codes.Unauthenticated, errMessageUnauthenticated).Err() diff --git a/internal/rpc/interceptor.go b/internal/rpc/interceptor.go new file mode 100644 index 0000000000..ac0490bd1a --- /dev/null +++ b/internal/rpc/interceptor.go @@ -0,0 +1,22 @@ +package rpc + +import ( + "context" + + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func UnaryInterceptor(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { + err := invoker(ctx, method, req, reply, cc, opts...) + + switch status.Convert(err).Code() { + case codes.OK: + return nil + case codes.Unauthenticated: + return ErrUnauthenticated + default: + return err + } +} diff --git a/internal/shfmt/shfmt.go b/internal/shfmt/shfmt.go index a3f1c5bbff..88f3074b71 100644 --- a/internal/shfmt/shfmt.go +++ b/internal/shfmt/shfmt.go @@ -1,16 +1,38 @@ package shfmt import ( + "os" "regexp" "strings" ) var pat = regexp.MustCompile(`\$\{[A-Z_]+\}`) -func Replace(f string, vars map[string]string) string { +type Replacer struct { + envmap map[string]string +} + +func (r *Replacer) Replace(f string) string { return pat.ReplaceAllStringFunc(f, func(s string) string { s = strings.TrimPrefix(s, "${") s = strings.TrimSuffix(s, "}") - return vars[s] + return r.envmap[s] }) } + +func NewReplacer(env []string) *Replacer { + r := Replacer{ + envmap: map[string]string{}, + } + if env == nil { + env = os.Environ() + } + for _, e := range env { + k, v, _ := strings.Cut(e, "=") + if k == "SQLC_AUTH_TOKEN" { + continue + } + r.envmap[k] = v + } + return &r +} diff --git a/internal/shfmt/shfmt_test.go b/internal/shfmt/shfmt_test.go index ce5c29ea5a..cf99ed220b 100644 --- a/internal/shfmt/shfmt_test.go +++ b/internal/shfmt/shfmt_test.go @@ -4,14 +4,14 @@ import "testing" func TestReplace(t *testing.T) { s := "POSTGRES_SQL://${PG_USER}:${PG_PASSWORD}@${PG_HOST}:${PG_PORT}/AUTHORS" - env := map[string]string{ - "PG_USER": "user", - "PG_PASSWORD": "password", - "PG_HOST": "host", - "PG_PORT": "port", - } + r := NewReplacer([]string{ + "PG_USER=user", + "PG_PASSWORD=password", + "PG_HOST=host", + "PG_PORT=port", + }) e := "POSTGRES_SQL://user:password@host:port/AUTHORS" - if v := Replace(s, env); v != e { + if v := r.Replace(s); v != e { t.Errorf("%s != %s", v, e) } } diff --git a/internal/source/code.go b/internal/source/code.go index f34e3e3684..8b88a24136 100644 --- a/internal/source/code.go +++ b/internal/source/code.go @@ -15,6 +15,12 @@ type Edit struct { OldFunc func(string) int } +type CommentSyntax struct { + Dash bool + Hash bool + SlashStar bool +} + func LineNumber(source string, head int) (int, int) { // Calculate the true line and column number for a query, ignoring spaces var comment bool @@ -101,6 +107,9 @@ func StripComments(sql string) (string, []string, error) { if strings.HasPrefix(t, "/* name:") && strings.HasSuffix(t, "*/") { continue } + if strings.HasPrefix(t, "# name:") { + continue + } if strings.HasPrefix(t, "--") { comments = append(comments, strings.TrimPrefix(t, "--")) continue @@ -111,7 +120,46 @@ func StripComments(sql string) (string, []string, error) { comments = append(comments, t) continue } + if strings.HasPrefix(t, "#") { + comments = append(comments, strings.TrimPrefix(t, "#")) + continue + } lines = append(lines, t) } return strings.Join(lines, "\n"), comments, s.Err() } + +func CleanedComments(rawSQL string, cs CommentSyntax) ([]string, error) { + s := bufio.NewScanner(strings.NewReader(strings.TrimSpace(rawSQL))) + var comments []string + for s.Scan() { + line := s.Text() + var prefix string + if strings.HasPrefix(line, "--") { + if !cs.Dash { + continue + } + prefix = "--" + } + if strings.HasPrefix(line, "/*") { + if !cs.SlashStar { + continue + } + prefix = "/*" + } + if strings.HasPrefix(line, "#") { + if !cs.Hash { + continue + } + prefix = "#" + } + if prefix == "" { + continue + } + + rest := line[len(prefix):] + rest = strings.TrimSuffix(rest, "*/") + comments = append(comments, rest) + } + return comments, s.Err() +} diff --git a/internal/sql/ast/a_const.go b/internal/sql/ast/a_const.go index 720dca4a11..ec1d780945 100644 --- a/internal/sql/ast/a_const.go +++ b/internal/sql/ast/a_const.go @@ -8,3 +8,16 @@ type A_Const struct { func (n *A_Const) Pos() int { return n.Location } + +func (n *A_Const) Format(buf *TrackedBuffer) { + if n == nil { + return + } + if _, ok := n.Val.(*String); ok { + buf.WriteString("'") + buf.astFormat(n.Val) + buf.WriteString("'") + } else { + buf.astFormat(n.Val) + } +} diff --git a/internal/sql/ast/a_expr.go b/internal/sql/ast/a_expr.go index 415dd1e23f..b0b7f75367 100644 --- a/internal/sql/ast/a_expr.go +++ b/internal/sql/ast/a_expr.go @@ -11,3 +11,24 @@ type A_Expr struct { func (n *A_Expr) Pos() int { return n.Location } + +func (n *A_Expr) Format(buf *TrackedBuffer) { + if n == nil { + return + } + buf.astFormat(n.Lexpr) + buf.WriteString(" ") + switch n.Kind { + case A_Expr_Kind_IN: + buf.WriteString(" IN (") + buf.astFormat(n.Rexpr) + buf.WriteString(")") + case A_Expr_Kind_LIKE: + buf.WriteString(" LIKE ") + buf.astFormat(n.Rexpr) + default: + buf.astFormat(n.Name) + buf.WriteString(" ") + buf.astFormat(n.Rexpr) + } +} diff --git a/internal/sql/ast/a_expr_kind.go b/internal/sql/ast/a_expr_kind.go index 50fc6bc6bb..53a237896b 100644 --- a/internal/sql/ast/a_expr_kind.go +++ b/internal/sql/ast/a_expr_kind.go @@ -2,6 +2,11 @@ package ast type A_Expr_Kind uint +const ( + A_Expr_Kind_IN A_Expr_Kind = 7 + A_Expr_Kind_LIKE A_Expr_Kind = 8 +) + func (n *A_Expr_Kind) Pos() int { return 0 } diff --git a/internal/sql/ast/a_star.go b/internal/sql/ast/a_star.go index accd0f7dd8..a43b2ab5b7 100644 --- a/internal/sql/ast/a_star.go +++ b/internal/sql/ast/a_star.go @@ -6,3 +6,10 @@ type A_Star struct { func (n *A_Star) Pos() int { return 0 } + +func (n *A_Star) Format(buf *TrackedBuffer) { + if n == nil { + return + } + buf.WriteRune('*') +} diff --git a/internal/sql/ast/aggref.go b/internal/sql/ast/aggref.go index c4fa9af7e5..6642f4d9e3 100644 --- a/internal/sql/ast/aggref.go +++ b/internal/sql/ast/aggref.go @@ -6,7 +6,6 @@ type Aggref struct { Aggtype Oid Aggcollid Oid Inputcollid Oid - Aggtranstype Oid Aggargtypes *List Aggdirectargs *List Args *List diff --git a/internal/sql/ast/alias.go b/internal/sql/ast/alias.go index 7c6302a5ef..55965b55c9 100644 --- a/internal/sql/ast/alias.go +++ b/internal/sql/ast/alias.go @@ -8,3 +8,17 @@ type Alias struct { func (n *Alias) Pos() int { return 0 } + +func (n *Alias) Format(buf *TrackedBuffer) { + if n == nil { + return + } + if n.Aliasname != nil { + buf.WriteString(*n.Aliasname) + } + if items(n.Colnames) { + buf.WriteString("(") + buf.astFormat((n.Colnames)) + buf.WriteString(")") + } +} diff --git a/internal/sql/ast/alter_table_cmd.go b/internal/sql/ast/alter_table_cmd.go index 3c6be340cd..80fad95eaf 100644 --- a/internal/sql/ast/alter_table_cmd.go +++ b/internal/sql/ast/alter_table_cmd.go @@ -39,3 +39,17 @@ type AlterTableCmd struct { func (n *AlterTableCmd) Pos() int { return 0 } + +func (n *AlterTableCmd) Format(buf *TrackedBuffer) { + if n == nil { + return + } + switch n.Subtype { + case AT_AddColumn: + buf.WriteString(" ADD COLUMN ") + case AT_DropColumn: + buf.WriteString(" DROP COLUMN ") + } + + buf.astFormat(n.Def) +} diff --git a/internal/sql/ast/alter_table_stmt.go b/internal/sql/ast/alter_table_stmt.go index 245d7c6821..5d4a22f50e 100644 --- a/internal/sql/ast/alter_table_stmt.go +++ b/internal/sql/ast/alter_table_stmt.go @@ -12,3 +12,13 @@ type AlterTableStmt struct { func (n *AlterTableStmt) Pos() int { return 0 } + +func (n *AlterTableStmt) Format(buf *TrackedBuffer) { + if n == nil { + return + } + buf.WriteString("ALTER TABLE ") + buf.astFormat(n.Relation) + buf.astFormat(n.Table) + buf.astFormat(n.Cmds) +} diff --git a/internal/sql/ast/bool_expr.go b/internal/sql/ast/bool_expr.go index 41ddba949b..6d15276a05 100644 --- a/internal/sql/ast/bool_expr.go +++ b/internal/sql/ast/bool_expr.go @@ -10,3 +10,22 @@ type BoolExpr struct { func (n *BoolExpr) Pos() int { return n.Location } + +func (n *BoolExpr) Format(buf *TrackedBuffer) { + if n == nil { + return + } + buf.WriteString("(") + if items(n.Args) { + switch n.Boolop { + case BoolExprTypeAnd: + buf.join(n.Args, " AND ") + case BoolExprTypeOr: + buf.join(n.Args, " OR ") + case BoolExprTypeNot: + buf.WriteString(" NOT ") + buf.astFormat(n.Args) + } + } + buf.WriteString(")") +} diff --git a/internal/sql/ast/boolean.go b/internal/sql/ast/boolean.go index cf193f2c12..522af84868 100644 --- a/internal/sql/ast/boolean.go +++ b/internal/sql/ast/boolean.go @@ -1,5 +1,7 @@ package ast +import "fmt" + type Boolean struct { Boolval bool } @@ -7,3 +9,14 @@ type Boolean struct { func (n *Boolean) Pos() int { return 0 } + +func (n *Boolean) Format(buf *TrackedBuffer) { + if n == nil { + return + } + if n.Boolval { + fmt.Fprintf(buf, "true") + } else { + fmt.Fprintf(buf, "false") + } +} diff --git a/internal/sql/ast/call_stmt.go b/internal/sql/ast/call_stmt.go index 252bfb3169..5267a1ff3f 100644 --- a/internal/sql/ast/call_stmt.go +++ b/internal/sql/ast/call_stmt.go @@ -10,3 +10,8 @@ func (n *CallStmt) Pos() int { } return n.FuncCall.Pos() } + +func (n *CallStmt) Format(buf *TrackedBuffer) { + buf.WriteString("CALL ") + buf.astFormat(n.FuncCall) +} diff --git a/internal/sql/ast/case_expr.go b/internal/sql/ast/case_expr.go index c23ffae2a4..1da54f0d78 100644 --- a/internal/sql/ast/case_expr.go +++ b/internal/sql/ast/case_expr.go @@ -13,3 +13,14 @@ type CaseExpr struct { func (n *CaseExpr) Pos() int { return n.Location } + +func (n *CaseExpr) Format(buf *TrackedBuffer) { + if n == nil { + return + } + buf.WriteString("CASE ") + buf.astFormat(n.Args) + buf.WriteString(" ELSE ") + buf.astFormat(n.Defresult) + buf.WriteString(" END ") +} diff --git a/internal/sql/ast/case_when.go b/internal/sql/ast/case_when.go index 9b8a488955..b036411d54 100644 --- a/internal/sql/ast/case_when.go +++ b/internal/sql/ast/case_when.go @@ -10,3 +10,13 @@ type CaseWhen struct { func (n *CaseWhen) Pos() int { return n.Location } + +func (n *CaseWhen) Format(buf *TrackedBuffer) { + if n == nil { + return + } + buf.WriteString("WHEN ") + buf.astFormat(n.Expr) + buf.WriteString(" THEN ") + buf.astFormat(n.Result) +} diff --git a/internal/sql/ast/coalesce_expr.go b/internal/sql/ast/coalesce_expr.go index 513b495445..cbf7025748 100644 --- a/internal/sql/ast/coalesce_expr.go +++ b/internal/sql/ast/coalesce_expr.go @@ -11,3 +11,12 @@ type CoalesceExpr struct { func (n *CoalesceExpr) Pos() int { return n.Location } + +func (n *CoalesceExpr) Format(buf *TrackedBuffer) { + if n == nil { + return + } + buf.WriteString("COALESCE(") + buf.astFormat(n.Args) + buf.WriteString(")") +} diff --git a/internal/sql/ast/column_def.go b/internal/sql/ast/column_def.go index c4cd372437..f9504eefc7 100644 --- a/internal/sql/ast/column_def.go +++ b/internal/sql/ast/column_def.go @@ -9,6 +9,7 @@ type ColumnDef struct { ArrayDims int Vals *List Length *int + PrimaryKey bool // From pg.ColumnDef Inhcount int @@ -30,3 +31,18 @@ type ColumnDef struct { func (n *ColumnDef) Pos() int { return n.Location } + +func (n *ColumnDef) Format(buf *TrackedBuffer) { + if n == nil { + return + } + buf.WriteString(n.Colname) + buf.WriteString(" ") + buf.astFormat(n.TypeName) + if n.PrimaryKey { + buf.WriteString(" PRIMARY KEY") + } else if n.IsNotNull { + buf.WriteString(" NOT NULL") + } + buf.astFormat(n.Constraints) +} diff --git a/internal/sql/ast/column_ref.go b/internal/sql/ast/column_ref.go index 891fa163f7..e95b844896 100644 --- a/internal/sql/ast/column_ref.go +++ b/internal/sql/ast/column_ref.go @@ -1,5 +1,7 @@ package ast +import "strings" + type ColumnRef struct { Name string @@ -11,3 +13,26 @@ type ColumnRef struct { func (n *ColumnRef) Pos() int { return n.Location } + +func (n *ColumnRef) Format(buf *TrackedBuffer) { + if n == nil { + return + } + + if n.Fields != nil { + var items []string + for _, item := range n.Fields.Items { + switch nn := item.(type) { + case *String: + if nn.Str == "user" { + items = append(items, `"user"`) + } else { + items = append(items, nn.Str) + } + case *A_Star: + items = append(items, "*") + } + } + buf.WriteString(strings.Join(items, ".")) + } +} diff --git a/internal/sql/ast/common_table_expr.go b/internal/sql/ast/common_table_expr.go index d5ae01f040..f2edddff79 100644 --- a/internal/sql/ast/common_table_expr.go +++ b/internal/sql/ast/common_table_expr.go @@ -1,5 +1,9 @@ package ast +import ( + "fmt" +) + type CommonTableExpr struct { Ctename *string Aliascolnames *List @@ -16,3 +20,14 @@ type CommonTableExpr struct { func (n *CommonTableExpr) Pos() int { return n.Location } + +func (n *CommonTableExpr) Format(buf *TrackedBuffer) { + if n == nil { + return + } + if n.Ctename != nil { + fmt.Fprintf(buf, " %s AS (", *n.Ctename) + } + buf.astFormat(n.Ctequery) + buf.WriteString(")") +} diff --git a/internal/sql/ast/create_table_stmt.go b/internal/sql/ast/create_table_stmt.go index 7273ffa852..ce88a1b244 100644 --- a/internal/sql/ast/create_table_stmt.go +++ b/internal/sql/ast/create_table_stmt.go @@ -12,3 +12,20 @@ type CreateTableStmt struct { func (n *CreateTableStmt) Pos() int { return 0 } + +func (n *CreateTableStmt) Format(buf *TrackedBuffer) { + if n == nil { + return + } + buf.WriteString("CREATE TABLE ") + buf.astFormat(n.Name) + + buf.WriteString("(") + for i, col := range n.Cols { + if i > 0 { + buf.WriteString(", ") + } + buf.astFormat(col) + } + buf.WriteString(")") +} diff --git a/internal/sql/ast/delete_stmt.go b/internal/sql/ast/delete_stmt.go index 45b6a35869..d77f043a12 100644 --- a/internal/sql/ast/delete_stmt.go +++ b/internal/sql/ast/delete_stmt.go @@ -12,3 +12,34 @@ type DeleteStmt struct { func (n *DeleteStmt) Pos() int { return 0 } + +func (n *DeleteStmt) Format(buf *TrackedBuffer) { + if n == nil { + return + } + + if n.WithClause != nil { + buf.astFormat(n.WithClause) + buf.WriteString(" ") + } + + buf.WriteString("DELETE FROM ") + if items(n.Relations) { + buf.astFormat(n.Relations) + } + + if set(n.WhereClause) { + buf.WriteString(" WHERE ") + buf.astFormat(n.WhereClause) + } + + if set(n.LimitCount) { + buf.WriteString(" LIMIT ") + buf.astFormat(n.LimitCount) + } + + if items(n.ReturningList) { + buf.WriteString(" RETURNING ") + buf.astFormat(n.ReturningList) + } +} diff --git a/internal/sql/ast/float.go b/internal/sql/ast/float.go index 8e5ef10f97..fee8655bbe 100644 --- a/internal/sql/ast/float.go +++ b/internal/sql/ast/float.go @@ -7,3 +7,10 @@ type Float struct { func (n *Float) Pos() int { return 0 } + +func (n *Float) Format(buf *TrackedBuffer) { + if n == nil { + return + } + buf.WriteString(n.Str) +} diff --git a/internal/sql/ast/func_call.go b/internal/sql/ast/func_call.go index f3feb82225..2bfe961b50 100644 --- a/internal/sql/ast/func_call.go +++ b/internal/sql/ast/func_call.go @@ -17,3 +17,17 @@ type FuncCall struct { func (n *FuncCall) Pos() int { return n.Location } + +func (n *FuncCall) Format(buf *TrackedBuffer) { + if n == nil { + return + } + buf.astFormat(n.Func) + buf.WriteString("(") + if n.AggStar { + buf.WriteString("*") + } else { + buf.astFormat(n.Args) + } + buf.WriteString(")") +} diff --git a/internal/sql/ast/func_name.go b/internal/sql/ast/func_name.go index e8b93a752c..29b8e0fa61 100644 --- a/internal/sql/ast/func_name.go +++ b/internal/sql/ast/func_name.go @@ -9,3 +9,16 @@ type FuncName struct { func (n *FuncName) Pos() int { return 0 } + +func (n *FuncName) Format(buf *TrackedBuffer) { + if n == nil { + return + } + if n.Schema != "" { + buf.WriteString(n.Schema) + buf.WriteString(".") + } + if n.Name != "" { + buf.WriteString(n.Name) + } +} diff --git a/internal/sql/ast/grant_role_stmt.go b/internal/sql/ast/grant_role_stmt.go index 5d785efa7e..5e0b2a8e87 100644 --- a/internal/sql/ast/grant_role_stmt.go +++ b/internal/sql/ast/grant_role_stmt.go @@ -4,7 +4,6 @@ type GrantRoleStmt struct { GrantedRoles *List GranteeRoles *List IsGrant bool - AdminOpt bool Grantor *RoleSpec Behavior DropBehavior } diff --git a/internal/sql/ast/index_stmt.go b/internal/sql/ast/index_stmt.go index c0f12bdb68..fe0f03593c 100644 --- a/internal/sql/ast/index_stmt.go +++ b/internal/sql/ast/index_stmt.go @@ -11,7 +11,6 @@ type IndexStmt struct { ExcludeOpNames *List Idxcomment *string IndexOid Oid - OldNode Oid Unique bool Primary bool Isconstraint bool diff --git a/internal/sql/ast/insert_stmt.go b/internal/sql/ast/insert_stmt.go index 12ee24846c..3cdf854091 100644 --- a/internal/sql/ast/insert_stmt.go +++ b/internal/sql/ast/insert_stmt.go @@ -13,3 +13,37 @@ type InsertStmt struct { func (n *InsertStmt) Pos() int { return 0 } + +func (n *InsertStmt) Format(buf *TrackedBuffer) { + if n == nil { + return + } + + if n.WithClause != nil { + buf.astFormat(n.WithClause) + buf.WriteString(" ") + } + + buf.WriteString("INSERT INTO ") + if n.Relation != nil { + buf.astFormat(n.Relation) + } + if items(n.Cols) { + buf.WriteString(" (") + buf.astFormat(n.Cols) + buf.WriteString(") ") + } + + if set(n.SelectStmt) { + buf.astFormat(n.SelectStmt) + } + + if n.OnConflictClause != nil { + buf.WriteString(" ON CONFLICT DO NOTHING ") + } + + if items(n.ReturningList) { + buf.WriteString(" RETURNING ") + buf.astFormat(n.ReturningList) + } +} diff --git a/internal/sql/ast/integer.go b/internal/sql/ast/integer.go index a00e906b22..e9f911add2 100644 --- a/internal/sql/ast/integer.go +++ b/internal/sql/ast/integer.go @@ -1,5 +1,7 @@ package ast +import "strconv" + type Integer struct { Ival int64 } @@ -7,3 +9,10 @@ type Integer struct { func (n *Integer) Pos() int { return 0 } + +func (n *Integer) Format(buf *TrackedBuffer) { + if n == nil { + return + } + buf.WriteString(strconv.FormatInt(n.Ival, 10)) +} diff --git a/internal/sql/ast/join_expr.go b/internal/sql/ast/join_expr.go index 86e38d2d3b..e316869560 100644 --- a/internal/sql/ast/join_expr.go +++ b/internal/sql/ast/join_expr.go @@ -14,3 +14,29 @@ type JoinExpr struct { func (n *JoinExpr) Pos() int { return 0 } + +func (n *JoinExpr) Format(buf *TrackedBuffer) { + if n == nil { + return + } + buf.astFormat(n.Larg) + switch n.Jointype { + case JoinTypeLeft: + buf.WriteString(" LEFT JOIN ") + case JoinTypeInner: + buf.WriteString(" INNER JOIN ") + default: + buf.WriteString(" JOIN ") + } + buf.astFormat(n.Rarg) + buf.WriteString(" ON ") + if n.Jointype == JoinTypeInner { + if set(n.Quals) { + buf.astFormat(n.Quals) + } else { + buf.WriteString("TRUE") + } + } else { + buf.astFormat(n.Quals) + } +} diff --git a/internal/sql/ast/list.go b/internal/sql/ast/list.go index ae49b0c429..1c89d55339 100644 --- a/internal/sql/ast/list.go +++ b/internal/sql/ast/list.go @@ -7,3 +7,10 @@ type List struct { func (n *List) Pos() int { return 0 } + +func (n *List) Format(buf *TrackedBuffer) { + if n == nil { + return + } + buf.join(n, ",") +} diff --git a/internal/sql/ast/listen_stmt.go b/internal/sql/ast/listen_stmt.go index cbd51dd90a..79c1b132c1 100644 --- a/internal/sql/ast/listen_stmt.go +++ b/internal/sql/ast/listen_stmt.go @@ -7,3 +7,13 @@ type ListenStmt struct { func (n *ListenStmt) Pos() int { return 0 } + +func (n *ListenStmt) Format(buf *TrackedBuffer) { + if n == nil { + return + } + buf.WriteString("LISTEN ") + if n.Conditionname != nil { + buf.WriteString(*n.Conditionname) + } +} diff --git a/internal/sql/ast/locking_clause.go b/internal/sql/ast/locking_clause.go index 5800a03806..11a9159de2 100644 --- a/internal/sql/ast/locking_clause.go +++ b/internal/sql/ast/locking_clause.go @@ -9,3 +9,16 @@ type LockingClause struct { func (n *LockingClause) Pos() int { return 0 } + +func (n *LockingClause) Format(buf *TrackedBuffer) { + if n == nil { + return + } + buf.WriteString("FOR ") + switch n.Strength { + case 3: + buf.WriteString("SHARE") + case 5: + buf.WriteString("UPDATE") + } +} diff --git a/internal/sql/ast/multi_assign_ref.go b/internal/sql/ast/multi_assign_ref.go index ef0d5554c3..16302b4e4c 100644 --- a/internal/sql/ast/multi_assign_ref.go +++ b/internal/sql/ast/multi_assign_ref.go @@ -9,3 +9,10 @@ type MultiAssignRef struct { func (n *MultiAssignRef) Pos() int { return 0 } + +func (n *MultiAssignRef) Format(buf *TrackedBuffer) { + if n == nil { + return + } + buf.astFormat(n.Source) +} diff --git a/internal/sql/ast/named_arg_expr.go b/internal/sql/ast/named_arg_expr.go index 1c802bdd26..e37427826e 100644 --- a/internal/sql/ast/named_arg_expr.go +++ b/internal/sql/ast/named_arg_expr.go @@ -11,3 +11,14 @@ type NamedArgExpr struct { func (n *NamedArgExpr) Pos() int { return n.Location } + +func (n *NamedArgExpr) Format(buf *TrackedBuffer) { + if n == nil { + return + } + if n.Name != nil { + buf.WriteString(*n.Name) + } + buf.WriteString(" => ") + buf.astFormat(n.Arg) +} diff --git a/internal/sql/ast/notify_stmt.go b/internal/sql/ast/notify_stmt.go index ef3058df56..0c50a11123 100644 --- a/internal/sql/ast/notify_stmt.go +++ b/internal/sql/ast/notify_stmt.go @@ -8,3 +8,18 @@ type NotifyStmt struct { func (n *NotifyStmt) Pos() int { return 0 } + +func (n *NotifyStmt) Format(buf *TrackedBuffer) { + if n == nil { + return + } + buf.WriteString("NOTIFY ") + if n.Conditionname != nil { + buf.WriteString(*n.Conditionname) + } + if n.Payload != nil { + buf.WriteString(", '") + buf.WriteString(*n.Payload) + buf.WriteString("'") + } +} diff --git a/internal/sql/ast/null.go b/internal/sql/ast/null.go index 92abc76c02..380c8e7372 100644 --- a/internal/sql/ast/null.go +++ b/internal/sql/ast/null.go @@ -6,3 +6,6 @@ type Null struct { func (n *Null) Pos() int { return 0 } +func (n *Null) Format(buf *TrackedBuffer) { + buf.WriteString("NULL") +} diff --git a/internal/sql/ast/op_expr.go b/internal/sql/ast/op_expr.go index 5b371545dc..0c7c21726e 100644 --- a/internal/sql/ast/op_expr.go +++ b/internal/sql/ast/op_expr.go @@ -3,7 +3,6 @@ package ast type OpExpr struct { Xpr Node Opno Oid - Opfuncid Oid Opresulttype Oid Opretset bool Opcollid Oid diff --git a/internal/sql/ast/param_ref.go b/internal/sql/ast/param_ref.go index d0f486cf85..8bd724993d 100644 --- a/internal/sql/ast/param_ref.go +++ b/internal/sql/ast/param_ref.go @@ -1,5 +1,7 @@ package ast +import "fmt" + type ParamRef struct { Number int Location int @@ -9,3 +11,10 @@ type ParamRef struct { func (n *ParamRef) Pos() int { return n.Location } + +func (n *ParamRef) Format(buf *TrackedBuffer) { + if n == nil { + return + } + fmt.Fprintf(buf, "$%d", n.Number) +} diff --git a/internal/sql/ast/print.go b/internal/sql/ast/print.go new file mode 100644 index 0000000000..867a53a177 --- /dev/null +++ b/internal/sql/ast/print.go @@ -0,0 +1,81 @@ +package ast + +import ( + "strings" + + "github.com/sqlc-dev/sqlc/internal/debug" +) + +type formatter interface { + Format(*TrackedBuffer) +} + +type TrackedBuffer struct { + *strings.Builder +} + +// NewTrackedBuffer creates a new TrackedBuffer. +func NewTrackedBuffer() *TrackedBuffer { + buf := &TrackedBuffer{ + Builder: new(strings.Builder), + } + return buf +} + +func (t *TrackedBuffer) astFormat(n Node) { + if ft, ok := n.(formatter); ok { + ft.Format(t) + } else { + debug.Dump(n) + } +} + +func (t *TrackedBuffer) join(n *List, sep string) { + if n == nil { + return + } + for i, item := range n.Items { + if _, ok := item.(*TODO); ok { + continue + } + if i > 0 { + t.WriteString(sep) + } + t.astFormat(item) + } +} + +func Format(n Node) string { + tb := NewTrackedBuffer() + if ft, ok := n.(formatter); ok { + ft.Format(tb) + } + return tb.String() +} + +func set(n Node) bool { + if n == nil { + return false + } + _, ok := n.(*TODO) + if ok { + return false + } + return true +} + +func items(n *List) bool { + if n == nil { + return false + } + return len(n.Items) > 0 +} + +func todo(n *List) bool { + for _, item := range n.Items { + if _, ok := item.(*TODO); !ok { + return false + } + } + return true +} diff --git a/internal/sql/ast/range_function.go b/internal/sql/ast/range_function.go index dd92870aa4..299078d481 100644 --- a/internal/sql/ast/range_function.go +++ b/internal/sql/ast/range_function.go @@ -12,3 +12,14 @@ type RangeFunction struct { func (n *RangeFunction) Pos() int { return 0 } + +func (n *RangeFunction) Format(buf *TrackedBuffer) { + if n == nil { + return + } + buf.astFormat(n.Functions) + if n.Ordinality { + buf.WriteString(" WITH ORDINALITY ") + } + buf.astFormat(n.Alias) +} diff --git a/internal/sql/ast/range_subselect.go b/internal/sql/ast/range_subselect.go index aaf4d5adaf..1506ee7994 100644 --- a/internal/sql/ast/range_subselect.go +++ b/internal/sql/ast/range_subselect.go @@ -9,3 +9,16 @@ type RangeSubselect struct { func (n *RangeSubselect) Pos() int { return 0 } + +func (n *RangeSubselect) Format(buf *TrackedBuffer) { + if n == nil { + return + } + buf.WriteString("(") + buf.astFormat(n.Subquery) + buf.WriteString(")") + if n.Alias != nil { + buf.WriteString(" ") + buf.astFormat(n.Alias) + } +} diff --git a/internal/sql/ast/range_var.go b/internal/sql/ast/range_var.go index 3b648ff7c3..1d1656f6c0 100644 --- a/internal/sql/ast/range_var.go +++ b/internal/sql/ast/range_var.go @@ -13,3 +13,27 @@ type RangeVar struct { func (n *RangeVar) Pos() int { return n.Location } + +func (n *RangeVar) Format(buf *TrackedBuffer) { + if n == nil { + return + } + if n.Schemaname != nil { + buf.WriteString(*n.Schemaname) + buf.WriteString(".") + } + if n.Relname != nil { + // TODO: What names need to be quoted + if *n.Relname == "user" { + buf.WriteString(`"`) + buf.WriteString(*n.Relname) + buf.WriteString(`"`) + } else { + buf.WriteString(*n.Relname) + } + } + if n.Alias != nil { + buf.WriteString(" ") + buf.astFormat(n.Alias) + } +} diff --git a/internal/sql/ast/raw_stmt.go b/internal/sql/ast/raw_stmt.go index 3e9e89329f..55192d2eec 100644 --- a/internal/sql/ast/raw_stmt.go +++ b/internal/sql/ast/raw_stmt.go @@ -9,3 +9,10 @@ type RawStmt struct { func (n *RawStmt) Pos() int { return n.StmtLocation } + +func (n *RawStmt) Format(buf *TrackedBuffer) { + if n.Stmt != nil { + buf.astFormat(n.Stmt) + } + buf.WriteString(";") +} diff --git a/internal/sql/ast/refresh_mat_view_stmt.go b/internal/sql/ast/refresh_mat_view_stmt.go index 9284c343de..e9b3e26bfa 100644 --- a/internal/sql/ast/refresh_mat_view_stmt.go +++ b/internal/sql/ast/refresh_mat_view_stmt.go @@ -9,3 +9,11 @@ type RefreshMatViewStmt struct { func (n *RefreshMatViewStmt) Pos() int { return 0 } + +func (n *RefreshMatViewStmt) Format(buf *TrackedBuffer) { + if n == nil { + return + } + buf.WriteString("REFRESH MATERIALIZED VIEW ") + buf.astFormat(n.Relation) +} diff --git a/internal/sql/ast/res_target.go b/internal/sql/ast/res_target.go index f9428e3885..4ee2e72112 100644 --- a/internal/sql/ast/res_target.go +++ b/internal/sql/ast/res_target.go @@ -10,3 +10,20 @@ type ResTarget struct { func (n *ResTarget) Pos() int { return n.Location } + +func (n *ResTarget) Format(buf *TrackedBuffer) { + if n == nil { + return + } + if set(n.Val) { + buf.astFormat(n.Val) + if n.Name != nil { + buf.WriteString(" AS ") + buf.WriteString(*n.Name) + } + } else { + if n.Name != nil { + buf.WriteString(*n.Name) + } + } +} diff --git a/internal/sql/ast/row_expr.go b/internal/sql/ast/row_expr.go index 7e996b0e93..14804f5821 100644 --- a/internal/sql/ast/row_expr.go +++ b/internal/sql/ast/row_expr.go @@ -12,3 +12,18 @@ type RowExpr struct { func (n *RowExpr) Pos() int { return n.Location } + +func (n *RowExpr) Format(buf *TrackedBuffer) { + if n == nil { + return + } + if items(n.Args) { + buf.WriteString("args") + buf.astFormat(n.Args) + } + buf.astFormat(n.Xpr) + if items(n.Colnames) { + buf.WriteString("cols") + buf.astFormat(n.Colnames) + } +} diff --git a/internal/sql/ast/scalar_array_op_expr.go b/internal/sql/ast/scalar_array_op_expr.go index 6b9ad6ad8b..fc438c10b3 100644 --- a/internal/sql/ast/scalar_array_op_expr.go +++ b/internal/sql/ast/scalar_array_op_expr.go @@ -3,7 +3,6 @@ package ast type ScalarArrayOpExpr struct { Xpr Node Opno Oid - Opfuncid Oid UseOr bool Inputcollid Oid Args *List diff --git a/internal/sql/ast/select_stmt.go b/internal/sql/ast/select_stmt.go index 75a109c931..051dd5c8c5 100644 --- a/internal/sql/ast/select_stmt.go +++ b/internal/sql/ast/select_stmt.go @@ -1,5 +1,9 @@ package ast +import ( + "fmt" +) + type SelectStmt struct { DistinctClause *List IntoClause *IntoClause @@ -24,3 +28,85 @@ type SelectStmt struct { func (n *SelectStmt) Pos() int { return 0 } + +func (n *SelectStmt) Format(buf *TrackedBuffer) { + if n == nil { + return + } + + if items(n.ValuesLists) { + buf.WriteString("VALUES (") + buf.astFormat(n.ValuesLists) + buf.WriteString(")") + return + } + + if n.WithClause != nil { + buf.astFormat(n.WithClause) + buf.WriteString(" ") + } + + if n.Larg != nil && n.Rarg != nil { + buf.astFormat(n.Larg) + switch n.Op { + case Union: + buf.WriteString(" UNION ") + case Except: + buf.WriteString(" EXCEPT ") + case Intersect: + buf.WriteString(" INTERSECT ") + } + if n.All { + buf.WriteString("ALL ") + } + buf.astFormat(n.Rarg) + } else { + buf.WriteString("SELECT ") + } + + if items(n.DistinctClause) { + buf.WriteString("DISTINCT ") + if !todo(n.DistinctClause) { + fmt.Fprintf(buf, "ON (") + buf.astFormat(n.DistinctClause) + fmt.Fprintf(buf, ")") + } + } + buf.astFormat(n.TargetList) + + if items(n.FromClause) { + buf.WriteString(" FROM ") + buf.astFormat(n.FromClause) + } + + if set(n.WhereClause) { + buf.WriteString(" WHERE ") + buf.astFormat(n.WhereClause) + } + + if items(n.GroupClause) { + buf.WriteString(" GROUP BY ") + buf.astFormat(n.GroupClause) + } + + if items(n.SortClause) { + buf.WriteString(" ORDER BY ") + buf.astFormat(n.SortClause) + } + + if set(n.LimitCount) { + buf.WriteString(" LIMIT ") + buf.astFormat(n.LimitCount) + } + + if set(n.LimitOffset) { + buf.WriteString(" OFFSET ") + buf.astFormat(n.LimitOffset) + } + + if items(n.LockingClause) { + buf.WriteString(" ") + buf.astFormat(n.LockingClause) + } + +} diff --git a/internal/sql/ast/sort_by.go b/internal/sql/ast/sort_by.go index 49c4004f28..21a7a079aa 100644 --- a/internal/sql/ast/sort_by.go +++ b/internal/sql/ast/sort_by.go @@ -11,3 +11,16 @@ type SortBy struct { func (n *SortBy) Pos() int { return n.Location } + +func (n *SortBy) Format(buf *TrackedBuffer) { + if n == nil { + return + } + buf.astFormat(n.Node) + switch n.SortbyDir { + case SortByDirAsc: + buf.WriteString(" ASC") + case SortByDirDesc: + buf.WriteString(" DESC") + } +} diff --git a/internal/sql/ast/sql_value_function.go b/internal/sql/ast/sql_value_function.go index a2e5214cb0..0bd0777374 100644 --- a/internal/sql/ast/sql_value_function.go +++ b/internal/sql/ast/sql_value_function.go @@ -11,3 +11,27 @@ type SQLValueFunction struct { func (n *SQLValueFunction) Pos() int { return n.Location } + +func (n *SQLValueFunction) Format(buf *TrackedBuffer) { + if n == nil { + return + } + switch n.Op { + case SVFOpCurrentDate: + buf.WriteString("CURRENT_DATE") + case SVFOpCurrentTime: + case SVFOpCurrentTimeN: + case SVFOpCurrentTimestamp: + case SVFOpCurrentTimestampN: + case SVFOpLocaltime: + case SVFOpLocaltimeN: + case SVFOpLocaltimestamp: + case SVFOpLocaltimestampN: + case SVFOpCurrentRole: + case SVFOpCurrentUser: + case SVFOpUser: + case SVFOpSessionUser: + case SVFOpCurrentCatalog: + case SVFOpCurrentSchema: + } +} diff --git a/internal/sql/ast/sql_value_function_op.go b/internal/sql/ast/sql_value_function_op.go index e781109c8e..5d99afa0d3 100644 --- a/internal/sql/ast/sql_value_function_op.go +++ b/internal/sql/ast/sql_value_function_op.go @@ -2,6 +2,26 @@ package ast type SQLValueFunctionOp uint +const ( + // https://github.com/pganalyze/libpg_query/blob/15-latest/protobuf/pg_query.proto#L2984C1-L3003C1 + _ SQLValueFunctionOp = iota + SVFOpCurrentDate + SVFOpCurrentTime + SVFOpCurrentTimeN + SVFOpCurrentTimestamp + SVFOpCurrentTimestampN + SVFOpLocaltime + SVFOpLocaltimeN + SVFOpLocaltimestamp + SVFOpLocaltimestampN + SVFOpCurrentRole + SVFOpCurrentUser + SVFOpUser + SVFOpSessionUser + SVFOpCurrentCatalog + SVFOpCurrentSchema +) + func (n *SQLValueFunctionOp) Pos() int { return 0 } diff --git a/internal/sql/ast/string.go b/internal/sql/ast/string.go index 619c786db9..977fc19a2f 100644 --- a/internal/sql/ast/string.go +++ b/internal/sql/ast/string.go @@ -7,3 +7,10 @@ type String struct { func (n *String) Pos() int { return 0 } + +func (n *String) Format(buf *TrackedBuffer) { + if n == nil { + return + } + buf.WriteString(n.Str) +} diff --git a/internal/sql/ast/sub_link.go b/internal/sql/ast/sub_link.go index d61a629785..9463f98c54 100644 --- a/internal/sql/ast/sub_link.go +++ b/internal/sql/ast/sub_link.go @@ -26,3 +26,20 @@ type SubLink struct { func (n *SubLink) Pos() int { return n.Location } + +func (n *SubLink) Format(buf *TrackedBuffer) { + if n == nil { + return + } + buf.astFormat(n.Testexpr) + switch n.SubLinkType { + case EXISTS_SUBLINK: + buf.WriteString(" EXISTS (") + case ANY_SUBLINK: + buf.WriteString(" IN (") + default: + buf.WriteString(" (") + } + buf.astFormat(n.Subselect) + buf.WriteString(")") +} diff --git a/internal/sql/ast/table_name.go b/internal/sql/ast/table_name.go index ea77308b73..a95a510c83 100644 --- a/internal/sql/ast/table_name.go +++ b/internal/sql/ast/table_name.go @@ -9,3 +9,16 @@ type TableName struct { func (n *TableName) Pos() int { return 0 } + +func (n *TableName) Format(buf *TrackedBuffer) { + if n == nil { + return + } + if n.Schema != "" { + buf.WriteString(n.Schema) + buf.WriteString(".") + } + if n.Name != "" { + buf.WriteString(n.Name) + } +} diff --git a/internal/sql/ast/truncate_stmt.go b/internal/sql/ast/truncate_stmt.go index 6518fccdbc..f23a5bbcb3 100644 --- a/internal/sql/ast/truncate_stmt.go +++ b/internal/sql/ast/truncate_stmt.go @@ -9,3 +9,11 @@ type TruncateStmt struct { func (n *TruncateStmt) Pos() int { return 0 } + +func (n *TruncateStmt) Format(buf *TrackedBuffer) { + if n == nil { + return + } + buf.WriteString("TRUNCATE ") + buf.astFormat(n.Relations) +} diff --git a/internal/sql/ast/type_cast.go b/internal/sql/ast/type_cast.go index 8390f5b621..0b549eb4b1 100644 --- a/internal/sql/ast/type_cast.go +++ b/internal/sql/ast/type_cast.go @@ -9,3 +9,12 @@ type TypeCast struct { func (n *TypeCast) Pos() int { return n.Location } + +func (n *TypeCast) Format(buf *TrackedBuffer) { + if n == nil { + return + } + buf.astFormat(n.Arg) + buf.WriteString("::") + buf.astFormat(n.TypeName) +} diff --git a/internal/sql/ast/type_name.go b/internal/sql/ast/type_name.go index eb67dddbcc..e26404b3ba 100644 --- a/internal/sql/ast/type_name.go +++ b/internal/sql/ast/type_name.go @@ -19,3 +19,21 @@ type TypeName struct { func (n *TypeName) Pos() int { return n.Location } + +func (n *TypeName) Format(buf *TrackedBuffer) { + if n == nil { + return + } + if items(n.Names) { + buf.join(n.Names, ".") + } else { + if n.Name == "int4" { + buf.WriteString("INTEGER") + } else { + buf.WriteString(n.Name) + } + } + if items(n.ArrayBounds) { + buf.WriteString("[]") + } +} diff --git a/internal/sql/ast/update_stmt.go b/internal/sql/ast/update_stmt.go index 745b91b617..efd496ad75 100644 --- a/internal/sql/ast/update_stmt.go +++ b/internal/sql/ast/update_stmt.go @@ -1,5 +1,7 @@ package ast +import "strings" + type UpdateStmt struct { Relations *List TargetList *List @@ -13,3 +15,98 @@ type UpdateStmt struct { func (n *UpdateStmt) Pos() int { return 0 } + +func (n *UpdateStmt) Format(buf *TrackedBuffer) { + if n == nil { + return + } + if n.WithClause != nil { + buf.astFormat(n.WithClause) + buf.WriteString(" ") + } + + buf.WriteString("UPDATE ") + if items(n.Relations) { + buf.astFormat(n.Relations) + } + + if items(n.TargetList) { + buf.WriteString(" SET ") + + multi := false + for _, item := range n.TargetList.Items { + switch nn := item.(type) { + case *ResTarget: + if _, ok := nn.Val.(*MultiAssignRef); ok { + multi = true + } + } + } + if multi { + names := []string{} + vals := &List{} + for _, item := range n.TargetList.Items { + res, ok := item.(*ResTarget) + if !ok { + continue + } + if res.Name != nil { + names = append(names, *res.Name) + } + multi, ok := res.Val.(*MultiAssignRef) + if !ok { + vals.Items = append(vals.Items, res.Val) + continue + } + row, ok := multi.Source.(*RowExpr) + if !ok { + vals.Items = append(vals.Items, res.Val) + continue + } + vals.Items = append(vals.Items, row.Args.Items[multi.Colno-1]) + } + + buf.WriteString("(") + buf.WriteString(strings.Join(names, ",")) + buf.WriteString(") = (") + buf.join(vals, ",") + buf.WriteString(")") + } else { + for i, item := range n.TargetList.Items { + if i > 0 { + buf.WriteString(", ") + } + switch nn := item.(type) { + case *ResTarget: + if nn.Name != nil { + buf.WriteString(*nn.Name) + } + buf.WriteString(" = ") + buf.astFormat(nn.Val) + default: + buf.astFormat(item) + } + } + } + } + + if items(n.FromClause) { + buf.WriteString(" FROM ") + buf.astFormat(n.FromClause) + } + + if set(n.WhereClause) { + buf.WriteString(" WHERE ") + buf.astFormat(n.WhereClause) + } + + if set(n.LimitCount) { + buf.WriteString(" LIMIT ") + buf.astFormat(n.LimitCount) + } + + if items(n.ReturningList) { + buf.WriteString(" RETURNING ") + buf.astFormat(n.ReturningList) + } +} diff --git a/internal/sql/ast/with_clause.go b/internal/sql/ast/with_clause.go index 6334930439..634326fa7e 100644 --- a/internal/sql/ast/with_clause.go +++ b/internal/sql/ast/with_clause.go @@ -9,3 +9,14 @@ type WithClause struct { func (n *WithClause) Pos() int { return n.Location } + +func (n *WithClause) Format(buf *TrackedBuffer) { + if n == nil { + return + } + buf.WriteString("WITH") + if n.Recursive { + buf.WriteString(" RECURSIVE") + } + buf.astFormat(n.Ctes) +} diff --git a/internal/sql/catalog/func.go b/internal/sql/catalog/func.go index 7cc712492d..e170777311 100644 --- a/internal/sql/catalog/func.go +++ b/internal/sql/catalog/func.go @@ -39,6 +39,17 @@ func (f *Function) InArgs() []*Argument { return args } +func (f *Function) OutArgs() []*Argument { + var args []*Argument + for _, a := range f.Args { + switch a.Mode { + case ast.FuncParamOut: + args = append(args, a) + } + } + return args +} + func (c *Catalog) createFunction(stmt *ast.CreateFunctionStmt) error { ns := stmt.Func.Schema if ns == "" { diff --git a/internal/sql/catalog/table.go b/internal/sql/catalog/table.go index 5598da4df5..dc30acfa1e 100644 --- a/internal/sql/catalog/table.go +++ b/internal/sql/catalog/table.go @@ -41,7 +41,7 @@ func (table *Table) isExistColumn(cmd *ast.AlterTableCmd) (int, error) { return -1, nil } -func (table *Table) addColumn(cmd *ast.AlterTableCmd) error { +func (c *Catalog) addColumn(table *Table, cmd *ast.AlterTableCmd) error { for _, c := range table.Columns { if c.Name == cmd.Def.Colname { if !cmd.MissingOk { @@ -50,16 +50,11 @@ func (table *Table) addColumn(cmd *ast.AlterTableCmd) error { return nil } } - - table.Columns = append(table.Columns, &Column{ - Name: cmd.Def.Colname, - Type: *cmd.Def.TypeName, - IsNotNull: cmd.Def.IsNotNull, - IsUnsigned: cmd.Def.IsUnsigned, - IsArray: cmd.Def.IsArray, - ArrayDims: cmd.Def.ArrayDims, - Length: cmd.Def.Length, - }) + tc, err := c.defineColumn(table.Rel, cmd.Def) + if err != nil { + return err + } + table.Columns = append(table.Columns, tc) return nil } @@ -76,14 +71,26 @@ func (table *Table) alterColumnType(cmd *ast.AlterTableCmd) error { return nil } -func (table *Table) dropColumn(cmd *ast.AlterTableCmd) error { +func (c *Catalog) dropColumn(table *Table, cmd *ast.AlterTableCmd) error { index, err := table.isExistColumn(cmd) if err != nil { return err } - if index >= 0 { - table.Columns = append(table.Columns[:index], table.Columns[index+1:]...) + if index < 0 { + return nil } + col := table.Columns[index] + if col.linkedType { + drop := &ast.DropTypeStmt{ + Types: []*ast.TypeName{ + &col.Type, + }, + } + if err := c.dropType(drop); err != nil { + return err + } + } + table.Columns = append(table.Columns[:index], table.Columns[index+1:]...) return nil } @@ -121,6 +128,8 @@ type Column struct { ArrayDims int Comment string Length *int + + linkedType bool } // An interface is used to resolve a circular import between the catalog and compiler packages. @@ -187,7 +196,7 @@ func (c *Catalog) alterTable(stmt *ast.AlterTableStmt) error { case *ast.AlterTableCmd: switch cmd.Subtype { case ast.AT_AddColumn: - if err := table.addColumn(cmd); err != nil { + if err := c.addColumn(table, cmd); err != nil { return err } case ast.AT_AlterColumnType: @@ -195,7 +204,7 @@ func (c *Catalog) alterTable(stmt *ast.AlterTableStmt) error { return err } case ast.AT_DropColumn: - if err := table.dropColumn(cmd); err != nil { + if err := c.dropColumn(table, cmd); err != nil { return err } case ast.AT_DropNotNull: @@ -280,10 +289,6 @@ func (c *Catalog) createTable(stmt *ast.CreateTableStmt) error { } } - if stmt.ReferTable != nil && len(stmt.Cols) != 0 { - return errors.New("create table node cannot have both a ReferTable and Cols") - } - if stmt.ReferTable != nil { _, original, err := c.getTable(stmt.ReferTable) if err != nil { @@ -293,40 +298,23 @@ func (c *Catalog) createTable(stmt *ast.CreateTableStmt) error { newCol := *col // make a copy, so changes to the ReferTable don't propagate tbl.Columns = append(tbl.Columns, &newCol) } - } else { - for _, col := range stmt.Cols { - if notNull, ok := seen[col.Colname]; ok { - seen[col.Colname] = notNull || col.IsNotNull - if a, ok := coltype[col.Colname]; ok { - if !sameType(&a, col.TypeName) { - return fmt.Errorf("column %q has a type conflict", col.Colname) - } - } - continue - } + } - tc := &Column{ - Name: col.Colname, - Type: *col.TypeName, - IsNotNull: col.IsNotNull, - IsUnsigned: col.IsUnsigned, - IsArray: col.IsArray, - ArrayDims: col.ArrayDims, - Comment: col.Comment, - Length: col.Length, - } - if col.Vals != nil { - typeName := ast.TypeName{ - Name: fmt.Sprintf("%s_%s", stmt.Name.Name, col.Colname), - } - s := &ast.CreateEnumStmt{TypeName: &typeName, Vals: col.Vals} - if err := c.createEnum(s); err != nil { - return err + for _, col := range stmt.Cols { + if notNull, ok := seen[col.Colname]; ok { + seen[col.Colname] = notNull || col.IsNotNull + if a, ok := coltype[col.Colname]; ok { + if !sameType(&a, col.TypeName) { + return fmt.Errorf("column %q has a type conflict", col.Colname) } - tc.Type = typeName } - tbl.Columns = append(tbl.Columns, tc) + continue + } + tc, err := c.defineColumn(stmt.Name, col) + if err != nil { + return err } + tbl.Columns = append(tbl.Columns, tc) } // If one of the merged columns was not null, mark the column as not null @@ -340,6 +328,31 @@ func (c *Catalog) createTable(stmt *ast.CreateTableStmt) error { return nil } +func (c *Catalog) defineColumn(table *ast.TableName, col *ast.ColumnDef) (*Column, error) { + tc := &Column{ + Name: col.Colname, + Type: *col.TypeName, + IsNotNull: col.IsNotNull, + IsUnsigned: col.IsUnsigned, + IsArray: col.IsArray, + ArrayDims: col.ArrayDims, + Comment: col.Comment, + Length: col.Length, + } + if col.Vals != nil { + typeName := ast.TypeName{ + Name: fmt.Sprintf("%s_%s", table.Name, col.Colname), + } + s := &ast.CreateEnumStmt{TypeName: &typeName, Vals: col.Vals} + if err := c.createEnum(s); err != nil { + return nil, err + } + tc.Type = typeName + tc.linkedType = true + } + return tc, nil +} + func (c *Catalog) dropTable(stmt *ast.DropTableStmt) error { for _, name := range stmt.Tables { ns := name.Schema @@ -353,13 +366,24 @@ func (c *Catalog) dropTable(stmt *ast.DropTableStmt) error { return err } - _, idx, err := schema.getTable(name) + tbl, idx, err := schema.getTable(name) if errors.Is(err, sqlerr.NotFound) && stmt.IfExists { continue } else if err != nil { return err } + drop := &ast.DropTypeStmt{} + for _, col := range tbl.Columns { + if !col.linkedType { + continue + } + drop.Types = append(drop.Types, &col.Type) + } + if err := c.dropType(drop); err != nil { + return err + } + schema.Tables = append(schema.Tables[:idx], schema.Tables[idx+1:]...) } return nil @@ -383,6 +407,18 @@ func (c *Catalog) renameColumn(stmt *ast.RenameColumnStmt) error { return sqlerr.ColumnNotFound(tbl.Rel.Name, stmt.Col.Name) } tbl.Columns[idx].Name = *stmt.NewName + + if tbl.Columns[idx].linkedType { + name := fmt.Sprintf("%s_%s", tbl.Rel.Name, *stmt.NewName) + rename := &ast.RenameTypeStmt{ + Type: &tbl.Columns[idx].Type, + NewName: &name, + } + if err := c.renameType(rename); err != nil { + return err + } + } + return nil } @@ -397,6 +433,20 @@ func (c *Catalog) renameTable(stmt *ast.RenameTableStmt) error { if stmt.NewName != nil { tbl.Rel.Name = *stmt.NewName } + + for idx := range tbl.Columns { + if tbl.Columns[idx].linkedType { + name := fmt.Sprintf("%s_%s", *stmt.NewName, tbl.Columns[idx].Name) + rename := &ast.RenameTypeStmt{ + Type: &tbl.Columns[idx].Type, + NewName: &name, + } + if err := c.renameType(rename); err != nil { + return err + } + } + } + return nil } diff --git a/internal/sql/catalog/types.go b/internal/sql/catalog/types.go index e92a3a219e..464472bcf2 100644 --- a/internal/sql/catalog/types.go +++ b/internal/sql/catalog/types.go @@ -3,6 +3,7 @@ package catalog import ( "errors" "fmt" + "github.com/sqlc-dev/sqlc/internal/sql/ast" "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" ) diff --git a/internal/sql/named/param_set.go b/internal/sql/named/param_set.go index b30de738b3..d47617a39e 100644 --- a/internal/sql/named/param_set.go +++ b/internal/sql/named/param_set.go @@ -14,6 +14,13 @@ type ParamSet struct { argn int } +// Return the name for a given parameter number and a boolean indicating if it +// was found. +func (p *ParamSet) NameFor(idx int) (string, bool) { + name, ok := p.positionToName[idx] + return name, ok +} + func (p *ParamSet) nextArgNum() int { for { if _, ok := p.positionToName[p.argn]; !ok { diff --git a/internal/sql/sqlpath/read.go b/internal/sql/sqlpath/read.go index 24072001c9..278ebf3a05 100644 --- a/internal/sql/sqlpath/read.go +++ b/internal/sql/sqlpath/read.go @@ -9,14 +9,33 @@ import ( "github.com/sqlc-dev/sqlc/internal/migrations" ) -// Return a list of SQL files in the listed paths. Only includes files ending -// in .sql. Omits hidden files, directories, and migrations. -func Glob(paths []string) ([]string, error) { - var files []string +// Return a list of SQL files in the listed paths. +// +// Only includes files ending in .sql. Omits hidden files, directories, and +// down migrations. + +// If a path contains *, ?, [, or ], treat the path as a pattern and expand it +// filepath.Glob. +func Glob(patterns []string) ([]string, error) { + var files, paths []string + for _, pattern := range patterns { + if strings.ContainsAny(pattern, "*?[]") { + matches, err := filepath.Glob(pattern) + if err != nil { + return nil, err + } + // if len(matches) == 0 { + // slog.Warn("zero files matched", "pattern", pattern) + // } + paths = append(paths, matches...) + } else { + paths = append(paths, pattern) + } + } for _, path := range paths { f, err := os.Stat(path) if err != nil { - return nil, fmt.Errorf("path %s does not exist", path) + return nil, fmt.Errorf("path error: %w", err) } if f.IsDir() { listing, err := os.ReadDir(path) @@ -27,7 +46,7 @@ func Glob(paths []string) ([]string, error) { files = append(files, filepath.Join(path, f.Name())) } } else { - files = append(files, path) + files = append(files, filepath.Clean(path)) } } var sqlFiles []string diff --git a/internal/sql/sqlpath/read_test.go b/internal/sql/sqlpath/read_test.go new file mode 100644 index 0000000000..e4d959085b --- /dev/null +++ b/internal/sql/sqlpath/read_test.go @@ -0,0 +1,243 @@ +package sqlpath + +import ( + "fmt" + "path/filepath" + "strings" + "testing" + + "github.com/google/go-cmp/cmp" +) + +// Returns a list of SQL files from given paths. +func TestReturnsListOfSQLFiles(t *testing.T) { + // Arrange + paths := []string{"testdata/file1.sql", "testdata/file2.sql"} + + // Act + result, err := Glob(paths) + + // Assert + expected := []string{filepath.Join("testdata", "file1.sql"), filepath.Join("testdata", "file2.sql")} + if !cmp.Equal(result, expected) { + t.Errorf("Expected %v, but got %v, %v", expected, result, cmp.Diff(expected, result)) + } + if err != nil { + t.Errorf("Expected no error, but got %v", err) + } +} + +func TestReturnsNilListWhenNoSQLFilesFound(t *testing.T) { + // Arrange + paths := []string{"testdata/extra.txt"} + + // Act + result, err := Glob(paths) + // Assert + var expected []string + if !cmp.Equal(result, expected) { + t.Errorf("Expected %v, but got %v, %v", expected, result, cmp.Diff(expected, result)) + } + if err != nil { + t.Errorf("Expected no error, but got %v", err) + } +} + +func TestIgnoresHiddenFilesWhenSearchingForSQLFiles(t *testing.T) { + // Arrange + paths := []string{"testdata/.hidden.sql"} + + // Act + result, err := Glob(paths) + + // Assert + var expected []string + if !cmp.Equal(result, expected) { + t.Errorf("Expected %v, but got %v", expected, result) + } + if err != nil { + t.Errorf("Expected no error, but got %v", err) + } +} + +func TestIgnoresNonSQLFilesWhenSearchingForSQLFiles(t *testing.T) { + // Arrange + paths := []string{"testdata/extra.txt"} + + // Act + result, err := Glob(paths) + + // Assert + var expected []string + if !cmp.Equal(result, expected) { + t.Errorf("Expected %v, but got %v", expected, result) + } + if err != nil { + t.Errorf("Expected no error, but got %v", err) + } +} + +func TestExcludesSQLFilesEndingWithDownSQLWhenSearchingForSQLFiles(t *testing.T) { + // Arrange + paths := []string{"testdata/file1.sql", "testdata/file3.down.sql"} + + // Act + result, err := Glob(paths) + + // Assert + expected := []string{filepath.Join("testdata", "file1.sql")} + if !cmp.Equal(result, expected) { + t.Errorf("Expected %v, but got %v", expected, result) + } + if err != nil { + t.Errorf("Expected no error, but got %v", err) + } +} + +func TestReturnsErrorWhenPathDoesNotExist(t *testing.T) { + // Arrange + paths := []string{"non_existent_path"} + + // Act + result, err := Glob(paths) + + // Assert + var expected []string + if !cmp.Equal(result, expected) { + t.Errorf("Expected %v, but got %v", expected, result) + } + if err == nil { + t.Errorf("Expected an error, but got nil") + } else { + expectedError := fmt.Errorf("path error:") + if !strings.HasPrefix(err.Error(), expectedError.Error()) { + t.Errorf("Expected error %v, but got %v", expectedError, err) + } + } +} + +func TestReturnsErrorWhenDirectoryCannotBeRead(t *testing.T) { + // Arrange + paths := []string{"testdata/unreadable"} + + // Act + result, err := Glob(paths) + + // Assert + var expected []string + if !cmp.Equal(result, expected) { + t.Errorf("Expected %v, but got %v", expected, result) + } + if err == nil { + t.Errorf("Expected an error, but got nil") + } else { + expectedError := fmt.Errorf("path error:") + if !strings.HasPrefix(err.Error(), expectedError.Error()) { + t.Errorf("Expected error %v, but got %v", expectedError, err) + } + } +} + +func TestDoesNotIncludesSQLFilesWithUppercaseExtension(t *testing.T) { + // Arrange + paths := []string{"testdata/file4.SQL"} + + // Act + result, err := Glob(paths) + + // Assert + var expected []string + if !cmp.Equal(result, expected) { + t.Errorf("Expected %v, but got %v", expected, result) + } + if err != nil { + t.Errorf("Expected no error, but got %v", err) + } +} + +func TestNotIncludesHiddenFilesAnyPath(t *testing.T) { + // Arrange + paths := []string{ + "./testdata/.hiddendir/file1.sql", // pass + "./testdata/.hidden.sql", // skip + } + + // Act + result, err := Glob(paths) + + // Assert + expected := []string{filepath.Join("testdata", ".hiddendir", "file1.sql")} + if !cmp.Equal(result, expected) { + t.Errorf("Expected %v, but got %v", expected, result) + } + if err != nil { + t.Errorf("Expected no error, but got %v", err) + } +} + +func TestFollowSymlinks(t *testing.T) { + // Arrange + paths := []string{"testdata/symlink", "testdata/file1.symlink.sql"} + + // Act + result, err := Glob(paths) + + // Assert + expected := []string{ + filepath.Join("testdata", "symlink", "file1.sql"), + filepath.Join("testdata", "symlink", "file1.symlink.sql"), + filepath.Join("testdata", "symlink", "file2.sql"), + filepath.Join("testdata", "file1.symlink.sql"), + } + if !cmp.Equal(result, expected) { + t.Errorf("Expected %v, but got %v", expected, result) + } + if err != nil { + t.Errorf("Expected no error, but got %v", err) + } +} + +func TestGlobPattern(t *testing.T) { + // Arrange + tests := []struct { + pattern string + expected []string + }{ + { + pattern: "testdata/glob/*/queries", + expected: []string{ + filepath.Join("testdata", "glob", "sub1", "queries", "file1.sql"), + filepath.Join("testdata", "glob", "sub2", "queries", "file2.sql"), + filepath.Join("testdata", "glob", "sub3", "queries", "file3.sql"), + filepath.Join("testdata", "glob", "sub3", "queries", "file4.sql"), + }, + }, + { + pattern: "testdata/glob/sub3/queries/file?.sql", + expected: []string{ + filepath.Join("testdata", "glob", "sub3", "queries", "file3.sql"), + filepath.Join("testdata", "glob", "sub3", "queries", "file4.sql"), + }, + }, + { + pattern: "testdata/glob/sub3/queries/file[1-5].sql", + expected: []string{ + filepath.Join("testdata", "glob", "sub3", "queries", "file3.sql"), + filepath.Join("testdata", "glob", "sub3", "queries", "file4.sql"), + }, + }, + } + + for _, test := range tests { + // Act + result, err := Glob([]string{test.pattern}) + + // Assert + if !cmp.Equal(result, test.expected) { + t.Errorf("Pattern %v: Expected %v, but got %v", test.pattern, test.expected, result) + } + if err != nil { + t.Errorf("Pattern %v: Expected no error, but got %v", test.pattern, err) + } + } +} diff --git a/internal/sql/sqlpath/testdata/.hidden.sql b/internal/sql/sqlpath/testdata/.hidden.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/sql/sqlpath/testdata/.hiddendir/file1.sql b/internal/sql/sqlpath/testdata/.hiddendir/file1.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/sql/sqlpath/testdata/extra.txt b/internal/sql/sqlpath/testdata/extra.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/sql/sqlpath/testdata/file1.sql b/internal/sql/sqlpath/testdata/file1.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/sql/sqlpath/testdata/file1.symlink.sql b/internal/sql/sqlpath/testdata/file1.symlink.sql new file mode 120000 index 0000000000..7c823b3226 --- /dev/null +++ b/internal/sql/sqlpath/testdata/file1.symlink.sql @@ -0,0 +1 @@ +./file1.sql \ No newline at end of file diff --git a/internal/sql/sqlpath/testdata/file2.sql b/internal/sql/sqlpath/testdata/file2.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/sql/sqlpath/testdata/file3.down.sql b/internal/sql/sqlpath/testdata/file3.down.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/sql/sqlpath/testdata/file4.SQL b/internal/sql/sqlpath/testdata/file4.SQL new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/sql/sqlpath/testdata/glob/sub1/queries/file1.sql b/internal/sql/sqlpath/testdata/glob/sub1/queries/file1.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/sql/sqlpath/testdata/glob/sub2/queries/file2.sql b/internal/sql/sqlpath/testdata/glob/sub2/queries/file2.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/sql/sqlpath/testdata/glob/sub3/queries/file3.sql b/internal/sql/sqlpath/testdata/glob/sub3/queries/file3.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/sql/sqlpath/testdata/glob/sub3/queries/file4.sql b/internal/sql/sqlpath/testdata/glob/sub3/queries/file4.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/sql/sqlpath/testdata/subdir/file2.sql b/internal/sql/sqlpath/testdata/subdir/file2.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/sql/sqlpath/testdata/symlink b/internal/sql/sqlpath/testdata/symlink new file mode 120000 index 0000000000..945c9b46d6 --- /dev/null +++ b/internal/sql/sqlpath/testdata/symlink @@ -0,0 +1 @@ +. \ No newline at end of file diff --git a/internal/sql/validate/cmd.go b/internal/sql/validate/cmd.go index 079c10c3f9..66e849de6c 100644 --- a/internal/sql/validate/cmd.go +++ b/internal/sql/validate/cmd.go @@ -6,6 +6,8 @@ import ( "github.com/sqlc-dev/sqlc/internal/metadata" "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/astutils" + "github.com/sqlc-dev/sqlc/internal/sql/named" ) func validateCopyfrom(n ast.Node) error { @@ -37,7 +39,10 @@ func validateCopyfrom(n ast.Node) error { return nil } for _, v := range sublist.Items { - if _, ok := v.(*ast.ParamRef); !ok { + _, ok := v.(*ast.ParamRef) + ok = ok || named.IsParamFunc(v) + ok = ok || named.IsParamSign(v) + if !ok { return errors.New(":copyfrom doesn't support non-parameter values") } } @@ -45,8 +50,13 @@ func validateCopyfrom(n ast.Node) error { } func validateBatch(n ast.Node) error { - nums, _, _ := ParamRef(n) - if len(nums) == 0 { + funcs := astutils.Search(n, named.IsParamFunc) + params := astutils.Search(n, named.IsParamSign) + args := astutils.Search(n, func(n ast.Node) bool { + _, ok := n.(*ast.ParamRef) + return ok + }) + if (len(params.Items) + len(funcs.Items) + len(args.Items)) == 0 { return errors.New(":batch* commands require parameters") } return nil @@ -57,9 +67,11 @@ func Cmd(n ast.Node, name, cmd string) error { return validateCopyfrom(n) } if (cmd == metadata.CmdBatchExec || cmd == metadata.CmdBatchMany) || cmd == metadata.CmdBatchOne { - return validateBatch(n) + if err := validateBatch(n); err != nil { + return err + } } - if !(cmd == metadata.CmdMany || cmd == metadata.CmdOne) { + if !(cmd == metadata.CmdMany || cmd == metadata.CmdOne || cmd == metadata.CmdBatchMany || cmd == metadata.CmdBatchOne) { return nil } var list *ast.List diff --git a/internal/sql/validate/func_call.go b/internal/sql/validate/func_call.go index 383366c68f..dad621eb12 100644 --- a/internal/sql/validate/func_call.go +++ b/internal/sql/validate/func_call.go @@ -2,7 +2,6 @@ package validate import ( "errors" - "fmt" "github.com/sqlc-dev/sqlc/internal/config" "github.com/sqlc-dev/sqlc/internal/sql/ast" @@ -31,34 +30,7 @@ func (v *funcCallVisitor) Visit(node ast.Node) astutils.Visitor { return v } - // Custom validation for sqlc.arg, sqlc.narg and sqlc.slice - // TODO: Replace this once type-checking is implemented if fn.Schema == "sqlc" { - if !(fn.Name == "arg" || fn.Name == "narg" || fn.Name == "slice" || fn.Name == "embed") { - v.err = sqlerr.FunctionNotFound("sqlc." + fn.Name) - return nil - } - - if len(call.Args.Items) != 1 { - v.err = &sqlerr.Error{ - Message: fmt.Sprintf("expected 1 parameter to sqlc.%s; got %d", fn.Name, len(call.Args.Items)), - Location: call.Pos(), - } - return nil - } - switch n := call.Args.Items[0].(type) { - case *ast.A_Const: - case *ast.ColumnRef: - default: - v.err = &sqlerr.Error{ - Message: fmt.Sprintf("expected parameter to sqlc.%s to be string or reference; got %T", fn.Name, n), - Location: call.Pos(), - } - return nil - } - - // If we have sqlc.arg or sqlc.narg, there is no need to resolve the function call. - // It won't resolve anyway, sinc it is not a real function. return nil } diff --git a/internal/sql/validate/param_ref.go b/internal/sql/validate/param_ref.go index 1ee04bb5e7..ab9413f40f 100644 --- a/internal/sql/validate/param_ref.go +++ b/internal/sql/validate/param_ref.go @@ -38,7 +38,7 @@ func ParamRef(n ast.Node) (map[int]bool, bool, error) { } for i := 1; i <= len(seen); i += 1 { if _, ok := seen[i]; !ok { - return nil, false, &sqlerr.Error{ + return seen, !nodollar, &sqlerr.Error{ Code: "42P18", Message: fmt.Sprintf("could not determine data type of parameter $%d", i), } diff --git a/internal/sql/validate/param_style.go b/internal/sql/validate/param_style.go index 64f8bd9c87..1182051d20 100644 --- a/internal/sql/validate/param_style.go +++ b/internal/sql/validate/param_style.go @@ -1,48 +1,68 @@ package validate import ( + "fmt" + "github.com/sqlc-dev/sqlc/internal/sql/ast" "github.com/sqlc-dev/sqlc/internal/sql/astutils" - "github.com/sqlc-dev/sqlc/internal/sql/named" "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" ) -// A query can use one (and only one) of the following formats: -// - positional parameters $1 -// - named parameter operator @param -// - named parameter function calls sqlc.arg(param) -func ParamStyle(n ast.Node) error { - namedFunc := astutils.Search(n, named.IsParamFunc) - for _, f := range namedFunc.Items { - if fc, ok := f.(*ast.FuncCall); ok { - args := fc.Args.Items - - if len(args) == 0 { - continue - } +type sqlcFuncVisitor struct { + err error +} + +func (v *sqlcFuncVisitor) Visit(node ast.Node) astutils.Visitor { + if v.err != nil { + return nil + } + + call, ok := node.(*ast.FuncCall) + if !ok { + return v + } + fn := call.Func + if fn == nil { + return v + } - switch val := args[0].(type) { - case *ast.FuncCall: - return &sqlerr.Error{ - Code: "", // TODO: Pick a new error code - Message: "Invalid argument to sqlc.arg()", - Location: val.Location, - } - case *ast.ParamRef: - return &sqlerr.Error{ - Code: "", // TODO: Pick a new error code - Message: "Invalid argument to sqlc.arg()", - Location: val.Location, - } - case *ast.A_Const, *ast.ColumnRef: - default: - return &sqlerr.Error{ - Code: "", // TODO: Pick a new error code - Message: "Invalid argument to sqlc.arg()", - } + // Custom validation for sqlc.arg, sqlc.narg and sqlc.slice + // TODO: Replace this once type-checking is implemented + if fn.Schema == "sqlc" { + if !(fn.Name == "arg" || fn.Name == "narg" || fn.Name == "slice" || fn.Name == "embed") { + v.err = sqlerr.FunctionNotFound("sqlc." + fn.Name) + return nil + } + + if len(call.Args.Items) != 1 { + v.err = &sqlerr.Error{ + Message: fmt.Sprintf("expected 1 parameter to sqlc.%s; got %d", fn.Name, len(call.Args.Items)), + Location: call.Pos(), + } + return nil + } + switch n := call.Args.Items[0].(type) { + case *ast.A_Const: + case *ast.ColumnRef: + default: + v.err = &sqlerr.Error{ + Message: fmt.Sprintf("expected parameter to sqlc.%s to be string or reference; got %T", fn.Name, n), + Location: call.Pos(), } + return nil } + + // If we have sqlc.arg or sqlc.narg, there is no need to resolve the function call. + // It won't resolve anyway, sinc it is not a real function. + return nil } + return nil } + +func SqlcFunctions(n ast.Node) error { + visitor := sqlcFuncVisitor{} + astutils.Walk(&visitor, n) + return visitor.err +} diff --git a/internal/sqltest/docker/enabled.go b/internal/sqltest/docker/enabled.go new file mode 100644 index 0000000000..e17c0201b2 --- /dev/null +++ b/internal/sqltest/docker/enabled.go @@ -0,0 +1,17 @@ +package docker + +import ( + "fmt" + "os/exec" + + "golang.org/x/sync/singleflight" +) + +var flight singleflight.Group + +func Installed() error { + if _, err := exec.LookPath("docker"); err != nil { + return fmt.Errorf("docker not found: %w", err) + } + return nil +} diff --git a/internal/sqltest/docker/mysql.go b/internal/sqltest/docker/mysql.go new file mode 100644 index 0000000000..39a1af6160 --- /dev/null +++ b/internal/sqltest/docker/mysql.go @@ -0,0 +1,104 @@ +package docker + +import ( + "context" + "database/sql" + "fmt" + "os/exec" + "strings" + "time" + + _ "github.com/go-sql-driver/mysql" +) + +var mysqlHost string + +func StartMySQLServer(c context.Context) (string, error) { + if err := Installed(); err != nil { + return "", err + } + if mysqlHost != "" { + return mysqlHost, nil + } + value, err, _ := flight.Do("mysql", func() (interface{}, error) { + host, err := startMySQLServer(c) + if err != nil { + return "", err + } + mysqlHost = host + return host, nil + }) + if err != nil { + return "", err + } + data, ok := value.(string) + if !ok { + return "", fmt.Errorf("returned value was not a string") + } + return data, nil +} + +func startMySQLServer(c context.Context) (string, error) { + { + _, err := exec.Command("docker", "pull", "mysql:9").CombinedOutput() + if err != nil { + return "", fmt.Errorf("docker pull: mysql:9 %w", err) + } + } + + var exists bool + { + cmd := exec.Command("docker", "container", "inspect", "sqlc_sqltest_docker_mysql") + // This means we've already started the container + exists = cmd.Run() == nil + } + + if !exists { + cmd := exec.Command("docker", "run", + "--name", "sqlc_sqltest_docker_mysql", + "-e", "MYSQL_ROOT_PASSWORD=mysecretpassword", + "-e", "MYSQL_DATABASE=dinotest", + "-p", "3306:3306", + "-d", + "mysql:9", + ) + + output, err := cmd.CombinedOutput() + fmt.Println(string(output)) + + msg := `Conflict. The container name "/sqlc_sqltest_docker_mysql" is already in use by container` + if !strings.Contains(string(output), msg) && err != nil { + return "", err + } + } + + ctx, cancel := context.WithTimeout(c, 10*time.Second) + defer cancel() + + // Create a ticker that fires every 10ms + ticker := time.NewTicker(10 * time.Millisecond) + defer ticker.Stop() + + uri := "root:mysecretpassword@/dinotest?multiStatements=true&parseTime=true" + + db, err := sql.Open("mysql", uri) + if err != nil { + return "", fmt.Errorf("sql.Open: %w", err) + } + + defer db.Close() + + for { + select { + case <-ctx.Done(): + return "", fmt.Errorf("timeout reached: %w", ctx.Err()) + + case <-ticker.C: + // Run your function here + if err := db.PingContext(ctx); err != nil { + continue + } + return uri, nil + } + } +} diff --git a/internal/sqltest/docker/postgres.go b/internal/sqltest/docker/postgres.go new file mode 100644 index 0000000000..1b2d842c70 --- /dev/null +++ b/internal/sqltest/docker/postgres.go @@ -0,0 +1,105 @@ +package docker + +import ( + "context" + "fmt" + "log/slog" + "os/exec" + "strings" + "time" + + "github.com/jackc/pgx/v5" +) + +var postgresHost string + +func StartPostgreSQLServer(c context.Context) (string, error) { + if err := Installed(); err != nil { + return "", err + } + if postgresHost != "" { + return postgresHost, nil + } + value, err, _ := flight.Do("postgresql", func() (interface{}, error) { + host, err := startPostgreSQLServer(c) + if err != nil { + return "", err + } + postgresHost = host + return host, err + }) + if err != nil { + return "", err + } + data, ok := value.(string) + if !ok { + return "", fmt.Errorf("returned value was not a string") + } + return data, nil +} + +func startPostgreSQLServer(c context.Context) (string, error) { + { + _, err := exec.Command("docker", "pull", "postgres:16").CombinedOutput() + if err != nil { + return "", fmt.Errorf("docker pull: postgres:16 %w", err) + } + } + + uri := "postgres://postgres:mysecretpassword@localhost:5432/postgres?sslmode=disable" + + var exists bool + { + cmd := exec.Command("docker", "container", "inspect", "sqlc_sqltest_docker_postgres") + // This means we've already started the container + exists = cmd.Run() == nil + } + + if !exists { + cmd := exec.Command("docker", "run", + "--name", "sqlc_sqltest_docker_postgres", + "-e", "POSTGRES_PASSWORD=mysecretpassword", + "-e", "POSTGRES_USER=postgres", + "-p", "5432:5432", + "-d", + "postgres:16", + "-c", "max_connections=200", + ) + + output, err := cmd.CombinedOutput() + fmt.Println(string(output)) + + msg := `Conflict. The container name "/sqlc_sqltest_docker_postgres" is already in use by container` + if !strings.Contains(string(output), msg) && err != nil { + return "", err + } + } + + ctx, cancel := context.WithTimeout(c, 5*time.Second) + defer cancel() + + // Create a ticker that fires every 10ms + ticker := time.NewTicker(10 * time.Millisecond) + defer ticker.Stop() + + for { + select { + case <-ctx.Done(): + return "", fmt.Errorf("timeout reached: %w", ctx.Err()) + + case <-ticker.C: + // Run your function here + conn, err := pgx.Connect(ctx, uri) + if err != nil { + slog.Debug("sqltest", "connect", err) + continue + } + defer conn.Close(ctx) + if err := conn.Ping(ctx); err != nil { + slog.Error("sqltest", "ping", err) + continue + } + return uri, nil + } + } +} diff --git a/internal/sqltest/hosted/db.go b/internal/sqltest/hosted/db.go deleted file mode 100644 index 74bbf35421..0000000000 --- a/internal/sqltest/hosted/db.go +++ /dev/null @@ -1,78 +0,0 @@ -package hosted - -import ( - "context" - "fmt" - "os" - "sync" - "testing" - - "github.com/sqlc-dev/sqlc/internal/quickdb" - pb "github.com/sqlc-dev/sqlc/internal/quickdb/v1" - "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" -) - -var client pb.QuickClient -var once sync.Once - -func initClient() error { - projectID := os.Getenv("CI_SQLC_PROJECT_ID") - authToken := os.Getenv("CI_SQLC_AUTH_TOKEN") - if projectID == "" || authToken == "" { - return fmt.Errorf("missing project id or auth token") - } - c, err := quickdb.NewClient(projectID, authToken) - if err != nil { - return err - } - client = c - return nil -} - -func PostgreSQL(t *testing.T, migrations []string) string { - ctx := context.Background() - t.Helper() - - once.Do(func() { - if err := initClient(); err != nil { - t.Log(err) - } - }) - - if client == nil { - t.Skip("client init failed") - } - - var seed []string - files, err := sqlpath.Glob(migrations) - if err != nil { - t.Fatal(err) - } - for _, f := range files { - blob, err := os.ReadFile(f) - if err != nil { - t.Fatal(err) - } - seed = append(seed, string(blob)) - } - - resp, err := client.CreateEphemeralDatabase(ctx, &pb.CreateEphemeralDatabaseRequest{ - Engine: "postgresql", - Region: quickdb.GetClosestRegion(), - Migrations: seed, - }) - if err != nil { - t.Fatalf("region %s: %s", quickdb.GetClosestRegion(), err) - } - - t.Cleanup(func() { - _, err = client.DropEphemeralDatabase(ctx, &pb.DropEphemeralDatabaseRequest{ - DatabaseId: resp.DatabaseId, - }) - if err != nil { - t.Fatal(err) - } - }) - - return resp.Uri -} diff --git a/internal/sqltest/local/id.go b/internal/sqltest/local/id.go new file mode 100644 index 0000000000..919e2dca1d --- /dev/null +++ b/internal/sqltest/local/id.go @@ -0,0 +1,13 @@ +package local + +import "math/rand" + +var letterRunes = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") + +func id() string { + b := make([]rune, 10) + for i := range b { + b[i] = letterRunes[rand.Intn(len(letterRunes))] + } + return string(b) +} diff --git a/internal/sqltest/local/mysql.go b/internal/sqltest/local/mysql.go new file mode 100644 index 0000000000..dedd3dfd78 --- /dev/null +++ b/internal/sqltest/local/mysql.go @@ -0,0 +1,101 @@ +package local + +import ( + "context" + "database/sql" + "fmt" + "os" + "strings" + "sync" + "testing" + + "github.com/go-sql-driver/mysql" + + migrate "github.com/sqlc-dev/sqlc/internal/migrations" + "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" + "github.com/sqlc-dev/sqlc/internal/sqltest/docker" +) + +var mysqlSync sync.Once +var mysqlPool *sql.DB + +func MySQL(t *testing.T, migrations []string) string { + ctx := context.Background() + t.Helper() + + dburi := os.Getenv("MYSQL_SERVER_URI") + if dburi == "" { + if ierr := docker.Installed(); ierr == nil { + u, err := docker.StartMySQLServer(ctx) + if err != nil { + t.Fatal(err) + } + dburi = u + } else { + t.Skip("MYSQL_SERVER_URI is empty") + } + } + + mysqlSync.Do(func() { + db, err := sql.Open("mysql", dburi) + if err != nil { + t.Fatal(err) + } + mysqlPool = db + }) + + if mysqlPool == nil { + t.Fatalf("MySQL pool creation failed") + } + + var seed []string + files, err := sqlpath.Glob(migrations) + if err != nil { + t.Fatal(err) + } + for _, f := range files { + blob, err := os.ReadFile(f) + if err != nil { + t.Fatal(err) + } + seed = append(seed, migrate.RemoveRollbackStatements(string(blob))) + } + + cfg, err := mysql.ParseDSN(dburi) + if err != nil { + t.Fatal(err) + } + + name := fmt.Sprintf("sqlc_test_%s", id()) + + if _, err := mysqlPool.ExecContext(ctx, fmt.Sprintf("CREATE DATABASE `%s`", name)); err != nil { + t.Fatal(err) + } + + cfg.DBName = name + + dropQuery := fmt.Sprintf("DROP DATABASE `%s`", name) + + t.Cleanup(func() { + if _, err := mysqlPool.ExecContext(ctx, dropQuery); err != nil { + t.Fatal(err) + } + }) + + db, err := sql.Open("mysql", cfg.FormatDSN()) + if err != nil { + t.Fatalf("connect %s: %s", name, err) + } + defer db.Close() + + for _, q := range seed { + if len(strings.TrimSpace(q)) == 0 { + continue + } + if _, err := db.ExecContext(ctx, q); err != nil { + t.Fatalf("%s: %s", q, err) + } + } + + return cfg.FormatDSN() +} diff --git a/internal/sqltest/local/postgres.go b/internal/sqltest/local/postgres.go new file mode 100644 index 0000000000..feda4cf7ac --- /dev/null +++ b/internal/sqltest/local/postgres.go @@ -0,0 +1,128 @@ +package local + +import ( + "context" + "fmt" + "hash/fnv" + "net/url" + "os" + "strings" + "testing" + + "github.com/jackc/pgx/v5" + "golang.org/x/sync/singleflight" + + migrate "github.com/sqlc-dev/sqlc/internal/migrations" + "github.com/sqlc-dev/sqlc/internal/pgx/poolcache" + "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" + "github.com/sqlc-dev/sqlc/internal/sqltest/docker" +) + +var flight singleflight.Group +var cache = poolcache.New() + +func PostgreSQL(t *testing.T, migrations []string) string { + return postgreSQL(t, migrations, true) +} + +func ReadOnlyPostgreSQL(t *testing.T, migrations []string) string { + return postgreSQL(t, migrations, false) +} + +func postgreSQL(t *testing.T, migrations []string, rw bool) string { + ctx := context.Background() + t.Helper() + + dburi := os.Getenv("POSTGRESQL_SERVER_URI") + if dburi == "" { + if ierr := docker.Installed(); ierr == nil { + u, err := docker.StartPostgreSQLServer(ctx) + if err != nil { + t.Fatal(err) + } + dburi = u + } else { + t.Skip("POSTGRESQL_SERVER_URI is empty") + } + } + + postgresPool, err := cache.Open(ctx, dburi) + if err != nil { + t.Fatalf("PostgreSQL pool creation failed: %s", err) + } + + var seed []string + files, err := sqlpath.Glob(migrations) + if err != nil { + t.Fatal(err) + } + + h := fnv.New64() + for _, f := range files { + blob, err := os.ReadFile(f) + if err != nil { + t.Fatal(err) + } + h.Write(blob) + seed = append(seed, migrate.RemoveRollbackStatements(string(blob))) + } + + var name string + if rw { + name = fmt.Sprintf("sqlc_test_%s", id()) + } else { + name = fmt.Sprintf("sqlc_test_%x", h.Sum(nil)) + } + + uri, err := url.Parse(dburi) + if err != nil { + t.Fatal(err) + } + uri.Path = name + dropQuery := fmt.Sprintf(`DROP DATABASE IF EXISTS "%s" WITH (FORCE)`, name) + + key := uri.String() + + _, err, _ = flight.Do(key, func() (interface{}, error) { + row := postgresPool.QueryRow(ctx, + fmt.Sprintf(`SELECT datname FROM pg_database WHERE datname = '%s'`, name)) + + var datname string + if err := row.Scan(&datname); err == nil { + t.Logf("database exists: %s", name) + return nil, nil + } + + t.Logf("creating database: %s", name) + if _, err := postgresPool.Exec(ctx, fmt.Sprintf(`CREATE DATABASE "%s"`, name)); err != nil { + return nil, err + } + + conn, err := pgx.Connect(ctx, uri.String()) + if err != nil { + return nil, fmt.Errorf("connect %s: %s", name, err) + } + defer conn.Close(ctx) + + for _, q := range seed { + if len(strings.TrimSpace(q)) == 0 { + continue + } + if _, err := conn.Exec(ctx, q); err != nil { + return nil, fmt.Errorf("%s: %s", q, err) + } + } + return nil, nil + }) + if rw || err != nil { + t.Cleanup(func() { + if _, err := postgresPool.Exec(ctx, dropQuery); err != nil { + t.Fatalf("failed cleaning up: %s", err) + } + }) + } + if err != nil { + t.Fatalf("create db: %s", err) + } + return key +} diff --git a/internal/sqltest/mysql.go b/internal/sqltest/mysql.go index a1fbf41571..bddfe0042c 100644 --- a/internal/sqltest/mysql.go +++ b/internal/sqltest/mysql.go @@ -7,9 +7,9 @@ import ( "path/filepath" "testing" - "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" - _ "github.com/go-sql-driver/mysql" + + "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" ) func MySQL(t *testing.T, migrations []string) (*sql.DB, func()) { diff --git a/internal/sqltest/sqlite.go b/internal/sqltest/sqlite.go index cd7eff3872..0e5161967d 100644 --- a/internal/sqltest/sqlite.go +++ b/internal/sqltest/sqlite.go @@ -7,8 +7,6 @@ import ( "testing" "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" - - _ "github.com/mattn/go-sqlite3" ) func SQLite(t *testing.T, migrations []string) (*sql.DB, func()) { @@ -18,6 +16,9 @@ func SQLite(t *testing.T, migrations []string) (*sql.DB, func()) { if err != nil { t.Fatal(err) } + if err := source.Close(); err != nil { + t.Fatal(err) + } return CreateSQLiteDatabase(t, source.Name(), migrations) } @@ -25,7 +26,7 @@ func CreateSQLiteDatabase(t *testing.T, path string, migrations []string) (*sql. t.Helper() t.Logf("open %s\n", path) - sdb, err := sql.Open("sqlite3", path) + sdb, err := sql.Open("sqlite", path) if err != nil { t.Fatal(err) } diff --git a/internal/sqltest/sqlite_modernc.go b/internal/sqltest/sqlite_modernc.go new file mode 100644 index 0000000000..708ea40e49 --- /dev/null +++ b/internal/sqltest/sqlite_modernc.go @@ -0,0 +1,7 @@ +//go:build !wasm + +package sqltest + +import ( + _ "modernc.org/sqlite" +) diff --git a/protos/analysis/analysis.proto b/protos/analysis/analysis.proto new file mode 100644 index 0000000000..60e53b56f1 --- /dev/null +++ b/protos/analysis/analysis.proto @@ -0,0 +1,39 @@ +syntax = "proto3"; + +package analysis; + +message Identifier { + string catalog = 1; + string schema = 2; + string name = 3; +} + +message Column { + string name = 1; + string original_name = 2; + string data_type = 3; + bool not_null = 4; + bool unsigned = 5; + bool is_array = 6; + int32 array_dims = 7; + string comment = 8; + int32 length = 9; // *int + bool is_named_param = 10; + bool is_func_call = 11; + string scope = 12; + Identifier table = 13; + string table_alias = 14; + Identifier type = 15; + Identifier embed_table = 16; + bool is_sqlc_slice = 17; +} + +message Parameter { + int32 number = 1; + Column column = 2; +} + +message Analysis { + repeated Column columns = 1; + repeated Parameter params = 2; +} diff --git a/protos/buf.yaml b/protos/buf.yaml index d2120761b6..998cf114e8 100644 --- a/protos/buf.yaml +++ b/protos/buf.yaml @@ -1,8 +1,8 @@ version: v1 -name: github.com/sqlc-dev/sqlc +name: buf.build/sqlc/sqlc breaking: lint: use: - DEFAULT except: - - PACKAGE_VERSION_SUFFIX \ No newline at end of file + - PACKAGE_VERSION_SUFFIX diff --git a/protos/plugin/codegen.proto b/protos/plugin/codegen.proto index be3915d2e6..e6faf19bad 100644 --- a/protos/plugin/codegen.proto +++ b/protos/plugin/codegen.proto @@ -2,106 +2,45 @@ syntax = "proto3"; package plugin; -option go_package = "github.com/sqlc-dev/sqlc/internal/plugin"; +service CodegenService { + rpc Generate (GenerateRequest) returns (GenerateResponse); +} message File { string name = 1 [json_name = "name"]; bytes contents = 2 [json_name = "contents"]; } -message Override { - // PythonType message was field 9 - 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"]; - - // name of the type to use, e.g. `text` - 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"]; - - // fully qualified name of the column, e.g. `accounts.id` - string column = 6 [json_name = "column"]; - - Identifier table = 7 [json_name = "table"]; - - 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"]; -} - -message ParsedGoType { - string import_path = 1; - string package = 2; - string type_name = 3; - bool basic_type = 4; - map struct_tags = 5; -} - message Settings { + // Rename message was field 5 + // Overides message was field 6 // PythonCode message was field 8 // KotlinCode message was field 9 - reserved 8, 9; + // GoCode message was field 10; + // JSONCode message was field 11; + reserved 5, 8, 9, 10, 11; 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 { + message Process { + string cmd = 1; + } + message WASM { + string url = 1; + string sha256 = 2; + } string out = 1 [json_name = "out"]; string plugin = 2 [json_name = "plugin"]; bytes options = 3 [json_name = "options"]; -} - -message GoCode { - bool emit_interface = 1; - bool emit_json_tags = 2; - bool emit_db_tags = 3; - bool emit_prepared_queries = 4; - bool emit_exact_table_names = 5; - bool emit_empty_slices = 6; - bool emit_exported_queries = 7; - bool emit_result_struct_pointers = 8; - bool emit_params_struct_pointers = 9; - bool emit_methods_with_db_argument = 10; - string json_tags_case_style = 11; - string package = 12; - string out = 13; - string sql_package = 14; - string sql_driver = 25; - string output_db_file_name = 15; - string output_models_file_name = 16; - string output_querier_file_name = 17; - string output_copyfrom_file_name = 28; - string output_files_suffix = 18; - bool emit_enum_valid_method = 19; - bool emit_all_enum_values = 20; - repeated string inflection_exclude_table_names = 21; - bool emit_pointers_for_null_types = 22; - optional int32 query_parameter_limit = 23; - string output_batch_file_name = 24; - bool json_tags_id_uppercase = 26; - bool omit_unused_structs = 27; -} - -message JSONCode { - string out = 1; - string indent = 2; - string filename = 3; + repeated string env = 4 [json_name = "env"]; + Process process = 5 [json_name = "process"]; + WASM wasm = 6 [json_name = "wasm"]; } message Catalog { @@ -179,14 +118,15 @@ message Parameter { Column column = 2 [json_name = "column"]; } -message CodeGenRequest { +message GenerateRequest { 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"]; + bytes global_options = 6 [json_name = "global_options"]; } -message CodeGenResponse { +message GenerateResponse { repeated File files = 1 [json_name = "files"]; } diff --git a/protos/vet/vet.proto b/protos/vet/vet.proto index 198c724408..9a5ded68ea 100644 --- a/protos/vet/vet.proto +++ b/protos/vet/vet.proto @@ -2,8 +2,6 @@ syntax = "proto3"; package vet; -option go_package = "github.com/sqlc-dev/sqlc/internal/vet"; - message Parameter { int32 number = 1 [json_name = "number"]; } diff --git a/scripts/bump-version/main.go b/scripts/bump-version/main.go index 2047de99fb..aaf3f58532 100644 --- a/scripts/bump-version/main.go +++ b/scripts/bump-version/main.go @@ -100,7 +100,7 @@ func run(current, next string, realmode bool) error { return nil } switch filepath.Ext(path) { - case ".go", ".kt", ".py", ".json": + case ".go", ".kt", ".py", ".json", ".md": c, err := os.ReadFile(path) if err != nil { return err @@ -109,12 +109,16 @@ func run(current, next string, realmode bool) error { new := strings.ReplaceAll(old, `"sqlc_version": "v`+current, `"sqlc_version": "v`+next) + new = strings.ReplaceAll(new, + `sqlc-version: "`+current, + `sqlc-version: "`+next) + new = strings.ReplaceAll(new, + `sqlc-version: '`+current, + `sqlc-version: '`+next) new = strings.ReplaceAll(new, "sqlc v"+current, "sqlc v"+next) new = strings.ReplaceAll(new, "SQLC_VERSION=v"+current, "SQLC_VERSION=v"+next) - if realmode { - if err := os.WriteFile(path, []byte(new), 0644); err != nil { - return fmt.Errorf("write error: %s: %w", path, err) - } + if err := write(path, old, new); err != nil { + return err } default: } @@ -135,5 +139,12 @@ func run(current, next string, realmode bool) error { } } + { + p := filepath.Join("docs") + if err := filepath.Walk(p, walker); err != nil { + return err + } + } + return nil } diff --git a/scripts/cleanup-test-dbs/main.go b/scripts/cleanup-test-dbs/main.go new file mode 100644 index 0000000000..51093db307 --- /dev/null +++ b/scripts/cleanup-test-dbs/main.go @@ -0,0 +1,55 @@ +package main + +import ( + "context" + "fmt" + "log" + "os" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgxpool" +) + +func main() { + if err := run(); err != nil { + log.Fatal(err) + } +} + +const query = ` +SELECT datname +FROM pg_database +WHERE datname LIKE 'sqlc_test_%' +` + +func run() error { + ctx := context.Background() + dburi := os.Getenv("POSTGRESQL_SERVER_URI") + if dburi == "" { + return fmt.Errorf("POSTGRESQL_SERVER_URI is empty") + } + pool, err := pgxpool.New(ctx, dburi) + if err != nil { + return err + } + + rows, err := pool.Query(ctx, query) + if err != nil { + return err + } + + names, err := pgx.CollectRows(rows, pgx.RowTo[string]) + if err != nil { + return err + } + + for _, name := range names { + drop := fmt.Sprintf(`DROP DATABASE IF EXISTS "%s" WITH (FORCE)`, name) + if _, err := pool.Exec(ctx, drop); err != nil { + return err + } + log.Println("dropping database", name) + } + + return nil +} diff --git a/scripts/mirror-go-plugin/main.go b/scripts/mirror-go-plugin/main.go new file mode 100644 index 0000000000..48277dc373 --- /dev/null +++ b/scripts/mirror-go-plugin/main.go @@ -0,0 +1,88 @@ +package main + +import ( + "bytes" + "flag" + "fmt" + "io/fs" + "log" + "os" + "path/filepath" + "strings" +) + +func main() { + flag.Parse() + // Assume it exists + loc := flag.Arg(0) + + dir := filepath.Join("internal", "codegen", "golang") + err := filepath.Walk(dir, func(path string, info fs.FileInfo, err error) error { + if err != nil { + return err + } + if info.IsDir() { + return nil + } + contents, err := os.ReadFile(path) + if err != nil { + return err + } + + newdir := filepath.Join(loc, "internal") + newpath := strings.Replace(path, dir, newdir, 1) + + os.MkdirAll(filepath.Dir(newpath), 0755) + + contents = bytes.ReplaceAll(contents, + []byte(`"github.com/sqlc-dev/sqlc/internal/codegen/golang/opts"`), + []byte(`"github.com/sqlc-dev/sqlc-gen-go/internal/opts"`)) + + contents = bytes.ReplaceAll(contents, + []byte(`"github.com/sqlc-dev/sqlc/internal/plugin"`), + []byte(`"github.com/sqlc-dev/plugin-sdk-go/plugin"`)) + + contents = bytes.ReplaceAll(contents, + []byte(`"github.com/sqlc-dev/sqlc/internal/codegen/sdk"`), + []byte(`"github.com/sqlc-dev/plugin-sdk-go/sdk"`)) + + contents = bytes.ReplaceAll(contents, + []byte(`"github.com/sqlc-dev/sqlc/internal/metadata"`), + []byte(`"github.com/sqlc-dev/plugin-sdk-go/metadata"`)) + + contents = bytes.ReplaceAll(contents, + []byte(`"github.com/sqlc-dev/sqlc/internal/pattern"`), + []byte(`"github.com/sqlc-dev/plugin-sdk-go/pattern"`)) + + contents = bytes.ReplaceAll(contents, + []byte(`"github.com/sqlc-dev/sqlc/internal/debug"`), + []byte(`"github.com/sqlc-dev/sqlc-gen-go/internal/debug"`)) + + contents = bytes.ReplaceAll(contents, + []byte(`"github.com/sqlc-dev/sqlc/internal/inflection"`), + []byte(`"github.com/sqlc-dev/sqlc-gen-go/internal/inflection"`)) + + if err := os.WriteFile(newpath, contents, 0644); err != nil { + return err + } + return nil + }) + + if err != nil { + fmt.Printf("error walking the path: %v\n", err) + return + } + + { + path := filepath.Join("internal", "inflection", "singular.go") + contents, err := os.ReadFile(path) + if err != nil { + log.Fatal(err) + } + newpath := filepath.Join(loc, "internal", "inflection", "singular.go") + if err := os.WriteFile(newpath, contents, 0644); err != nil { + log.Fatal(err) + } + } + +} diff --git a/scripts/regenerate/main.go b/scripts/regenerate/main.go deleted file mode 100644 index b2bcb2089f..0000000000 --- a/scripts/regenerate/main.go +++ /dev/null @@ -1,85 +0,0 @@ -package main - -import ( - "encoding/json" - "fmt" - "log" - "os" - "os/exec" - "path/filepath" - "strings" -) - -func parseExecCommand(path string) (string, error) { - var exec = struct { - Command string `json:"command"` - }{ - Command: "generate", - } - - execJsonPath := filepath.Join(path, "exec.json") - if _, err := os.Stat(execJsonPath); !os.IsNotExist(err) { - blob, err := os.ReadFile(execJsonPath) - if err != nil { - return "", err - } - if err := json.Unmarshal(blob, &exec); err != nil { - return "", err - } - } - - return exec.Command, nil -} - -func regenerate(dir string) error { - return filepath.Walk(dir, func(path string, info os.FileInfo, err error) error { - if err != nil { - return err - } - if info.IsDir() { - return nil - } - if strings.HasSuffix(path, "sqlc.json") || strings.HasSuffix(path, "sqlc.yaml") { - cwd := filepath.Dir(path) - command, err := parseExecCommand(cwd) - if err != nil { - return fmt.Errorf("failed to parse exec.json: %w", err) - } - - if command != "generate" { - return nil - } - - var expectFailure bool - if _, err := os.Stat(filepath.Join(cwd, "stderr.txt")); !os.IsNotExist(err) { - expectFailure = true - } - - cmd := exec.Command("sqlc-dev", "generate") - cmd.Env = append(cmd.Env, "SQLC_DUMMY_VALUE=true") - cmd.Dir = cwd - out, failed := cmd.CombinedOutput() - if failed != nil && !expectFailure { - return fmt.Errorf("%s: sqlc-dev generate failed\n%s", cwd, out) - } - if expectFailure { - if err := os.WriteFile(filepath.Join(cwd, "stderr.txt"), out, 0644); err != nil { - return fmt.Errorf("failed to update stderr.txt: %v", err) - } - } - } - return nil - }) -} - -func main() { - dirs := []string{ - filepath.Join("internal", "endtoend", "testdata"), - filepath.Join("examples"), - } - for _, d := range dirs { - if err := regenerate(d); err != nil { - log.Fatal(err) - } - } -} diff --git a/scripts/test-json-process-plugin/main.go b/scripts/test-json-process-plugin/main.go new file mode 100644 index 0000000000..6bcc7a25d0 --- /dev/null +++ b/scripts/test-json-process-plugin/main.go @@ -0,0 +1,39 @@ +package main + +import ( + "bytes" + "encoding/json" + "fmt" + "os" +) + +type Out struct { + Files []File `json:"files"` +} + +type File struct { + Name string `json:"name"` + Contents []byte `json:"contents"` +} + +func main() { + in := make(map[string]interface{}) + decoder := json.NewDecoder(os.Stdin) + err := decoder.Decode(&in) + if err != nil { + fmt.Fprintf(os.Stderr, "error generating JSON: %s", err) + os.Exit(2) + } + + buf := bytes.NewBuffer(nil) + queries := in["queries"].([]interface{}) + for _, q := range queries { + text := q.(map[string]interface{})["text"].(string) + buf.WriteString(text) + buf.WriteString("\n") + } + + e := json.NewEncoder(os.Stdout) + e.SetIndent("", " ") + e.Encode(&Out{Files: []File{{Name: "hello.txt", Contents: buf.Bytes()}}}) +}